zoukankan      html  css  js  c++  java
  • 实现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);





  • 相关阅读:
    上市前为什么要分红
    在文件开始追加一行
    c++ 日期时间工具
    windows c++找不到time.h sys/types.h
    截取ls -l的某一列
    提取指定类型文件到指定目录,保留目录结构
    批量转换当前目录下的文件名为snake case
    vcpkg boost uuid Bcrypt 链接问题
    文件名pascal转underscore
    vcpkg cmake 找不到boost
  • 原文地址:https://www.cnblogs.com/zhuyeshen/p/12009824.html
Copyright © 2011-2022 走看看