CustomersExtMapper.xml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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.dgtly.system.mapper.CustomersExtMapper">
  6. <resultMap type="CustomersExt" id="CustomersExtResult">
  7. <result property="chainsCode" column="chains_code" />
  8. <result property="creator" column="creator" />
  9. <result property="customersName" column="customers_name" />
  10. <result property="orgId" column="org_id" />
  11. <result property="idType" column="id_type" />
  12. <result property="idNumber" column="id_number" />
  13. <result property="orgLegalidNumber" column="org_legalId_number" />
  14. <result property="orgLegalName" column="org_legal_name" />
  15. <result property="isAuthentication" column="is_authentication" />
  16. <result property="orgAttestationTime" column="org_attestation_time" />
  17. <result property="receiveUrlMobileNo" column="receive_url_mobile_no" />
  18. </resultMap>
  19. <sql id="selectCustomersExtVo">
  20. select chains_code, creator, customers_name, org_id, id_type, id_number, org_legalId_number, org_legal_name, is_authentication, org_attestation_time,receive_url_mobile_no from customers_ext
  21. </sql>
  22. <select id="selectCustomersExtList" parameterType="CustomersExt" resultMap="CustomersExtResult">
  23. <include refid="selectCustomersExtVo"/>
  24. <where>
  25. <if test="creator != null and creator != ''"> and creator = #{creator}</if>
  26. <if test="customersName != null and customersName != ''"> and customers_name like concat('%', #{customersName}, '%')</if>
  27. <if test="orgId != null and orgId != ''"> and org_id = #{orgId}</if>
  28. <if test="idType != null and idType != ''"> and id_type = #{idType}</if>
  29. <if test="idNumber != null and idNumber != ''"> and id_number = #{idNumber}</if>
  30. <if test="orgLegalidNumber != null and orgLegalidNumber != ''"> and org_legalId_number = #{orgLegalidNumber}</if>
  31. <if test="orgLegalName != null and orgLegalName != ''"> and org_legal_name like concat('%', #{orgLegalName}, '%')</if>
  32. <if test="isAuthentication != null and isAuthentication != ''"> and is_authentication = #{isAuthentication}</if>
  33. <if test="receiveUrlMobileNo != null and receiveUrlMobileNo != ''"> and receive_url_mobile_no = #{receiveUrlMobileNo}</if>
  34. </where>
  35. </select>
  36. <select id="selectCustomersExtById" parameterType="String" resultMap="CustomersExtResult">
  37. <include refid="selectCustomersExtVo"/>
  38. where chains_code = #{chainsCode}
  39. </select>
  40. <!--根据订单id关联订单基础信息表查询经销商注册id-->
  41. <select id="selectOrgIdByOrderId" resultType="java.lang.String">
  42. SELECT
  43. s.org_id
  44. FROM
  45. sales_order_base t
  46. LEFT JOIN customers_ext s ON t.belong_to = s.chains_code
  47. WHERE t.is_delete=0
  48. and t.order_number = #{orderId};
  49. </select>
  50. <!--根据订单id关联订单基础信息表查询经销商代号-->
  51. <select id="selectChainsCodeByOrderId" resultType="java.lang.String">
  52. SELECT
  53. org_id
  54. FROM
  55. customers_ext
  56. WHERE 1=1
  57. <if test="customerCode !=null">
  58. and chains_code=#{customerCode}
  59. </if>
  60. </select>
  61. <insert id="insertCustomersExt" parameterType="CustomersExt">
  62. insert into customers_ext
  63. <trim prefix="(" suffix=")" suffixOverrides=",">
  64. <if test="chainsCode != null and chainsCode != ''">chains_code,</if>
  65. <if test="creator != null and creator != ''">creator,</if>
  66. <if test="customersName != null and customersName != ''">customers_name,</if>
  67. <if test="orgId != null and orgId != ''">org_id,</if>
  68. <if test="idType != null and idType != ''">id_type,</if>
  69. <if test="idNumber != null and idNumber != ''">id_number,</if>
  70. <if test="orgLegalidNumber != null and orgLegalidNumber != ''">org_legalId_number,</if>
  71. <if test="orgLegalName != null and orgLegalName != ''">org_legal_name,</if>
  72. <if test="isAuthentication != null and isAuthentication != ''">is_authentication,</if>
  73. <if test="receiveUrlMobileNo != null and receiveUrlMobileNo != ''">receive_url_mobile_no,</if>
  74. </trim>
  75. <trim prefix="values (" suffix=")" suffixOverrides=",">
  76. <if test="chainsCode != null and chainsCode != ''">#{chainsCode},</if>
  77. <if test="creator != null and creator != ''">#{creator},</if>
  78. <if test="customersName != null and customersName != ''">#{customersName},</if>
  79. <if test="orgId != null and orgId != ''">#{orgId},</if>
  80. <if test="idType != null and idType != ''">#{idType},</if>
  81. <if test="idNumber != null and idNumber != ''">#{idNumber},</if>
  82. <if test="orgLegalidNumber != null and orgLegalidNumber != ''">#{orgLegalidNumber},</if>
  83. <if test="orgLegalName != null and orgLegalName != ''">#{orgLegalName},</if>
  84. <if test="isAuthentication != null and isAuthentication != ''">#{isAuthentication},</if>
  85. <if test="receiveUrlMobileNo != null and receiveUrlMobileNo != ''">#{receiveUrlMobileNo},</if>
  86. </trim>
  87. </insert>
  88. <update id="updateCustomersExt" parameterType="CustomersExt">
  89. update customers_ext
  90. <trim prefix="SET" suffixOverrides=",">
  91. <if test="creator != null and creator != ''">creator = #{creator},</if>
  92. <if test="customersName != null and customersName != ''">customers_name = #{customersName},</if>
  93. <if test="orgId != null and orgId != ''">org_id = #{orgId},</if>
  94. <if test="idType != null and idType != ''">id_type = #{idType},</if>
  95. <if test="idNumber != null and idNumber != ''">id_number = #{idNumber},</if>
  96. <if test="orgLegalidNumber != null and orgLegalidNumber != ''">org_legalId_number = #{orgLegalidNumber},</if>
  97. <if test="orgLegalName != null and orgLegalName != ''">org_legal_name = #{orgLegalName},</if>
  98. <if test="isAuthentication != null and isAuthentication != ''">is_authentication = #{isAuthentication},</if>
  99. <if test="receiveUrlMobileNo != null and receiveUrlMobileNo != ''">receive_url_mobile_no = #{receiveUrlMobileNo},</if>
  100. </trim>
  101. where chains_code = #{chainsCode}
  102. </update>
  103. <update id="updateCustomersIsAuthentication" parameterType="String">
  104. update customers_ext set is_authentication = #{isAuthentication}, org_attestation_time = now()
  105. where org_id = #{accountId}
  106. </update>
  107. <delete id="deleteCustomersExtById" parameterType="String">
  108. delete from customers_ext where chains_code = #{chainsCode}
  109. </delete>
  110. <delete id="deleteCustomersExtByIds" parameterType="String">
  111. delete from customers_ext where chains_code in
  112. <foreach item="chainsCode" collection="array" open="(" separator="," close=")">
  113. #{chainsCode}
  114. </foreach>
  115. </delete>
  116. </mapper>