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>
    
    
  • 相关阅读:
    c# 字符串中某个词出现的次数及索引
    c# 冒泡排序
    WCF 高级知识
    Web Api基础知识
    Web Services基础知识
    WCF Demo
    IIS部署WCF常见错误
    IIS部署WCF
    IIS部署WCF错误
    WCF基础知识
  • 原文地址:https://www.cnblogs.com/yangsanluo/p/14890556.html
Copyright © 2011-2022 走看看