CustomerTransferApprovalMapper.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.qw.mapper.CustomerTransferApprovalMapper">
  6. <resultMap type="CustomerTransferApproval" id="CustomerTransferApprovalResult">
  7. <result property="id" column="id" />
  8. <result property="corpId" column="corp_id" />
  9. <result property="transferType" column="transfer_type" />
  10. <result property="customerIds" column="customer_ids" />
  11. <result property="originalUserId" column="original_user_id" />
  12. <result property="targetUserId" column="target_user_id" />
  13. <result property="initiatorUserId" column="initiator_user_id" />
  14. <result property="content" column="content" />
  15. <result property="approvalStatus" column="approval_status" />
  16. <result property="approverUserId" column="approver_user_id" />
  17. <result property="approvalRemark" column="approval_remark" />
  18. <result property="processedAt" column="processed_at" />
  19. <result property="createdAt" column="created_at" />
  20. <result property="updatedAt" column="updated_at" />
  21. <result property="transferBefore" column="transfer_before" />
  22. </resultMap>
  23. <sql id="selectCustomerTransferApprovalVo">
  24. select id, corp_id, transfer_type, customer_ids, original_user_id, target_user_id, initiator_user_id, content, approval_status, approver_user_id, approval_remark, processed_at, created_at, updated_at,transfer_before from customer_transfer_approval
  25. </sql>
  26. <select id="selectCustomerTransferApprovalList" parameterType="CustomerTransferApproval" resultMap="CustomerTransferApprovalResult">
  27. <include refid="selectCustomerTransferApprovalVo"/>
  28. <where>
  29. <if test="corpId != null and corpId != ''"> and corp_id = #{corpId}</if>
  30. <if test="transferType != null "> and transfer_type = #{transferType}</if>
  31. <if test="customerIds != null and customerIds != ''"> and customer_ids = #{customerIds}</if>
  32. <if test="originalUserId != null "> and original_user_id = #{originalUserId}</if>
  33. <if test="targetUserId != null "> and target_user_id = #{targetUserId}</if>
  34. <if test="initiatorUserId != null "> and initiator_user_id = #{initiatorUserId}</if>
  35. <if test="content != null and content != ''"> and content = #{content}</if>
  36. <if test="approvalStatus != null "> and approval_status = #{approvalStatus}</if>
  37. <if test="approverUserId != null "> and approver_user_id = #{approverUserId}</if>
  38. <if test="approvalRemark != null and approvalRemark != ''"> and approval_remark = #{approvalRemark}</if>
  39. <if test="processedAt != null "> and processed_at = #{processedAt}</if>
  40. <if test="createdAt != null "> and created_at = #{createdAt}</if>
  41. <if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
  42. </where>
  43. order by id desc
  44. </select>
  45. <select id="selectCustomerTransferApprovalById" parameterType="Long" resultMap="CustomerTransferApprovalResult">
  46. <include refid="selectCustomerTransferApprovalVo"/>
  47. where id = #{id}
  48. </select>
  49. <select id="queryPendingData" resultType="com.fs.qw.domain.CustomerTransferApproval">
  50. select * from customer_transfer_approval where approval_status=0
  51. </select>
  52. <insert id="insertCustomerTransferApproval" parameterType="CustomerTransferApproval" useGeneratedKeys="true" keyProperty="id">
  53. insert into customer_transfer_approval
  54. <trim prefix="(" suffix=")" suffixOverrides=",">
  55. <if test="corpId != null and corpId != ''">corp_id,</if>
  56. <if test="transferType != null">transfer_type,</if>
  57. <if test="customerIds != null and customerIds != ''">customer_ids,</if>
  58. <if test="originalUserId != null">original_user_id,</if>
  59. <if test="targetUserId != null">target_user_id,</if>
  60. <if test="initiatorUserId != null">initiator_user_id,</if>
  61. <if test="content != null">content,</if>
  62. <if test="approvalStatus != null">approval_status,</if>
  63. <if test="approverUserId != null">approver_user_id,</if>
  64. <if test="approvalRemark != null">approval_remark,</if>
  65. <if test="processedAt != null">processed_at,</if>
  66. <if test="createdAt != null">created_at,</if>
  67. <if test="updatedAt != null">updated_at,</if>
  68. <if test="transferBefore != null">transfer_before,</if>
  69. </trim>
  70. <trim prefix="values (" suffix=")" suffixOverrides=",">
  71. <if test="corpId != null and corpId != ''">#{corpId},</if>
  72. <if test="transferType != null">#{transferType},</if>
  73. <if test="customerIds != null and customerIds != ''">#{customerIds},</if>
  74. <if test="originalUserId != null">#{originalUserId},</if>
  75. <if test="targetUserId != null">#{targetUserId},</if>
  76. <if test="initiatorUserId != null">#{initiatorUserId},</if>
  77. <if test="content != null">#{content},</if>
  78. <if test="approvalStatus != null">#{approvalStatus},</if>
  79. <if test="approverUserId != null">#{approverUserId},</if>
  80. <if test="approvalRemark != null">#{approvalRemark},</if>
  81. <if test="processedAt != null">#{processedAt},</if>
  82. <if test="createdAt != null">#{createdAt},</if>
  83. <if test="updatedAt != null">#{updatedAt},</if>
  84. <if test="transferBefore != null">#{transferBefore},</if>
  85. </trim>
  86. </insert>
  87. <update id="updateCustomerTransferApproval" parameterType="CustomerTransferApproval">
  88. update customer_transfer_approval
  89. <trim prefix="SET" suffixOverrides=",">
  90. <if test="corpId != null and corpId != ''">corp_id = #{corpId},</if>
  91. <if test="transferType != null">transfer_type = #{transferType},</if>
  92. <if test="customerIds != null and customerIds != ''">customer_ids = #{customerIds},</if>
  93. <if test="originalUserId != null">original_user_id = #{originalUserId},</if>
  94. <if test="targetUserId != null">target_user_id = #{targetUserId},</if>
  95. <if test="initiatorUserId != null">initiator_user_id = #{initiatorUserId},</if>
  96. <if test="content != null">content = #{content},</if>
  97. <if test="approvalStatus != null">approval_status = #{approvalStatus},</if>
  98. <if test="approverUserId != null">approver_user_id = #{approverUserId},</if>
  99. <if test="approvalRemark != null">approval_remark = #{approvalRemark},</if>
  100. <if test="processedAt != null">processed_at = #{processedAt},</if>
  101. <if test="createdAt != null">created_at = #{createdAt},</if>
  102. <if test="updatedAt != null">updated_at = #{updatedAt},</if>
  103. <if test="transferBefore != null">transfer_before = #{transferBefore},</if>
  104. </trim>
  105. where id = #{id}
  106. </update>
  107. <delete id="deleteCustomerTransferApprovalById" parameterType="Long">
  108. delete from customer_transfer_approval where id = #{id}
  109. </delete>
  110. <delete id="deleteCustomerTransferApprovalByIds" parameterType="String">
  111. delete from customer_transfer_approval where id in
  112. <foreach item="id" collection="array" open="(" separator="," close=")">
  113. #{id}
  114. </foreach>
  115. </delete>
  116. </mapper>