CustomersStartMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.order.mapper.CustomersStartMapper">
  6. <resultMap type="com.dgtly.order.domain.CustomersStart" id="CustomersStartResult">
  7. <result property="customersCode" column="customers_code" />
  8. <result property="customersName" column="customers_name" />
  9. <result property="onlineTime" column="online_time" />
  10. </resultMap>
  11. <sql id="selectCustomersStartVo">
  12. select customers_code, customers_name,online_time from customers_start
  13. </sql>
  14. <select id="selectCustomersStartList" parameterType="com.dgtly.order.domain.CustomersStart" resultMap="CustomersStartResult">
  15. <include refid="selectCustomersStartVo"/>
  16. <where>
  17. <if test="customersCode != null and customersCode != ''"> and customers_code like concat('%', #{customersCode}, '%')</if>
  18. <if test="customersName != null and customersName != ''"> and customers_name like concat('%', #{customersName}, '%')</if>
  19. <if test="onlineTime != null"> and online_time = #{onlineTime}</if>
  20. </where>
  21. order by online_time desc
  22. </select>
  23. <select id="selectCustomersStartByCustomersCode" parameterType="String" resultMap="CustomersStartResult">
  24. <include refid="selectCustomersStartVo"/>
  25. where customers_code = #{customersCode}
  26. </select>
  27. <select id="selectcustomersList" resultType="com.dgtly.order.domain.OrderCustomers" parameterType="com.dgtly.order.domain.OrderCustomers">
  28. select id, chains_code as chainsCode, chains_name as chainsName from customers
  29. where is_delete = 0
  30. and chains_code is not null
  31. and chains_name is not null
  32. <if test="chainsCode != null and chainsCode != ''">
  33. AND chains_code like concat('%', #{chainsCode}, '%')
  34. </if>
  35. <if test="chainsName != null and chainsName != ''">
  36. AND chains_name like concat('%', #{chainsName}, '%')
  37. </if>
  38. GROUP BY chains_code,chains_name
  39. </select>
  40. <select id="selectCustomersById" resultType="com.dgtly.order.domain.OrderCustomers" parameterType="Long">
  41. select id, chains_name as chainsName, chains_code as chainsCode, state_name as stateName, city_name as cityName
  42. from customers
  43. where is_delete = 0
  44. and chains_code is not null
  45. and chains_name is not null
  46. and id = #{id}
  47. </select>
  48. <select id="selectCustomerAuthList" resultType="com.dgtly.order.domain.CustomerAuthModel">
  49. SELECT
  50. mds.Org3code companyCode,
  51. mds.Org3name companyName,
  52. mds.Org4code saleCode,
  53. mds.Org4name saleName,
  54. mds.Org5code officeCode,
  55. mds.Org5name officeName,
  56. osc.suboffice_code subOfficeCode,
  57. osc.suboffice_name subOfficeName,
  58. osc.customer_id customerCode,
  59. osc.customer_name customerName,
  60. ce.org_attestation_time authTime
  61. FROM
  62. customers_ext ce
  63. LEFT JOIN order_sales_customer osc ON ce.chains_code = osc.customer_id
  64. LEFT JOIN meta_diy_salesorgtree mds ON osc.suboffice_code = mds.Org5code
  65. WHERE
  66. ce.org_attestation_time IS NOT NULL
  67. GROUP BY
  68. osc.customer_id
  69. ORDER BY mds.Org3name DESC
  70. </select>
  71. <insert id="insertCustomersStart" parameterType="com.dgtly.order.domain.CustomersStart">
  72. insert into customers_start
  73. <trim prefix="(" suffix=")" suffixOverrides=",">
  74. <if test="customersCode != null and customersCode != ''">customers_code,</if>
  75. <if test="customersName != null and customersName != ''">customers_name,</if>
  76. <if test="onlineTime != null">online_time,</if>
  77. </trim>
  78. <trim prefix="values (" suffix=")" suffixOverrides=",">
  79. <if test="customersCode != null and customersCode != ''">#{customersCode},</if>
  80. <if test="customersName != null and customersName != ''">#{customersName},</if>
  81. <if test="onlineTime != null">#{onlineTime},</if>
  82. </trim>
  83. </insert>
  84. <update id="updateCustomersStart" parameterType="com.dgtly.order.domain.CustomersStart">
  85. update customers_start
  86. <trim prefix="SET" suffixOverrides=",">
  87. <if test="customersName != null and customersName != ''">customers_name = #{customersName},</if>
  88. </trim>
  89. where customers_code = #{customersCode}
  90. </update>
  91. <delete id="deleteCustomersStartById" parameterType="String">
  92. delete from customers_start where customers_code = #{customersCode}
  93. </delete>
  94. <delete id="deleteCustomersStartByIds" parameterType="String">
  95. delete from customers_start where customers_code in
  96. <foreach item="customersCode" collection="array" open="(" separator="," close=")">
  97. #{customersCode}
  98. </foreach>
  99. </delete>
  100. </mapper>