IntegralOrderMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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.yijia.integral.mapper.IntegralOrderMapper">
  6. <resultMap type="IntegralOrder" id="IntegralOrderResult">
  7. <result property="id" column="id" />
  8. <result property="integralOrderNo" column="integral_order_no" />
  9. <result property="waresType" column="wares_type" />
  10. <result property="waresName" column="wares_name" />
  11. <result property="waresId" column="wares_id" />
  12. <result property="unionId" column="union_id" />
  13. <result property="customerName" column="customer_name" />
  14. <result property="exchangeNum" column="exchange_num" />
  15. <result property="exchangeTime" column="exchange_time" />
  16. <result property="status" column="status" />
  17. <result property="integral" column="integral" />
  18. <result property="stationId" column="station_id" />
  19. <result property="stationName" column="station_name" />
  20. <result property="mobilePhone" column="mobile_phone" />
  21. </resultMap>
  22. <sql id="selectIntegralOrderVo">
  23. select id, integral_order_no, wares_type, wares_name, wares_id, union_id, customer_name, exchange_num, exchange_time,
  24. p.status, integral, station_id,d.dept_name as station_name,mobile_phone
  25. from integral_order p join sys_dept d on p.station_id =d.dept_id
  26. </sql>
  27. <select id="selectIntegralOrderList" parameterType="IntegralOrder" resultMap="IntegralOrderResult">
  28. <include refid="selectIntegralOrderVo"/>
  29. <where>
  30. <if test="integralOrderNo != null and integralOrderNo != ''"> and integral_order_no like concat('%', #{integralOrderNo}, '%')</if>
  31. <if test="waresType != null and waresType != ''"> and wares_type = #{waresType}</if>
  32. <if test="waresName != null and waresName != ''"> and wares_name like concat('%', #{waresName}, '%')</if>
  33. <if test="waresId != null "> and wares_id = #{waresId}</if>
  34. <if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
  35. <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
  36. <if test="exchangeNum != null "> and exchange_num = #{exchangeNum}</if>
  37. <if test="exchangeTime != null "> and exchange_time = #{exchangeTime}</if>
  38. <if test="status != null and status != ''"> and p.status = #{status}</if>
  39. <if test="integral != null "> and integral = #{integral}</if>
  40. <if test="stationId != null "> and station_id = #{stationId}</if>
  41. <if test="mobilePhone != null "> and mobile_phone = #{mobilePhone}</if>
  42. <if test="stationIdList != null ">
  43. and station_id in
  44. <foreach item="item" index="index" collection="stationIdList"
  45. open="(" separator="," close=")">
  46. #{item}
  47. </foreach>
  48. </if>
  49. </where>
  50. order by id desc
  51. </select>
  52. <select id="selectIntegralOrderById" parameterType="Long" resultMap="IntegralOrderResult">
  53. <include refid="selectIntegralOrderVo"/>
  54. where id = #{id}
  55. </select>
  56. <insert id="insertIntegralOrder" parameterType="IntegralOrder" useGeneratedKeys="true" keyProperty="id">
  57. insert into integral_order
  58. <trim prefix="(" suffix=")" suffixOverrides=",">
  59. <if test="integralOrderNo != null">integral_order_no,</if>
  60. <if test="waresType != null">wares_type,</if>
  61. <if test="waresName != null">wares_name,</if>
  62. <if test="waresId != null">wares_id,</if>
  63. <if test="unionId != null">union_id,</if>
  64. <if test="customerName != null">customer_name,</if>
  65. <if test="exchangeNum != null">exchange_num,</if>
  66. <if test="exchangeTime != null">exchange_time,</if>
  67. <if test="status != null">status,</if>
  68. <if test="integral != null">integral,</if>
  69. <if test="stationId != null">station_id,</if>
  70. <if test="mobilePhone != null "> mobile_phone,</if>
  71. </trim>
  72. <trim prefix="values (" suffix=")" suffixOverrides=",">
  73. <if test="integralOrderNo != null">#{integralOrderNo},</if>
  74. <if test="waresType != null">#{waresType},</if>
  75. <if test="waresName != null">#{waresName},</if>
  76. <if test="waresId != null">#{waresId},</if>
  77. <if test="unionId != null">#{unionId},</if>
  78. <if test="customerName != null">#{customerName},</if>
  79. <if test="exchangeNum != null">#{exchangeNum},</if>
  80. <if test="exchangeTime != null">#{exchangeTime},</if>
  81. <if test="status != null">#{status},</if>
  82. <if test="integral != null">#{integral},</if>
  83. <if test="stationId != null">#{stationId},</if>
  84. <if test="mobilePhone != null">#{mobilePhone},</if>
  85. </trim>
  86. </insert>
  87. <update id="updateIntegralOrder" parameterType="IntegralOrder">
  88. update integral_order
  89. <trim prefix="SET" suffixOverrides=",">
  90. <if test="integralOrderNo != null">integral_order_no = #{integralOrderNo},</if>
  91. <if test="waresType != null">wares_type = #{waresType},</if>
  92. <if test="waresName != null">wares_name = #{waresName},</if>
  93. <if test="waresId != null">wares_id = #{waresId},</if>
  94. <if test="unionId != null">union_id = #{unionId},</if>
  95. <if test="customerName != null">customer_name = #{customerName},</if>
  96. <if test="exchangeNum != null">exchange_num = #{exchangeNum},</if>
  97. <if test="exchangeTime != null">exchange_time = #{exchangeTime},</if>
  98. <if test="status != null">status = #{status},</if>
  99. <if test="integral != null">integral = #{integral},</if>
  100. <if test="stationId != null">station_id = #{stationId},</if>
  101. <if test="mobilePhone != null "> mobile_phone = #{mobilePhone},</if>
  102. </trim>
  103. where id = #{id}
  104. </update>
  105. <delete id="deleteIntegralOrderById" parameterType="Long">
  106. delete from integral_order where id = #{id}
  107. </delete>
  108. <delete id="deleteIntegralOrderByIds" parameterType="String">
  109. delete from integral_order where id in
  110. <foreach item="id" collection="array" open="(" separator="," close=")">
  111. #{id}
  112. </foreach>
  113. </delete>
  114. </mapper>