CustomersExtMapper.xml 6.6 KB

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