IntegralOrderMapper.xml 6.2 KB

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