CustomerManagerMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.platform.yijia.dao.CustomerManagerMapper">
  4. <!--客户信息返回结果-->
  5. <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.CustomerManage">
  6. <id column="id" jdbcType="INTEGER" property="id" />
  7. <result column="member_id" jdbcType="VARCHAR" property="memberId" />
  8. <result column="customer_name" jdbcType="VARCHAR" property="customerName" />
  9. <result column="commend_man" jdbcType="VARCHAR" property="commendMan" />
  10. <result column="member_grade" jdbcType="VARCHAR" property="memberGrade" />
  11. <result column="phone_number" jdbcType="VARCHAR" property="phoneNumber" />
  12. <result column="car_number" jdbcType="VARCHAR" property="carNumber" />
  13. <result column="balance" jdbcType="DECIMAL" property="balance" />
  14. <result column="integral" jdbcType="INTEGER" property="integral" />
  15. <result column="special_car_type" jdbcType="VARCHAR" property="specialCarType" />
  16. <result column="regtime" jdbcType="TIMESTAMP" property="regtime" />
  17. <result column="station_id" jdbcType="INTEGER" property="stationId" />
  18. <result column="station_name" jdbcType="VARCHAR" property="stationName"/>
  19. <result column="cy_grade" jdbcType="VARCHAR" property="cyGrade" />
  20. <result column="qy_grade" jdbcType="VARCHAR" property="qyGrade" />
  21. <result column="cy_liters" jdbcType="DECIMAL" property="cyLiters"/>
  22. <result column="qy_liters" jdbcType="DECIMAL" property="qyLiters" />
  23. <result column="cy_amt" jdbcType="DECIMAL" property="cyAmt" />
  24. <result column="qy_amt" jdbcType="DECIMAL" property="qyAmt" />
  25. <result column="blog_openid" jdbcType="VARCHAR" property="blogOpenid" />
  26. <result column="mina_openid" jdbcType="VARCHAR" property="minaOpenid" />
  27. <result column="blog_user_id" jdbcType="INTEGER" property="blogUserId" />
  28. <result column="mina_user_id" jdbcType="INTEGER" property="minaUserId"/>
  29. <result column="oil_name" jdbcType="VARCHAR" property="oilName" />
  30. <result column="grade" jdbcType="VARCHAR" property="grade" />
  31. <result column="liters" jdbcType="DECIMAL" property="liters" />
  32. <result column="amt" jdbcType="DECIMAL" property="amt" />
  33. <result column="union_id" jdbcType="VARCHAR" property="unionId" />
  34. </resultMap>
  35. <!--查询列-->
  36. <sql id="Base_Column_List">
  37. id, member_id, customer_name, commend_man, member_grade, phone_number, car_number, balance,
  38. integral, special_car_type, regtime, station_id, station_name, cy_grade, qy_grade, cy_liters,
  39. qy_liters, cy_amt, qy_amt, blog_openid, mina_openid, blog_user_id, mina_user_id, oil_name, grade,
  40. liters, amt, union_id
  41. </sql>
  42. <!--查询油站客户信息-->
  43. <select id="getCustomerManageInfo" resultMap="BaseResultMap" parameterType="com.platform.yijia.pojo.CustomerManage">
  44. SELECT
  45. <include refid="Base_Column_List" />
  46. FROM
  47. customer_manage
  48. <where>
  49. <if test="stationId !=null and stationId !=''">
  50. station_id = #{stationId}
  51. </if>
  52. <if test="oilName !=null and oilName !=''">
  53. AND oil_name = #{oilName}
  54. </if>
  55. <if test="minaOpenid !=null and minaOpenid !=''">
  56. AND mina_openid = #{minaOpenid}
  57. </if>
  58. <if test="unionId !=null and unionId !=''">
  59. AND union_id = #{unionId}
  60. </if>
  61. </where>
  62. </select>
  63. <!-- 更新客户表 -->
  64. <update id="updateCustomerInfo" parameterType="com.platform.yijia.pojo.CustomerManage">
  65. UPDATE
  66. customer_manage
  67. <set>
  68. <if test="memberGrade !=null ">
  69. member_grade = #{memberGrade},
  70. </if>
  71. <if test="customerName !=null ">
  72. customer_name = #{customerName},
  73. </if>
  74. <if test="phoneNumber !=null ">
  75. phone_number = #{phoneNumber},
  76. </if>
  77. <if test="regtime !=null ">
  78. regtime = #{regtime},
  79. </if>
  80. <if test="stationName !=null ">
  81. station_name = #{stationName},
  82. </if>
  83. <if test="oilName !=null ">
  84. oil_name = #{oilName},
  85. </if>
  86. <if test="liters !=null ">
  87. liters = #{liters},
  88. </if>
  89. <if test="amt !=null ">
  90. amt = #{amt},
  91. </if>
  92. <if test="grade !=null ">
  93. grade = #{grade},
  94. </if>
  95. </set>
  96. <where>
  97. <if test="stationId != null and stationId !='' ">
  98. station_id = #{stationId}
  99. </if>
  100. <if test="phoneNumber !=null and phoneNumber !='' ">
  101. AND phone_number = #{phoneNumber}
  102. </if>
  103. <if test="oilName !=null and oilName !='' ">
  104. AND oil_name = #{oilName}
  105. </if>
  106. </where>
  107. </update>
  108. <!-- 插入客户表 -->
  109. <insert id="insertCustomerInfo" parameterType="com.platform.yijia.pojo.CustomerManage">
  110. INSERT INTO customer_manage
  111. <trim prefix="(" suffix=")" suffixOverrides=",">
  112. <if test="memberId !=null ">
  113. member_id,
  114. </if>
  115. <if test="customerName !=null ">
  116. customer_name,
  117. </if>
  118. <if test="commendMan !=null ">
  119. commend_man,
  120. </if>
  121. <if test="memberGrade !=null ">
  122. member_grade,
  123. </if>
  124. <if test="phoneNumber !=null ">
  125. phone_number,
  126. </if>
  127. <if test="carNumber !=null ">
  128. car_number,
  129. </if>
  130. <if test="balance !=null ">
  131. balance,
  132. </if>
  133. <if test="integral !=null ">
  134. integral,
  135. </if>
  136. <if test="specialCarType !=null ">
  137. specialCarType,
  138. </if>
  139. <if test="regtime !=null ">
  140. regtime,
  141. </if>
  142. <if test="stationId !=null ">
  143. station_id,
  144. </if>
  145. <if test="stationName !=null ">
  146. station_name,
  147. </if>
  148. <if test="oilName !=null ">
  149. oil_name,
  150. </if>
  151. <if test="liters !=null ">
  152. liters,
  153. </if>
  154. <if test="amt !=null ">
  155. amt,
  156. </if>
  157. <if test="cyGrade !=null ">
  158. cy_grade,
  159. </if>
  160. <if test="qyGrade !=null ">
  161. qy_grade,
  162. </if>
  163. <if test="blogOpenid !=null ">
  164. blog_openid,
  165. </if>
  166. <if test="minaOpenid !=null ">
  167. mina_openid,
  168. </if>
  169. <if test="blogUserId !=null ">
  170. blog_user_id,
  171. </if>
  172. <if test="minaUserId !=null ">
  173. mina_user_id,
  174. </if>
  175. <if test="grade !=null ">
  176. grade,
  177. </if>
  178. <if test="unionId !=null and unionId !=''">
  179. union_id
  180. </if>
  181. </trim>
  182. <trim prefix="values (" suffix=")" suffixOverrides=",">
  183. <if test="memberId !=null ">
  184. #{memberId},
  185. </if>
  186. <if test="customerName !=null ">
  187. #{customerName},
  188. </if>
  189. <if test="commendMan !=null ">
  190. #{commendMan},
  191. </if>
  192. <if test="memberGrade !=null ">
  193. #{memberGrade},
  194. </if>
  195. <if test="phoneNumber !=null ">
  196. #{phoneNumber},
  197. </if>
  198. <if test="carNumber !=null ">
  199. #{carNumber},
  200. </if>
  201. <if test="balance !=null ">
  202. #{balance},
  203. </if>
  204. <if test="integral !=null ">
  205. #{integral},
  206. </if>
  207. <if test="specialCarType !=null ">
  208. #{specialCarType},
  209. </if>
  210. <if test="regtime !=null ">
  211. #{regtime},
  212. </if>
  213. <if test="stationId !=null ">
  214. #{stationId, jdbcType=INTEGER},
  215. </if>
  216. <if test="stationName !=null ">
  217. #{stationName, jdbcType=VARCHAR},
  218. </if>
  219. <if test="oilName !=null ">
  220. #{oilName},
  221. </if>
  222. <if test="liters !=null ">
  223. #{liters},
  224. </if>
  225. <if test="amt !=null ">
  226. #{amt},
  227. </if>
  228. <if test="cyGrade !=null ">
  229. #{cyGrade},
  230. </if>
  231. <if test="qyGrade !=null ">
  232. #{qyGrade},
  233. </if>
  234. <if test="blogOpenid !=null ">
  235. #{blogOpenid},
  236. </if>
  237. <if test="minaOpenid !=null ">
  238. #{minaOpenid, jdbcType=VARCHAR},
  239. </if>
  240. <if test="blogUserId !=null ">
  241. #{blogUserId, jdbcType=INTEGER},
  242. </if>
  243. <if test="minaUserId !=null ">
  244. #{minaUserId, jdbcType=INTEGER},
  245. </if>
  246. <if test="grade !=null ">
  247. #{grade, jdbcType=VARCHAR},
  248. </if>
  249. <if test="unionId !=null and unionId !=''">
  250. #{unionId, jdbcType=VARCHAR}
  251. </if>
  252. </trim>
  253. </insert>
  254. <!-- 根据手机号更新客户表 -->
  255. <update id="updateCustomerInfoByPhoneNumber" parameterType="com.platform.yijia.pojo.CustomerManage">
  256. UPDATE
  257. customer_manage
  258. <set>
  259. <if test="customerName !=null ">
  260. customer_name = #{customerName},
  261. </if>
  262. <if test="phoneNumber !=null ">
  263. phone_number = #{phoneNumber},
  264. </if>
  265. <if test="regtime !=null ">
  266. regtime = #{regtime},
  267. </if>
  268. <if test="stationName !=null ">
  269. station_name = #{stationName},
  270. </if>
  271. <if test="stationId !=null ">
  272. station_id = #{stationId},
  273. </if>
  274. <if test="blogUserId !=null ">
  275. blog_user_id = #{blogUserId},
  276. </if>
  277. <if test="minaUserId !=null ">
  278. mina_user_id = #{minaUserId},
  279. </if>
  280. <if test="oilName !=null ">
  281. oil_name = #{oilName},
  282. </if>
  283. <if test="liters !=null ">
  284. liters = #{liters},
  285. </if>
  286. <if test="amt !=null ">
  287. amt = #{amt},
  288. </if>
  289. <if test="unionId !=null and unionId !=null">
  290. union_id = #{unionId},
  291. </if>
  292. </set>
  293. <where>
  294. <if test="phoneNumber !=null and phoneNumber !='' ">
  295. phone_number = #{phoneNumber}
  296. </if>
  297. </where>
  298. </update>
  299. </mapper>