BasicCustomerMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.miniapp.bus.mapper.BasicCustomerMapper">
  6. <resultMap type="com.miniapp.bus.domain.BasicCustomer" id="BasicCustomerResult">
  7. <result property="id" column="id" />
  8. <result property="parentid" column="parentid" />
  9. <result property="customerNo" column="customer_no" />
  10. <result property="customerName" column="customer_name" />
  11. <result property="customerContact" column="customer_contact" />
  12. <result property="customerInformation" column="customer_information" />
  13. <result property="customerType" column="customer_type" />
  14. <result property="deltag" column="deltag" />
  15. <result property="createBy" column="create_by" />
  16. <result property="createTime" column="create_time" />
  17. <result property="updateBy" column="update_by" />
  18. <result property="updateTime" column="update_time" />
  19. <result property="remark" column="remark" />
  20. </resultMap>
  21. <sql id="selectBasicCustomerVo">
  22. select id, parentid, customer_no, customer_name, customer_contact, customer_information, customer_type, deltag, create_by, create_time, update_by, update_time, remark from basic_customer
  23. </sql>
  24. <select id="selectBasicCustomerList" parameterType="BasicCustomer" resultMap="BasicCustomerResult">
  25. <include refid="selectBasicCustomerVo"/>
  26. <where>
  27. <if test="parentid != null "> and parentid = #{parentid}</if>
  28. <if test="customerNo != null and customerNo != ''"> and customer_no = #{customerNo}</if>
  29. <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
  30. <if test="customerContact != null and customerContact != ''"> and customer_contact = #{customerContact}</if>
  31. <if test="customerInformation != null and customerInformation != ''"> and customer_information = #{customerInformation}</if>
  32. <if test="customerType != null and customerType != ''"> and customer_type = #{customerType}</if>
  33. <if test="deltag != null and deltag != ''"> and deltag = #{deltag}</if>
  34. </where>
  35. </select>
  36. <select id="selectBasicCustomerById" parameterType="Long" resultMap="BasicCustomerResult">
  37. <include refid="selectBasicCustomerVo"/>
  38. where id = #{id}
  39. </select>
  40. <insert id="insertBasicCustomer" parameterType="BasicCustomer" useGeneratedKeys="true" keyProperty="id">
  41. insert into basic_customer
  42. <trim prefix="(" suffix=")" suffixOverrides=",">
  43. <if test="parentid != null">parentid,</if>
  44. <if test="customerNo != null">customer_no,</if>
  45. <if test="customerName != null">customer_name,</if>
  46. <if test="customerContact != null">customer_contact,</if>
  47. <if test="customerInformation != null">customer_information,</if>
  48. <if test="customerType != null">customer_type,</if>
  49. <if test="deltag != null">deltag,</if>
  50. <if test="createBy != null">create_by,</if>
  51. <if test="createTime != null">create_time,</if>
  52. <if test="updateBy != null">update_by,</if>
  53. <if test="updateTime != null">update_time,</if>
  54. <if test="remark != null">remark,</if>
  55. </trim>
  56. <trim prefix="values (" suffix=")" suffixOverrides=",">
  57. <if test="parentid != null">#{parentid},</if>
  58. <if test="customerNo != null">#{customerNo},</if>
  59. <if test="customerName != null">#{customerName},</if>
  60. <if test="customerContact != null">#{customerContact},</if>
  61. <if test="customerInformation != null">#{customerInformation},</if>
  62. <if test="customerType != null">#{customerType},</if>
  63. <if test="deltag != null">#{deltag},</if>
  64. <if test="createBy != null">#{createBy},</if>
  65. <if test="createTime != null">#{createTime},</if>
  66. <if test="updateBy != null">#{updateBy},</if>
  67. <if test="updateTime != null">#{updateTime},</if>
  68. <if test="remark != null">#{remark},</if>
  69. </trim>
  70. </insert>
  71. <update id="updateBasicCustomer" parameterType="BasicCustomer">
  72. update basic_customer
  73. <trim prefix="SET" suffixOverrides=",">
  74. <if test="parentid != null">parentid = #{parentid},</if>
  75. <if test="customerNo != null">customer_no = #{customerNo},</if>
  76. <if test="customerName != null">customer_name = #{customerName},</if>
  77. <if test="customerContact != null">customer_contact = #{customerContact},</if>
  78. <if test="customerInformation != null">customer_information = #{customerInformation},</if>
  79. <if test="customerType != null">customer_type = #{customerType},</if>
  80. <if test="deltag != null">deltag = #{deltag},</if>
  81. <if test="createBy != null">create_by = #{createBy},</if>
  82. <if test="createTime != null">create_time = #{createTime},</if>
  83. <if test="updateBy != null">update_by = #{updateBy},</if>
  84. <if test="updateTime != null">update_time = #{updateTime},</if>
  85. <if test="remark != null">remark = #{remark},</if>
  86. </trim>
  87. where id = #{id}
  88. </update>
  89. <delete id="deleteBasicCustomerById" parameterType="Long">
  90. delete from basic_customer where id = #{id}
  91. </delete>
  92. <delete id="deleteBasicCustomerByIds" parameterType="String">
  93. delete from basic_customer where id in
  94. <foreach item="id" collection="array" open="(" separator="," close=")">
  95. #{id}
  96. </foreach>
  97. </delete>
  98. </mapper>