CustomerManagerMapper.xml 13 KB

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