• 实现MyBatis批量查询


    Service
            public List<DeviceBean> getDeviceList(Map<String, Object> parameter);
    ServiceImpl
        @Override
        public Map<String, DeviceBean> getDeviceCollectStateIdByBean(Map<String, Object> parameter) {
            logger.info("DeviceServiceImpl{}==>getDeviceCollectStateIdByBean()");
            return deviceDao.getDeviceCollectStateIdByBean(parameter);
        }
    Dao
            public List<DeviceBean> getDeviceList(Map<String, Object> parameter);
    DaoImpl
        @Override
        public List<DeviceBean> getDeviceList(Map<String, Object> parameter) {
            logger.info("DeviceDaoImpl{}==>getDeviceList()");
            return getWriteSession().selectList(sqlId("getDeviceList"),parameter);
        }
    Mapper
     
        <select id="getDeviceList"   resultType="com.yjkj.zzx.system.bean.DeviceBean" parameterType="map" >
            select
                d.id as id, d.group_id as groupId,d.farm_id as farmId, d.house_id as houseId, d.code
            from t_device d
             WHERE  d.del_flag = '0' and d.code in
                <foreach item="item" index="index" collection="codelist" open="(" separator="," close=")">  
                  #{item}  
                </foreach>
        </select>
    测试打印结果
        List<String> codeList =new ArrayList<String>();
        codeList.add("b827ebee9322");
        codeList.add("111");
        codeList.add("1111");
        Map<String,Object> paramap=new HashMap<String,Object>();
        paramap.put("codelist", codeList);
        List<DeviceBean> res11 = deviceService.getDeviceList(paramap);
        System.out.println(res11);





  • 相关阅读:
    ionic platform add ios, Error:spawn EACCES
    OC中分类(Category)和扩展(Extension)
    JSON.stringify() 格式化 输出log
    JavaScript 闭包
    vue路由跳转到指定页面
    vue使用路由跳转到上一页
    vue子传父多个值
    vue里router-link标签设置动态路由的3个方法
    地址栏的路由输入不匹配时候,设置默认跳转页面(redirect)
    把router-link标签渲染成指定的标签
  • 原文地址:https://www.cnblogs.com/zhuyeshen/p/12009824.html
Copyright © 2020-2023  润新知