CustomersStartMapper.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. </resultMap>
  10. <sql id="selectCustomersStartVo">
  11. select customers_code, customers_name from customers_start
  12. </sql>
  13. <select id="selectCustomersStartList" parameterType="com.dgtly.order.domain.CustomersStart" resultMap="CustomersStartResult">
  14. <include refid="selectCustomersStartVo"/>
  15. <where>
  16. <if test="customersCode != null and customersCode != ''"> and customers_code like concat('%', #{customersCode}, '%')</if>
  17. <if test="customersName != null and customersName != ''"> and customers_name like concat('%', #{customersName}, '%')</if>
  18. </where>
  19. </select>
  20. <select id="selectCustomersStartById" parameterType="String" resultMap="CustomersStartResult">
  21. <include refid="selectCustomersStartVo"/>
  22. where customers_code = #{customersCode}
  23. </select>
  24. <select id="selectcustomersList" resultType="com.dgtly.order.domain.OrderCustomers" parameterType="com.dgtly.order.domain.OrderCustomers">
  25. select id, chains_code as chainsCode, chains_name as chainsName from customers
  26. where is_delete = 0
  27. and chains_code is not null
  28. and chains_name is not null
  29. <if test="chainsCode != null and chainsCode != ''">
  30. AND chains_code like concat('%', #{chainsCode}, '%')
  31. </if>
  32. <if test="chainsName != null and chainsName != ''">
  33. AND chains_name like concat('%', #{chainsName}, '%')
  34. </if>
  35. GROUP BY chains_code
  36. </select>
  37. <select id="selectCustomersById" resultType="com.dgtly.order.domain.OrderCustomers" parameterType="Long">
  38. select id, chains_name as chainsName, chains_code as chainsCode, state_name as stateName, city_name as cityName
  39. from customers
  40. where is_delete = 0
  41. and chains_code is not null
  42. and chains_name is not null
  43. and id = #{id}
  44. </select>
  45. <insert id="insertCustomersStart" parameterType="com.dgtly.order.domain.CustomersStart">
  46. insert into customers_start
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test="customersCode != null and customersCode != ''">customers_code,</if>
  49. <if test="customersName != null and customersName != ''">customers_name,</if>
  50. </trim>
  51. <trim prefix="values (" suffix=")" suffixOverrides=",">
  52. <if test="customersCode != null and customersCode != ''">#{customersCode},</if>
  53. <if test="customersName != null and customersName != ''">#{customersName},</if>
  54. </trim>
  55. </insert>
  56. <update id="updateCustomersStart" parameterType="com.dgtly.order.domain.CustomersStart">
  57. update customers_start
  58. <trim prefix="SET" suffixOverrides=",">
  59. <if test="customersName != null and customersName != ''">customers_name = #{customersName},</if>
  60. </trim>
  61. where customers_code = #{customersCode}
  62. </update>
  63. <delete id="deleteCustomersStartById" parameterType="String">
  64. delete from customers_start where customers_code = #{customersCode}
  65. </delete>
  66. <delete id="deleteCustomersStartByIds" parameterType="String">
  67. delete from customers_start where customers_code in
  68. <foreach item="customersCode" collection="array" open="(" separator="," close=")">
  69. #{customersCode}
  70. </foreach>
  71. </delete>
  72. </mapper>