mybatis中conut计数的sql怎么在mapper中写?

Mapper.java类这么写

@Mapper
public interface GoodsBindConfigMappingMapper {

    public int checkGoodsBindConfig(BindConfigBean bindConfigBean);
}

 

mapper.xml这么写

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pisen.cloud.luna.ms.goods.base.mapper.GoodsBindConfigMappingMapper">



    <select id="checkGoodsBindConfig" resultType="java.lang.Integer" parameterType="com.pisen.cloud.luna.ms.goods.api.beans.BindConfigBean">
        SELECT COUNT(*) FROM goods_bind_config_mapping
        WHERE

        good_config_flag = #{goodConfigFlag}

        AND
        good_type_uid IN
        <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
            #{item}
        </foreach>

    </select>


</mapper>

 

附录:

实体类如下:

public class BindConfigBean {

    private String goodsConfigUid;

    private Integer goodConfigFlag;// 1 话术  2 质保  3 保质期  4 扫码率  5  预约

    private List<String> goodsList;//商品分类OR商品uid list

   //get-set方法
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-24
  • 2022-02-16
  • 2022-12-23
  • 2022-12-23
  • 2021-05-23
  • 2022-12-23
猜你喜欢
  • 2021-06-04
  • 2021-10-02
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案