SysCustomerMapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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.yunfeiyun.agmp.fms.mapper.SysCustomerMapper">
  6. <sql id="selectSysCustomerVo">
  7. select customerId, customerRealname, customerProvince, customerCity, customerArea, customerContactaddress, customerContanctway, customerContancts, customerRemark from SysCustomer
  8. </sql>
  9. <select id="selectSysCustomerList" parameterType="SysCustomer" resultType="SysCustomerResVo">
  10. select c.customerId, c.customerRealname, c.customerProvince, c.customerCity, c.customerArea,
  11. c.customerContactaddress, c.customerContanctway, c.customerContancts, c.customerRemark,
  12. (select GROUP_CONCAT(resUrl) from SysRes r where r.resBusId = c.customerId) customerPreview,
  13. (select GROUP_CONCAT(resId) from SysRes r where r.resBusId = c.customerId) resIds
  14. from SysCustomer c
  15. <where>
  16. <if test="customerRealname != null and customerRealname != ''"> and customerRealname like concat('%', #{customerRealname}, '%')</if>
  17. <if test="customerProvince != null and customerProvince != ''"> and customerProvince = #{customerProvince}</if>
  18. <if test="customerCity != null and customerCity != ''"> and customerCity = #{customerCity}</if>
  19. <if test="customerArea != null and customerArea != ''"> and customerArea = #{customerArea}</if>
  20. <if test="customerContactaddress != null and customerContactaddress != ''"> and customerContactaddress = #{customerContactaddress}</if>
  21. <if test="customerContanctway != null and customerContanctway != ''"> and customerContanctway = #{customerContanctway}</if>
  22. <if test="customerContancts != null and customerContancts != ''"> and customerContancts = #{customerContancts}</if>
  23. <if test="customerRemark != null and customerRemark != ''"> and customerRemark = #{customerRemark}</if>
  24. <if test="customerDelstatus != null ">and customerDelstatus = #{customerDelstatus}</if>
  25. <if test="tid != null and tid !='' and tid != '-1'">
  26. and tid = #{tid}
  27. </if>
  28. </where>
  29. </select>
  30. <select id="selectSysCustomerByCustomerId" parameterType="String" resultType="SysCustomer">
  31. <include refid="selectSysCustomerVo"/>
  32. where customerId = #{customerId}
  33. <if test="tid != null and tid !='' and tid != '-1'">
  34. and tid = #{tid}
  35. </if>
  36. </select>
  37. <insert id="insertSysCustomer" parameterType="SysCustomer">
  38. insert into SysCustomer
  39. <trim prefix="(" suffix=")" suffixOverrides=",">
  40. <if test="customerId != null">customerId,</if>
  41. <if test="customerRealname != null">customerRealname,</if>
  42. <if test="customerProvince != null">customerProvince,</if>
  43. <if test="customerCity != null">customerCity,</if>
  44. <if test="customerArea != null">customerArea,</if>
  45. <if test="customerContactaddress != null">customerContactaddress,</if>
  46. <if test="customerContanctway != null">customerContanctway,</if>
  47. <if test="customerContancts != null">customerContancts,</if>
  48. <if test="customerRemark != null">customerRemark,</if>
  49. <if test="customerDelstatus != null"> customerDelstatus,</if>
  50. <if test="tid != null">tid,</if>
  51. </trim>
  52. <trim prefix="values (" suffix=")" suffixOverrides=",">
  53. <if test="customerId != null">#{customerId},</if>
  54. <if test="customerRealname != null">#{customerRealname},</if>
  55. <if test="customerProvince != null">#{customerProvince},</if>
  56. <if test="customerCity != null">#{customerCity},</if>
  57. <if test="customerArea != null">#{customerArea},</if>
  58. <if test="customerContactaddress != null">#{customerContactaddress},</if>
  59. <if test="customerContanctway != null">#{customerContanctway},</if>
  60. <if test="customerContancts != null">#{customerContancts},</if>
  61. <if test="customerRemark != null">#{customerRemark},</if>
  62. <if test="customerDelstatus != null"> #{customerDelstatus},</if>
  63. <if test="tid != null">#{tid},</if>
  64. </trim>
  65. </insert>
  66. <update id="updateSysCustomer" parameterType="SysCustomer">
  67. update SysCustomer
  68. <trim prefix="SET" suffixOverrides=",">
  69. <if test="customerRealname != null">customerRealname = #{customerRealname},</if>
  70. <if test="customerProvince != null">customerProvince = #{customerProvince},</if>
  71. <if test="customerCity != null">customerCity = #{customerCity},</if>
  72. <if test="customerArea != null">customerArea = #{customerArea},</if>
  73. <if test="customerContactaddress != null">customerContactaddress = #{customerContactaddress},</if>
  74. <if test="customerContanctway != null">customerContanctway = #{customerContanctway},</if>
  75. <if test="customerContancts != null">customerContancts = #{customerContancts},</if>
  76. <if test="customerRemark != null">customerRemark = #{customerRemark},</if>
  77. <if test="customerDelstatus != null">customerDelstatus = #{customerDelstatus},</if>
  78. <if test="tid != null">tid = #{tid},</if>
  79. </trim>
  80. where customerId = #{customerId}
  81. <if test="tid != null and tid !='' and tid != '-1'">
  82. and tid = #{tid}
  83. </if>
  84. </update>
  85. <delete id="deleteSysCustomerByCustomerId" parameterType="String">
  86. UPDATE SysCustomer set customerDelstatus = '1' where customerId = #{customerId}
  87. <if test="tid != null and tid !='' and tid != '-1'">
  88. and tid = #{tid}
  89. </if>
  90. </delete>
  91. <delete id="deleteSysCustomerByCustomerIds" parameterType="String">
  92. UPDATE SysCustomer set customerDelstatus = '1' where customerId in
  93. <foreach item="customerId" collection="array" open="(" separator="," close=")">
  94. #{customerId}
  95. </foreach>
  96. <if test="tid != null and tid !='' and tid != '-1'">
  97. and tid = #{tid}
  98. </if>
  99. </delete>
  100. </mapper>