CustomerManagerMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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. <result column="group_id" jdbcType="INTEGER" property="groupId" />
  35. </resultMap>
  36. <!--查询-->
  37. <sql id="Base_Column_List">
  38. id, member_id, customer_name, commend_man, member_grade, phone_number, car_number, balance,
  39. integral, special_car_type, regtime, station_id, station_name, cy_grade, qy_grade, cy_liters,
  40. qy_liters, cy_amt, qy_amt, blog_openid, mina_openid, blog_user_id, mina_user_id, oil_name, grade,
  41. liters, amt, union_id, group_id
  42. </sql>
  43. <!--插入集团客户信息-->
  44. <insert id="insertCustomerGroup" parameterType="com.platform.yijia.pojo.CustomerGroup">
  45. INSERT
  46. customer_group
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test="customerId !=null">
  49. customer_id,
  50. </if>
  51. <if test="unionId !=null">
  52. union_id,
  53. </if>
  54. <if test="phoneNumber !=null">
  55. phone_number,
  56. </if>
  57. <if test="groupId !=null">
  58. group_id,
  59. </if>
  60. </trim>
  61. <trim prefix="values (" suffix=")" suffixOverrides=",">
  62. <if test="customerId !=null">
  63. #{customerId},
  64. </if>
  65. <if test="unionId !=null">
  66. #{unionId},
  67. </if>
  68. <if test="phoneNumber !=null">
  69. #{phoneNumber},
  70. </if>
  71. <if test="groupId !=null">
  72. #{groupId},
  73. </if>
  74. </trim>
  75. </insert>
  76. <!--查询油站客户信息-->
  77. <select id="getCustomerManageInfo" resultMap="BaseResultMap" parameterType="com.platform.yijia.pojo.CustomerManage">
  78. SELECT
  79. <include refid="Base_Column_List" />
  80. FROM
  81. customer_manage
  82. <where>
  83. <if test="stationId !=null and stationId !=''">
  84. station_id = #{stationId}
  85. </if>
  86. <if test="phoneNumber !=null and phoneNumber !='' ">
  87. AND phone_number = #{phoneNumber}
  88. </if>
  89. <if test="oilName !=null and oilName !=''">
  90. AND oil_name = #{oilName}
  91. </if>
  92. <if test="minaOpenid !=null and minaOpenid !=''">
  93. AND mina_openid = #{minaOpenid}
  94. </if>
  95. <if test="unionId !=null and unionId !=''">
  96. AND union_id = #{unionId}
  97. </if>
  98. </where>
  99. </select>
  100. <!--查询油站客户信息查询出多条-->
  101. <select id="getCustomerManageInfoList" resultMap="BaseResultMap" parameterType="com.platform.yijia.pojo.CustomerManage">
  102. SELECT
  103. <include refid="Base_Column_List" />
  104. FROM
  105. customer_manage
  106. <where>
  107. <if test="stationId !=null and stationId !=''">
  108. station_id = #{stationId}
  109. </if>
  110. <if test="phoneNumber !=null and phoneNumber !='' ">
  111. AND phone_number = #{phoneNumber}
  112. </if>
  113. <if test="minaOpenid !=null and minaOpenid !=''">
  114. AND mina_openid = #{minaOpenid}
  115. </if>
  116. <if test="unionId !=null and unionId !=''">
  117. AND union_id = #{unionId}
  118. </if>
  119. </where>
  120. </select>
  121. <!-- 更新客户表 -->
  122. <update id="updateCustomerInfo" parameterType="com.platform.yijia.pojo.CustomerManage">
  123. UPDATE
  124. customer_manage
  125. <set>
  126. <if test="memberId !=null ">
  127. member_id = #{memberId},
  128. </if>
  129. <if test="memberGrade !=null ">
  130. member_grade = #{memberGrade},
  131. </if>
  132. <if test="customerName !=null ">
  133. customer_name = #{customerName},
  134. </if>
  135. <if test="phoneNumber !=null ">
  136. phone_number = #{phoneNumber},
  137. </if>
  138. <if test="regtime !=null ">
  139. regtime = #{regtime},
  140. </if>
  141. <if test="stationName !=null ">
  142. station_name = #{stationName},
  143. </if>
  144. <if test="oilName !=null ">
  145. oil_name = #{oilName},
  146. </if>
  147. <if test="liters !=null ">
  148. liters = #{liters},
  149. </if>
  150. <if test="amt !=null ">
  151. amt = #{amt},
  152. </if>
  153. <if test="grade !=null ">
  154. grade = #{grade},
  155. </if>
  156. <if test="integral !=null ">
  157. integral = #{integral},
  158. </if>
  159. </set>
  160. <where>
  161. <if test="stationId != null and stationId !='' ">
  162. station_id = #{stationId}
  163. </if>
  164. <if test="phoneNumber !=null and phoneNumber !='' ">
  165. AND phone_number = #{phoneNumber}
  166. </if>
  167. <if test="oilName !=null and oilName !='' ">
  168. AND oil_name = #{oilName}
  169. </if>
  170. </where>
  171. </update>
  172. <!-- 插入客户表 -->
  173. <insert id="insertCustomerInfo" parameterType="com.platform.yijia.pojo.CustomerManage">
  174. INSERT INTO customer_manage
  175. <trim prefix="(" suffix=")" suffixOverrides=",">
  176. <if test="memberId !=null ">
  177. member_id,
  178. </if>
  179. <if test="customerName !=null ">
  180. customer_name,
  181. </if>
  182. <if test="commendMan !=null ">
  183. commend_man,
  184. </if>
  185. <if test="memberGrade !=null ">
  186. member_grade,
  187. </if>
  188. <if test="phoneNumber !=null ">
  189. phone_number,
  190. </if>
  191. <if test="carNumber !=null ">
  192. car_number,
  193. </if>
  194. <if test="balance !=null ">
  195. balance,
  196. </if>
  197. <if test="integral !=null ">
  198. integral,
  199. </if>
  200. <if test="specialCarType !=null ">
  201. specialCarType,
  202. </if>
  203. <if test="regtime !=null ">
  204. regtime,
  205. </if>
  206. <if test="stationId !=null ">
  207. station_id,
  208. </if>
  209. <if test="stationName !=null ">
  210. station_name,
  211. </if>
  212. <if test="oilName !=null ">
  213. oil_name,
  214. </if>
  215. <if test="liters !=null ">
  216. liters,
  217. </if>
  218. <if test="amt !=null ">
  219. amt,
  220. </if>
  221. <if test="cyGrade !=null ">
  222. cy_grade,
  223. </if>
  224. <if test="qyGrade !=null ">
  225. qy_grade,
  226. </if>
  227. <if test="blogOpenid !=null ">
  228. blog_openid,
  229. </if>
  230. <if test="minaOpenid !=null ">
  231. mina_openid,
  232. </if>
  233. <if test="blogUserId !=null ">
  234. blog_user_id,
  235. </if>
  236. <if test="minaUserId !=null ">
  237. mina_user_id,
  238. </if>
  239. <if test="grade !=null ">
  240. grade,
  241. </if>
  242. <if test="unionId !=null and unionId !=''">
  243. union_id,
  244. </if>
  245. <if test="groupId !=null and groupId !=''">
  246. group_id
  247. </if>
  248. </trim>
  249. <trim prefix="values (" suffix=")" suffixOverrides=",">
  250. <if test="memberId !=null ">
  251. #{memberId},
  252. </if>
  253. <if test="customerName !=null ">
  254. #{customerName},
  255. </if>
  256. <if test="commendMan !=null ">
  257. #{commendMan},
  258. </if>
  259. <if test="memberGrade !=null ">
  260. #{memberGrade},
  261. </if>
  262. <if test="phoneNumber !=null ">
  263. #{phoneNumber},
  264. </if>
  265. <if test="carNumber !=null ">
  266. #{carNumber},
  267. </if>
  268. <if test="balance !=null ">
  269. #{balance},
  270. </if>
  271. <if test="integral !=null ">
  272. #{integral},
  273. </if>
  274. <if test="specialCarType !=null ">
  275. #{specialCarType},
  276. </if>
  277. <if test="regtime !=null ">
  278. #{regtime},
  279. </if>
  280. <if test="stationId !=null ">
  281. #{stationId, jdbcType=INTEGER},
  282. </if>
  283. <if test="stationName !=null ">
  284. #{stationName, jdbcType=VARCHAR},
  285. </if>
  286. <if test="oilName !=null ">
  287. #{oilName},
  288. </if>
  289. <if test="liters !=null ">
  290. #{liters},
  291. </if>
  292. <if test="amt !=null ">
  293. #{amt},
  294. </if>
  295. <if test="cyGrade !=null ">
  296. #{cyGrade},
  297. </if>
  298. <if test="qyGrade !=null ">
  299. #{qyGrade},
  300. </if>
  301. <if test="blogOpenid !=null ">
  302. #{blogOpenid},
  303. </if>
  304. <if test="minaOpenid !=null ">
  305. #{minaOpenid, jdbcType=VARCHAR},
  306. </if>
  307. <if test="blogUserId !=null ">
  308. #{blogUserId, jdbcType=INTEGER},
  309. </if>
  310. <if test="minaUserId !=null ">
  311. #{minaUserId, jdbcType=INTEGER},
  312. </if>
  313. <if test="grade !=null ">
  314. #{grade, jdbcType=VARCHAR},
  315. </if>
  316. <if test="unionId !=null and unionId !=''">
  317. #{unionId, jdbcType=VARCHAR},
  318. </if>
  319. <if test="groupId !=null and groupId !=''">
  320. #{groupId, jdbcType=INTEGER}
  321. </if>
  322. </trim>
  323. </insert>
  324. </mapper>