mybatis的foreach的使用
2015-06-27 18:39
363 查看
private MarketCategoryConversionRateMapper marketCategoryConversionRateMapper; List<Integer> ids = new ArrayList<Integer>(); Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("allPeopleNum", allmemberNum); paramMap.put("allConsumeNum", allsalesNum); paramMap.put("idlist", ids); this.marketCategoryConversionRateMapper.updateMarketConversionConversionRate(paramMap); public interface MarketCategoryConversionRateMapper { void updateMarketConversionConversionRate(Map<String, Object> paramMap); } <update id="updateMarketConversionConversionRate" parameterType="map" > UPDATE test SET ALL_PEOPLE_NUM=#{allPeopleNum},ALL_CONSUME_SUM=#{allConsumeNum} where ID IN <foreach item="item" index="index" collection="idlist" open="(" separator="," close=")"> #{item} </foreach> </update> public void insertBatchSpecialCustomer(List<SpecialCustomerEntity> list ) ; <insert id="insertBatchSpecialCustomer" parameterType="java.util.List" > replace into SPECIAL_CUSTOMER ( ID, SPECIAL_CUSTOMER_NAME, CUSTOMER_TYPE , member_type, RULE , HOBBY_RULE , STATUS, SALES_REPORT_STATUS , CREATE_TIME , TRACK_REPORT_STATUS , WIFI_REPORT_STATUS ) VALUES <foreach collection="list" item="item" index="index" separator="," > ( #{item.id}, #{item.specialCustomerName}, #{item.customerType}, #{item.memberType}, #{item.rule}, #{item.hobbyRule}, #{item.status}, #{item.salesReportStatus}, #{item.createTime}, #{item.trackReportStatus}, #{item.wifiReportStatus} ) </foreach> </insert> public List<SpecialCustomerEntity> findSpecialCustomerInfoList(List<String> customerTypeList ) ; <select id="findSpecialCustomerInfoList" parameterType="java.util.List" resultType="SpecialCustomerEntity"> select ID,SPECIAL_CUSTOMER_NAME as "specialCustomerName",CUSTOMER_TYPE as "customerType", member_type as "memberType",RULE , HOBBY_RULE as "hobbyRule",status , SALES_REPORT_STATUS as "salesReportStatus" ,CREATE_TIME as "createTime", TRACK_REPORT_STATUS as "trackReportStatus" , WIFI_REPORT_STATUS as "wifiReportStatus" from SPECIAL_CUSTOMER where CUSTOMER_TYPE in ( <foreach collection="list" item="item" index="index" separator="," > ${item} </foreach> ) </select>
相关文章推荐
- Summary Ranges
- FPGA图像处理系列——基于ZEDBoard构建图像处理通路(Block Ram版本)
- iOS:关于获取网络类型和运营商信息
- 读博:做科研的职业训练
- Codeforces 553B Kyoya and Permutation
- Java基础——线程(一)
- MATLAB的变量、向量和矩阵的定义与赋值
- 04-树8. Complete Binary Search Tree (30)
- 集群
- c++_1st par
- 集群
- 决定你人生命运的10年,你做了什么?
- 装win7和Ubuntu双系统
- Javascript之创建对象(工厂模式与构造函数模式)
- Skype for Business Server 2015-11-Web Application Proxy-部署
- Skype for Business Server 2015-11-Web Application Proxy-部署
- 音频焦点 (audio focus)(二)
- 排序1-冒泡,选择和插入
- LeetCode之“链表”:Sort List
- HDU 1018 Big Number (阶乘位数)