FollowPlanMapper.xml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.dk.mdm.mapper.mst.FollowPlanMapper">
  4. <!-- 通用设置 -->
  5. <!-- 通用查询列 -->
  6. <sql id="Base_Column_List">
  7. plan_id
  8. , cus_id, plan_type, follow_id, follow_user, next_follow_plan, next_follow_time,
  9. call_status, remarks, flg_valid, cp_id, op_create_time, op_create_user_id, op_update_time,
  10. op_update_user_id, op_app_code, op_timestamp, op_db_user,xxl_job_id
  11. </sql>
  12. <!-- 通用查询映射结果 -->
  13. <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.FollowPlan">
  14. <id column="plan_id" property="planId"/>
  15. <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
  16. <result column="plan_type" property="planType"/>
  17. <result column="follow_id" property="followId" typeHandler="UuidTypeHandler"/>
  18. <result column="follow_user" property="followUser" typeHandler="UuidTypeHandler"/>
  19. <result column="next_follow_plan" property="nextFollowPlan"/>
  20. <result column="next_follow_time" property="nextFollowTime" typeHandler="TimestampTypeHandler"/>
  21. <result column="call_status" property="callStatus"/>
  22. <result column="remarks" property="remarks"/>
  23. <result column="flg_valid" property="flgValid"/>
  24. <result column="cp_id" property="cpId"/>
  25. <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
  26. <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
  27. <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
  28. <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
  29. <result column="op_app_code" property="opAppCode"/>
  30. <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
  31. <result column="op_db_user" property="opDbUser"/>
  32. <result column="xxl_job_id" property="xxlJobId"/>
  33. </resultMap>
  34. <!-- 通用条件列 -->
  35. <sql id="Condition">
  36. <where>
  37. <if test="cusId != null and cusId != ''">
  38. AND cus_id = #{cusId}
  39. </if>
  40. <if test="planType != null">
  41. AND plan_type = #{planType}
  42. </if>
  43. <if test="followId != null and followId != ''">
  44. AND follow_id = #{followId}
  45. </if>
  46. <if test="followUser != null and followUser != ''">
  47. AND follow_user = #{followUser}
  48. </if>
  49. <if test="nextFollowPlan != null and nextFollowPlan != ''">
  50. AND next_follow_plan = #{nextFollowPlan}
  51. </if>
  52. <if test="nextFollowTime != null">
  53. AND next_follow_time = #{nextFollowTime}
  54. </if>
  55. <if test="callStatus != null and callStatus != ''">
  56. AND call_status = #{callStatus}
  57. </if>
  58. <if test="remarks != null and remarks != ''">
  59. AND remarks = #{remarks}
  60. </if>
  61. <if test="flgValid != null">
  62. AND flg_valid = #{flgValid}
  63. </if>
  64. <if test="cpId != null">
  65. AND cp_id = #{cpId}
  66. </if>
  67. <if test="opCreateTime != null">
  68. AND op_create_time = #{opCreateTime}
  69. </if>
  70. <if test="opCreateUserId != null and opCreateUserId != ''">
  71. AND op_create_user_id = #{opCreateUserId}
  72. </if>
  73. <if test="opUpdateTime != null">
  74. AND op_update_time = #{opUpdateTime}
  75. </if>
  76. <if test="opUpdateUserId != null and opUpdateUserId != ''">
  77. AND op_update_user_id = #{opUpdateUserId}
  78. </if>
  79. <if test="opAppCode != null and opAppCode != ''">
  80. AND op_app_code = #{opAppCode}
  81. </if>
  82. <if test="opTimestamp != null">
  83. AND op_timestamp = #{opTimestamp}
  84. </if>
  85. <if test="opDbUser != null and opDbUser != ''">
  86. AND op_db_user = #{opDbUser}
  87. </if>
  88. </where>
  89. </sql>
  90. <sql id="idsForeach">
  91. <!-- 根据主键planId批量操作 -->
  92. WHERE plan_id in
  93. <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
  94. #{item}
  95. </foreach>
  96. </sql>
  97. <!-- 查询表t_csm_follow_plan,(条件查询+分页)列表 -->
  98. <select id="selectByCond" resultMap="BaseResultMap">
  99. SELECT
  100. <include refid="Base_Column_List"/>
  101. FROM dkic_b.t_csm_follow_plan
  102. <include refid="Condition"/>
  103. <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
  104. limit #{end} offset #{start}
  105. </if>
  106. </select>
  107. <!-- 查询表t_csm_follow_plan,(条件查询)个数 -->
  108. <select id="countByCond" resultType="Long">
  109. SELECT
  110. count(1)
  111. FROM dkic_b.t_csm_follow_plan
  112. <include refid="Condition"/>
  113. </select>
  114. <!-- 根据主键查询表t_csm_follow_plan的一行数据 -->
  115. <select id="selectById" resultMap="BaseResultMap">
  116. SELECT
  117. <include refid="Base_Column_List"/>
  118. FROM dkic_b.t_csm_follow_plan
  119. WHERE plan_id = #{planId}::uuid
  120. </select>
  121. <!-- 根据主键锁定表t_csm_follow_plan的一行数据 -->
  122. <select id="selectByIdForUpdate" resultMap="BaseResultMap">
  123. SELECT
  124. <include refid="Base_Column_List"/>
  125. FROM dkic_b.t_csm_follow_plan
  126. WHERE plan_id = #{planId}
  127. for update
  128. </select>
  129. <!-- 根据主键锁定表t_csm_follow_plan的多行数据 -->
  130. <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
  131. SELECT
  132. <include refid="Base_Column_List"/>
  133. FROM dkic_b.t_csm_follow_plan
  134. <include refid="idsForeach"/>
  135. for update
  136. </select>
  137. <insert id="insertBatch">
  138. insert into dkic_b.t_csm_follow_plan
  139. (
  140. <trim suffixOverrides=",">
  141. cus_id,
  142. plan_type,
  143. follow_id,
  144. follow_user,
  145. next_follow_plan,
  146. next_follow_time,
  147. call_status,
  148. remarks,
  149. cp_id,
  150. op_app_code,
  151. </trim>
  152. )
  153. values
  154. <foreach collection="list" index="index" item="item" separator=",">
  155. (
  156. <trim suffixOverrides=",">
  157. #{item.cusId}::uuid,
  158. #{item.planType},
  159. #{item.followId}::uuid,
  160. #{item.followUser}::uuid,
  161. #{item.nextFollowPlan},
  162. #{item.nextFollowTime},
  163. #{item.callStatus},
  164. #{item.remarks},
  165. #{item.cpId},
  166. #{item.opAppCode},
  167. </trim>
  168. )
  169. </foreach>
  170. </insert>
  171. </mapper>