zoukankan      html  css  js  c++  java
  • mysql操作数据库集合常用语句

    插入:

    void insertMerchantBusiness(List<MerchantBusinessType> list);



    <insert id="insertMerchantBusiness">
    insert into t_merchant_business_type
    (merchant_id, business_type_id)
    values
    <foreach item="item" collection="list" separator=",">
    (#{item.merchantId}, #{item.businessTypeId})
    </foreach>
    </insert>



    -----------------------------------------
    查询:

    List<Integer> selectBusinessTypeIds(List<String> type);


    <select id="selectBusinessTypeIds" resultType="integer">
    select id from t_business_type
    where type in
    <foreach item="item" index="index" collection="list"
    open="(" separator="," close=")">
    #{item}
    </foreach>
    </select>
    ------------------------------------------------------------

    删除:
    void deleteMerchantBusiness(int merchantId, List<Integer> types);

    <delete id="deleteMerchantBusiness">
    delete from t_merchant_business_type
    where merchant_id = #{merchantId}
    and business_type_id in
    <foreach item="item" index="index" collection="list"
    open="(" separator="," close=")">
    #{item}
    </foreach>
    </delete>
    
    
  • 相关阅读:
    棋盘问题 POJ
    Fire! UVA
    走迷宫(bfs, 最短路)
    ASP-Command-SQL格式
    ASP连接数据库SQLServer
    Bootstrap学习-导航条-分页导航
    Bootstrap导航栏头部错位问题
    SQLServer判断一个IP是否在一个IP段里
    MySQL合并多行
    CSS图片居中,多余隐藏
  • 原文地址:https://www.cnblogs.com/yangsanluo/p/14890556.html
Copyright © 2011-2022 走看看