CustomerCardUseRecordMapper.xml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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.customer.mapper.CustomerCardUseRecordMapper">
  6. <resultMap type="CustomerCardUseRecord" id="CustomerCardUseRecordResult">
  7. <result property="id" column="id" />
  8. <result property="orderNo" column="order_no" />
  9. <result property="unionId" column="union_id" />
  10. <result property="customerNo" column="customer_no" />
  11. <result property="customerName" column="customer_name" />
  12. <result property="usageType" column="usage_type" />
  13. <result property="payType" column="pay_type" />
  14. <result property="cardOilsType" column="card_oils_type" />
  15. <result property="amt" column="amt" />
  16. <result property="presentAmt" column="present_amt" />
  17. <result property="balance" column="balance" />
  18. <result property="createTime" column="create_time" />
  19. <result property="stationId" column="station_id" />
  20. <result property="stationName" column="station_name" />
  21. <result property="status" column="status" />
  22. </resultMap>
  23. <sql id="selectCustomerCardUseRecordVo">
  24. select id, order_no, union_id, customer_no, customer_name, usage_type, pay_type, card_oils_type, amt, present_amt, balance, create_time, station_id, station_name, status from customer_card_use_record
  25. </sql>
  26. <select id="selectCustomerCardUseRecordList" parameterType="CustomerCardUseRecord" resultMap="CustomerCardUseRecordResult">
  27. <include refid="selectCustomerCardUseRecordVo"/>
  28. <where>
  29. <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
  30. <if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
  31. <if test="customerNo != null and customerNo != ''"> and customer_no = #{customerNo}</if>
  32. <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
  33. <if test="usageType != null and usageType != ''"> and usage_type = #{usageType}</if>
  34. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  35. <if test="cardOilsType != null and cardOilsType != ''"> and card_oils_type = #{cardOilsType}</if>
  36. <if test="amt != null "> and amt = #{amt}</if>
  37. <if test="presentAmt != null "> and present_amt = #{presentAmt}</if>
  38. <if test="balance != null "> and balance = #{balance}</if>
  39. <if test="stationId != null "> and station_id = #{stationId}</if>
  40. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  41. <if test="status != null and status != ''"> and status = #{status}</if>
  42. </where>
  43. </select>
  44. <select id="selectCustomerCardUseRecordById" parameterType="Long" resultMap="CustomerCardUseRecordResult">
  45. <include refid="selectCustomerCardUseRecordVo"/>
  46. where id = #{id}
  47. </select>
  48. <insert id="insertCustomerCardUseRecord" parameterType="CustomerCardUseRecord" useGeneratedKeys="true" keyProperty="id">
  49. insert into customer_card_use_record
  50. <trim prefix="(" suffix=")" suffixOverrides=",">
  51. <if test="orderNo != null">order_no,</if>
  52. <if test="unionId != null">union_id,</if>
  53. <if test="customerNo != null">customer_no,</if>
  54. <if test="customerName != null">customer_name,</if>
  55. <if test="usageType != null">usage_type,</if>
  56. <if test="payType != null">pay_type,</if>
  57. <if test="cardOilsType != null">card_oils_type,</if>
  58. <if test="amt != null">amt,</if>
  59. <if test="presentAmt != null">present_amt,</if>
  60. <if test="balance != null">balance,</if>
  61. <if test="createTime != null">create_time,</if>
  62. <if test="stationId != null">station_id,</if>
  63. <if test="stationName != null">station_name,</if>
  64. <if test="status != null">status,</if>
  65. </trim>
  66. <trim prefix="values (" suffix=")" suffixOverrides=",">
  67. <if test="orderNo != null">#{orderNo},</if>
  68. <if test="unionId != null">#{unionId},</if>
  69. <if test="customerNo != null">#{customerNo},</if>
  70. <if test="customerName != null">#{customerName},</if>
  71. <if test="usageType != null">#{usageType},</if>
  72. <if test="payType != null">#{payType},</if>
  73. <if test="cardOilsType != null">#{cardOilsType},</if>
  74. <if test="amt != null">#{amt},</if>
  75. <if test="presentAmt != null">#{presentAmt},</if>
  76. <if test="balance != null">#{balance},</if>
  77. <if test="createTime != null">#{createTime},</if>
  78. <if test="stationId != null">#{stationId},</if>
  79. <if test="stationName != null">#{stationName},</if>
  80. <if test="status != null">#{status},</if>
  81. </trim>
  82. </insert>
  83. <update id="updateCustomerCardUseRecord" parameterType="CustomerCardUseRecord">
  84. update customer_card_use_record
  85. <trim prefix="SET" suffixOverrides=",">
  86. <if test="orderNo != null">order_no = #{orderNo},</if>
  87. <if test="unionId != null">union_id = #{unionId},</if>
  88. <if test="customerNo != null">customer_no = #{customerNo},</if>
  89. <if test="customerName != null">customer_name = #{customerName},</if>
  90. <if test="usageType != null">usage_type = #{usageType},</if>
  91. <if test="payType != null">pay_type = #{payType},</if>
  92. <if test="cardOilsType != null">card_oils_type = #{cardOilsType},</if>
  93. <if test="amt != null">amt = #{amt},</if>
  94. <if test="presentAmt != null">present_amt = #{presentAmt},</if>
  95. <if test="balance != null">balance = #{balance},</if>
  96. <if test="createTime != null">create_time = #{createTime},</if>
  97. <if test="stationId != null">station_id = #{stationId},</if>
  98. <if test="stationName != null">station_name = #{stationName},</if>
  99. <if test="status != null">status = #{status},</if>
  100. </trim>
  101. where id = #{id}
  102. </update>
  103. <delete id="deleteCustomerCardUseRecordById" parameterType="Long">
  104. delete from customer_card_use_record where id = #{id}
  105. </delete>
  106. <delete id="deleteCustomerCardUseRecordByIds" parameterType="String">
  107. delete from customer_card_use_record where id in
  108. <foreach item="id" collection="array" open="(" separator="," close=")">
  109. #{id}
  110. </foreach>
  111. </delete>
  112. </mapper>