| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <?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.dk.mdm.mapper.mst.CusFollowStaffMapper">
- <!-- 通用设置 -->
- <!-- 通用查询列 -->
- <sql id="Base_Column_List">
- cus_id, follow_staff, last_follow_id, last_follow_status, last_follow_time, follow_count, cp_id
- </sql>
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.CusFollowStaff">
- <id column="cus_id" property="cusId"/>
- <result column="follow_staff" property="followStaff" typeHandler="UuidTypeHandler"/>
- <result column="last_follow_id" property="lastFollowId" typeHandler="UuidTypeHandler"/>
- <result column="last_follow_status" property="lastFollowStatus"/>
- <result column="last_follow_time" property="lastFollowTime" typeHandler="TimestampTypeHandler"/>
- <result column="follow_count" property="followCount"/>
- <result column="cp_id" property="cpId"/>
- </resultMap>
- <!-- 通用条件列 -->
- <sql id="Condition">
- <where>
- <if test="followStaff != null and followStaff != ''">
- AND follow_staff = #{followStaff}
- </if>
- <if test="lastFollowId != null and lastFollowId != ''">
- AND last_follow_id = #{lastFollowId}
- </if>
- <if test="lastFollowStatus != null and lastFollowStatus != ''">
- AND last_follow_status = #{lastFollowStatus}
- </if>
- <if test="lastFollowTime != null">
- AND last_follow_time = #{lastFollowTime}
- </if>
- <if test="followCount != null">
- AND follow_count = #{followCount}
- </if>
- <if test="cpId != null">
- AND cp_id = #{cpId}
- </if>
- </where>
- </sql>
- <sql id="idsForeach">
- <!-- 根据主键cusId批量操作 -->
- WHERE cus_id in
- <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </sql>
- <!-- 查询表t_crm_cus_follow_staff,(条件查询+分页)列表 -->
- <select id="selectByCond" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM t_crm_cus_follow_staff
- <include refid="Condition"/>
- <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
- limit #{end} offset #{start}
- </if>
- </select>
- <!-- 查询表t_crm_cus_follow_staff,(条件查询)个数 -->
- <select id="countByCond" resultType="Long">
- SELECT
- count(1)
- FROM t_crm_cus_follow_staff
- <include refid="Condition"/>
- </select>
- <!-- 根据主键查询表t_crm_cus_follow_staff的一行数据 -->
- <select id="selectById" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM t_crm_cus_follow_staff
- WHERE cus_id = #{cusId}::uuid
- </select>
- <!-- 根据主键锁定表t_crm_cus_follow_staff的一行数据 -->
- <select id="selectByIdForUpdate" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM t_crm_cus_follow_staff
- WHERE cus_id = #{cusId}
- for update
- </select>
- <!-- 根据主键锁定表t_crm_cus_follow_staff的多行数据 -->
- <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM t_crm_cus_follow_staff
- <include refid="idsForeach"/>
- for update
- </select>
- <insert id="insertBatch">
- insert into t_crm_cus_follow_staff
- (
- <trim suffixOverrides=",">
- follow_staff,
- last_follow_id,
- last_follow_status,
- last_follow_time,
- follow_count,
- cp_id,
- </trim>
- )
- values
- <foreach collection="list" index="index" item="item" separator=",">
- (
- <trim suffixOverrides=",">
- #{item.followStaff}::uuid,
- #{item.lastFollowId}::uuid,
- #{item.lastFollowStatus},
- #{item.lastFollowTime},
- #{item.followCount},
- #{item.cpId},
- </trim>
- )
- </foreach>
- </insert>
- </mapper>
|