CustomerManageMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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.CustomerManageMapper">
  6. <resultMap type="CustomerManage" id="CustomerManageResult">
  7. <result property="id" column="id" />
  8. <result property="memberId" column="member_id" />
  9. <result property="customerName" column="customer_name" />
  10. <result property="commendMan" column="commend_man" />
  11. <result property="memberGrade" column="member_grade" />
  12. <result property="phoneNumber" column="phone_number" />
  13. <result property="carNumber" column="car_number" />
  14. <result property="balance" column="balance" />
  15. <result property="integral" column="integral" />
  16. <result property="specialCarType" column="special_car_type" />
  17. <result property="regtime" column="regtime" />
  18. <result property="stationId" column="station_id" />
  19. <result property="stationName" column="station_name" />
  20. <result property="cyGrade" column="cy_grade" />
  21. <result property="qyGrade" column="qy_grade" />
  22. <result property="cyLiters" column="cy_liters" />
  23. <result property="qyLiters" column="qy_liters" />
  24. <result property="cyAmt" column="cy_amt" />
  25. <result property="qyAmt" column="qy_amt" />
  26. <result property="blogOpenid" column="blog_openid" />
  27. <result property="minaOpenid" column="mina_openid" />
  28. <result property="blogUserId" column="blog_user_id" />
  29. <result property="minaUserId" column="mina_user_id" />
  30. <result property="oilName" column="oil_name" />
  31. <result property="grade" column="grade" />
  32. <result property="liters" column="liters" />
  33. <result property="amt" column="amt" />
  34. <result property="unionId" column="union_id" />
  35. </resultMap>
  36. <sql id="selectCustomerManageVo">
  37. select id, member_id, customer_name, commend_man, member_grade, phone_number, car_number, balance, integral, special_car_type, regtime, station_id, station_name, cy_grade, qy_grade, cy_liters, qy_liters, cy_amt, qy_amt, blog_openid, mina_openid, blog_user_id, mina_user_id, oil_name, grade, liters, amt, union_id from customer_manage
  38. </sql>
  39. <select id="selectCustomerManageList" parameterType="CustomerManage" resultMap="CustomerManageResult">
  40. <include refid="selectCustomerManageVo"/>
  41. <where>
  42. <if test="memberId != null and memberId != ''"> and member_id = #{memberId}</if>
  43. <if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
  44. <if test="commendMan != null and commendMan != ''"> and commend_man = #{commendMan}</if>
  45. <if test="memberGrade != null and memberGrade != ''"> and member_grade = #{memberGrade}</if>
  46. <if test="phoneNumber != null and phoneNumber != ''"> and phone_number = #{phoneNumber}</if>
  47. <if test="carNumber != null and carNumber != ''"> and car_number = #{carNumber}</if>
  48. <if test="balance != null "> and balance = #{balance}</if>
  49. <if test="integral != null "> and integral = #{integral}</if>
  50. <if test="specialCarType != null and specialCarType != ''"> and special_car_type = #{specialCarType}</if>
  51. <if test="regtime != null "> and regtime = #{regtime}</if>
  52. <if test="stationId != null "> and station_id = #{stationId}</if>
  53. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  54. <if test="cyGrade != null and cyGrade != ''"> and cy_grade = #{cyGrade}</if>
  55. <if test="qyGrade != null and qyGrade != ''"> and qy_grade = #{qyGrade}</if>
  56. <if test="cyLiters != null "> and cy_liters = #{cyLiters}</if>
  57. <if test="qyLiters != null "> and qy_liters = #{qyLiters}</if>
  58. <if test="cyAmt != null "> and cy_amt = #{cyAmt}</if>
  59. <if test="qyAmt != null "> and qy_amt = #{qyAmt}</if>
  60. <if test="blogOpenid != null and blogOpenid != ''"> and blog_openid = #{blogOpenid}</if>
  61. <if test="minaOpenid != null and minaOpenid != ''"> and mina_openid = #{minaOpenid}</if>
  62. <if test="blogUserId != null "> and blog_user_id = #{blogUserId}</if>
  63. <if test="minaUserId != null "> and mina_user_id = #{minaUserId}</if>
  64. <if test="oilName != null and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
  65. <if test="grade != null and grade != ''"> and grade = #{grade}</if>
  66. <if test="liters != null "> and liters = #{liters}</if>
  67. <if test="amt != null "> and amt = #{amt}</if>
  68. <if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
  69. <if test="stationIdList != null ">
  70. and station_id in
  71. <foreach item="item" index="index" collection="stationIdList"
  72. open="(" separator="," close=")">
  73. #{item}
  74. </foreach>
  75. </if>
  76. </where>
  77. order by id desc
  78. </select>
  79. <select id="selectCustomerManageById" parameterType="Long" resultMap="CustomerManageResult">
  80. <include refid="selectCustomerManageVo"/>
  81. where id = #{id}
  82. </select>
  83. <insert id="insertCustomerManage" parameterType="CustomerManage" useGeneratedKeys="true" keyProperty="id">
  84. insert into customer_manage
  85. <trim prefix="(" suffix=")" suffixOverrides=",">
  86. <if test="memberId != null">member_id,</if>
  87. <if test="customerName != null">customer_name,</if>
  88. <if test="commendMan != null">commend_man,</if>
  89. <if test="memberGrade != null">member_grade,</if>
  90. <if test="phoneNumber != null">phone_number,</if>
  91. <if test="carNumber != null">car_number,</if>
  92. <if test="balance != null">balance,</if>
  93. <if test="integral != null">integral,</if>
  94. <if test="specialCarType != null">special_car_type,</if>
  95. <if test="regtime != null">regtime,</if>
  96. <if test="stationId != null">station_id,</if>
  97. <if test="stationName != null">station_name,</if>
  98. <if test="cyGrade != null">cy_grade,</if>
  99. <if test="qyGrade != null">qy_grade,</if>
  100. <if test="cyLiters != null">cy_liters,</if>
  101. <if test="qyLiters != null">qy_liters,</if>
  102. <if test="cyAmt != null">cy_amt,</if>
  103. <if test="qyAmt != null">qy_amt,</if>
  104. <if test="blogOpenid != null">blog_openid,</if>
  105. <if test="minaOpenid != null">mina_openid,</if>
  106. <if test="blogUserId != null">blog_user_id,</if>
  107. <if test="minaUserId != null">mina_user_id,</if>
  108. <if test="oilName != null">oil_name,</if>
  109. <if test="grade != null">grade,</if>
  110. <if test="liters != null">liters,</if>
  111. <if test="amt != null">amt,</if>
  112. <if test="unionId != null">union_id,</if>
  113. </trim>
  114. <trim prefix="values (" suffix=")" suffixOverrides=",">
  115. <if test="memberId != null">#{memberId},</if>
  116. <if test="customerName != null">#{customerName},</if>
  117. <if test="commendMan != null">#{commendMan},</if>
  118. <if test="memberGrade != null">#{memberGrade},</if>
  119. <if test="phoneNumber != null">#{phoneNumber},</if>
  120. <if test="carNumber != null">#{carNumber},</if>
  121. <if test="balance != null">#{balance},</if>
  122. <if test="integral != null">#{integral},</if>
  123. <if test="specialCarType != null">#{specialCarType},</if>
  124. <if test="regtime != null">#{regtime},</if>
  125. <if test="stationId != null">#{stationId},</if>
  126. <if test="stationName != null">#{stationName},</if>
  127. <if test="cyGrade != null">#{cyGrade},</if>
  128. <if test="qyGrade != null">#{qyGrade},</if>
  129. <if test="cyLiters != null">#{cyLiters},</if>
  130. <if test="qyLiters != null">#{qyLiters},</if>
  131. <if test="cyAmt != null">#{cyAmt},</if>
  132. <if test="qyAmt != null">#{qyAmt},</if>
  133. <if test="blogOpenid != null">#{blogOpenid},</if>
  134. <if test="minaOpenid != null">#{minaOpenid},</if>
  135. <if test="blogUserId != null">#{blogUserId},</if>
  136. <if test="minaUserId != null">#{minaUserId},</if>
  137. <if test="oilName != null">#{oilName},</if>
  138. <if test="grade != null">#{grade},</if>
  139. <if test="liters != null">#{liters},</if>
  140. <if test="amt != null">#{amt},</if>
  141. <if test="unionId != null">#{unionId},</if>
  142. </trim>
  143. </insert>
  144. <update id="updateCustomerManage" parameterType="CustomerManage">
  145. update customer_manage
  146. <trim prefix="SET" suffixOverrides=",">
  147. <if test="memberId != null">member_id = #{memberId},</if>
  148. <if test="customerName != null">customer_name = #{customerName},</if>
  149. <if test="commendMan != null">commend_man = #{commendMan},</if>
  150. <if test="memberGrade != null">member_grade = #{memberGrade},</if>
  151. <if test="phoneNumber != null">phone_number = #{phoneNumber},</if>
  152. <if test="carNumber != null">car_number = #{carNumber},</if>
  153. <if test="balance != null">balance = #{balance},</if>
  154. <if test="integral != null">integral = #{integral},</if>
  155. <if test="specialCarType != null">special_car_type = #{specialCarType},</if>
  156. <if test="regtime != null">regtime = #{regtime},</if>
  157. <if test="stationId != null">station_id = #{stationId},</if>
  158. <if test="stationName != null">station_name = #{stationName},</if>
  159. <if test="cyGrade != null">cy_grade = #{cyGrade},</if>
  160. <if test="qyGrade != null">qy_grade = #{qyGrade},</if>
  161. <if test="cyLiters != null">cy_liters = #{cyLiters},</if>
  162. <if test="qyLiters != null">qy_liters = #{qyLiters},</if>
  163. <if test="cyAmt != null">cy_amt = #{cyAmt},</if>
  164. <if test="qyAmt != null">qy_amt = #{qyAmt},</if>
  165. <if test="blogOpenid != null">blog_openid = #{blogOpenid},</if>
  166. <if test="minaOpenid != null">mina_openid = #{minaOpenid},</if>
  167. <if test="blogUserId != null">blog_user_id = #{blogUserId},</if>
  168. <if test="minaUserId != null">mina_user_id = #{minaUserId},</if>
  169. <if test="oilName != null">oil_name = #{oilName},</if>
  170. <if test="grade != null">grade = #{grade},</if>
  171. <if test="liters != null">liters = #{liters},</if>
  172. <if test="amt != null">amt = #{amt},</if>
  173. <if test="unionId != null">union_id = #{unionId},</if>
  174. </trim>
  175. where id = #{id}
  176. </update>
  177. <delete id="deleteCustomerManageById" parameterType="Long">
  178. delete from customer_manage where id = #{id}
  179. </delete>
  180. <delete id="deleteCustomerManageByIds" parameterType="String">
  181. delete from customer_manage where id in
  182. <foreach item="id" collection="array" open="(" separator="," close=")">
  183. #{id}
  184. </foreach>
  185. </delete>
  186. </mapper>