StationInfoMapper.xml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  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.StationInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.StationInfo">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. -->
  9. <id column="dept_id" jdbcType="INTEGER" property="stationId" />
  10. <result column="dept_name" jdbcType="VARCHAR" property="stationName" />
  11. <result column="dept_address" jdbcType="VARCHAR" property="stationAddress" />
  12. <result column="oil_gun_num" jdbcType="INTEGER" property="oilGunNum" />
  13. <result column="leader" jdbcType="VARCHAR" property="contacts" />
  14. <result column="phone" jdbcType="VARCHAR" property="phone" />
  15. <result column="station_longitude" jdbcType="VARCHAR" property="stationLongitude" />
  16. <result column="station_latitude" jdbcType="VARCHAR" property="stationLatitude" />
  17. <result column="station_pic" jdbcType="VARCHAR" property="stationPic" />
  18. <result column="mno" jdbcType="INTEGER" property="mno" />
  19. <result column="app_id" jdbcType="VARCHAR" property="appId" />
  20. <result column="gzh_app_id" jdbcType="VARCHAR" property="gzhAppId" />
  21. </resultMap>
  22. <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.platform.yijia.pojo.StationInfo">
  23. <!--
  24. WARNING - @mbg.generated
  25. This element is automatically generated by MyBatis Generator, do not modify.
  26. -->
  27. <result column="station_pic" jdbcType="LONGVARBINARY" property="stationPic" />
  28. </resultMap>
  29. <!--获取油站信息-->
  30. <select id="selectStationInfo" parameterType="com.platform.yijia.pojo.StationInfo" resultMap="BaseResultMap">
  31. SELECT
  32. dept_id,
  33. dept_name,
  34. dept_address,
  35. oil_gun_num,
  36. leader,
  37. station_longitude,
  38. station_latitude,
  39. station_pic,
  40. mno
  41. FROM
  42. sys_dept
  43. <where>
  44. <if test="stationId !='' and stationId != null" >
  45. dept_id = #{stationId}
  46. </if>
  47. </where>
  48. </select>
  49. <sql id="Example_Where_Clause">
  50. <!--
  51. WARNING - @mbg.generated
  52. This element is automatically generated by MyBatis Generator, do not modify.
  53. -->
  54. <where>
  55. <foreach collection="oredCriteria" item="criteria" separator="or">
  56. <if test="criteria.valid">
  57. <trim prefix="(" prefixOverrides="and" suffix=")">
  58. <foreach collection="criteria.criteria" item="criterion">
  59. <choose>
  60. <when test="criterion.noValue">
  61. and ${criterion.condition}
  62. </when>
  63. <when test="criterion.singleValue">
  64. and ${criterion.condition} #{criterion.value}
  65. </when>
  66. <when test="criterion.betweenValue">
  67. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  68. </when>
  69. <when test="criterion.listValue">
  70. and ${criterion.condition}
  71. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  72. #{listItem}
  73. </foreach>
  74. </when>
  75. </choose>
  76. </foreach>
  77. </trim>
  78. </if>
  79. </foreach>
  80. </where>
  81. </sql>
  82. <sql id="Update_By_Example_Where_Clause">
  83. <!--
  84. WARNING - @mbg.generated
  85. This element is automatically generated by MyBatis Generator, do not modify.
  86. -->
  87. <where>
  88. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  89. <if test="criteria.valid">
  90. <trim prefix="(" prefixOverrides="and" suffix=")">
  91. <foreach collection="criteria.criteria" item="criterion">
  92. <choose>
  93. <when test="criterion.noValue">
  94. and ${criterion.condition}
  95. </when>
  96. <when test="criterion.singleValue">
  97. and ${criterion.condition} #{criterion.value}
  98. </when>
  99. <when test="criterion.betweenValue">
  100. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  101. </when>
  102. <when test="criterion.listValue">
  103. and ${criterion.condition}
  104. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  105. #{listItem}
  106. </foreach>
  107. </when>
  108. </choose>
  109. </foreach>
  110. </trim>
  111. </if>
  112. </foreach>
  113. </where>
  114. </sql>
  115. <sql id="Base_Column_List">
  116. <!--
  117. WARNING - @mbg.generated
  118. This element is automatically generated by MyBatis Generator, do not modify.
  119. -->
  120. dept_id, dept_name, dept_address, oil_gun_num, leader, phone,
  121. station_longitude, station_latitude, mno
  122. </sql>
  123. <sql id="Blob_Column_List">
  124. <!--
  125. WARNING - @mbg.generated
  126. This element is automatically generated by MyBatis Generator, do not modify.
  127. -->
  128. station_pic
  129. </sql>
  130. <select id="selectByExampleWithBLOBs" parameterType="com.platform.yijia.pojo.StationInfoExample" resultMap="ResultMapWithBLOBs">
  131. <!--
  132. WARNING - @mbg.generated
  133. This element is automatically generated by MyBatis Generator, do not modify.
  134. -->
  135. select
  136. <if test="distinct">
  137. distinct
  138. </if>
  139. <include refid="Base_Column_List" />
  140. ,
  141. <include refid="Blob_Column_List" />
  142. from sys_dept
  143. <if test="_parameter != null">
  144. <include refid="Example_Where_Clause" />
  145. </if>
  146. <if test="orderByClause != null">
  147. order by ${orderByClause}
  148. </if>
  149. </select>
  150. <select id="selectByExample" parameterType="com.platform.yijia.pojo.StationInfoExample" resultMap="BaseResultMap">
  151. <!--
  152. WARNING - @mbg.generated
  153. This element is automatically generated by MyBatis Generator, do not modify.
  154. -->
  155. select
  156. <if test="distinct">
  157. distinct
  158. </if>
  159. <include refid="Base_Column_List" />
  160. ,
  161. <include refid="Blob_Column_List" />
  162. from sys_dept
  163. <if test="_parameter != null">
  164. <include refid="Example_Where_Clause" />
  165. </if>
  166. <if test="orderByClause != null">
  167. order by ${orderByClause}
  168. </if>
  169. </select>
  170. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
  171. <!--
  172. WARNING - @mbg.generated
  173. This element is automatically generated by MyBatis Generator, do not modify.
  174. -->
  175. select
  176. <include refid="Base_Column_List" />
  177. ,
  178. <include refid="Blob_Column_List" />
  179. from sys_dept
  180. where dept_id = #{stationId,jdbcType=INTEGER}
  181. </select>
  182. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  183. <!--
  184. WARNING - @mbg.generated
  185. This element is automatically generated by MyBatis Generator, do not modify.
  186. -->
  187. delete from sys_dept
  188. where dept_id = #{stationId,jdbcType=INTEGER}
  189. </delete>
  190. <delete id="deleteByExample" parameterType="com.platform.yijia.pojo.StationInfoExample">
  191. <!--
  192. WARNING - @mbg.generated
  193. This element is automatically generated by MyBatis Generator, do not modify.
  194. -->
  195. delete from sys_dept
  196. <if test="_parameter != null">
  197. <include refid="Example_Where_Clause" />
  198. </if>
  199. </delete>
  200. <insert id="insert" parameterType="com.platform.yijia.pojo.StationInfo">
  201. <!--
  202. WARNING - @mbg.generated
  203. This element is automatically generated by MyBatis Generator, do not modify.
  204. -->
  205. insert into sys_dept (dept_id, dept_name, dept_address,
  206. oil_gun_num, leader, phone, station_longitude,
  207. station_latitude, mno, station_pic
  208. )
  209. values (#{stationId,jdbcType=INTEGER}, #{stationName,jdbcType=VARCHAR}, #{stationAddress,jdbcType=VARCHAR},
  210. #{oilGunNum,jdbcType=INTEGER}, #{contacts,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
  211. #{stationLongitude,jdbcType=VARCHAR},
  212. #{stationLatitude,jdbcType=VARCHAR}, #{mno,jdbcType=INTEGER}, #{stationPic,jdbcType=LONGVARBINARY}
  213. )
  214. </insert>
  215. <insert id="insertSelective" parameterType="com.platform.yijia.pojo.StationInfo">
  216. <!--
  217. WARNING - @mbg.generated
  218. This element is automatically generated by MyBatis Generator, do not modify.
  219. -->
  220. insert into sys_dept
  221. <trim prefix="(" suffix=")" suffixOverrides=",">
  222. <if test="stationId != null">
  223. dept_id,
  224. </if>
  225. <if test="stationName != null">
  226. dept_name,
  227. </if>
  228. <if test="stationAddress != null">
  229. dept_address,
  230. </if>
  231. <if test="oilGunNum != null">
  232. oil_gun_num,
  233. </if>
  234. <if test="leader != null">
  235. leader,
  236. </if>
  237. <if test="phone != null">
  238. phone,
  239. </if>
  240. <if test="stationLongitude != null">
  241. station_longitude,
  242. </if>
  243. <if test="stationLatitude != null">
  244. station_latitude,
  245. </if>
  246. <if test="mno != null">
  247. mno,
  248. </if>
  249. <if test="stationPic != null">
  250. station_pic,
  251. </if>
  252. </trim>
  253. <trim prefix="values (" suffix=")" suffixOverrides=",">
  254. <if test="stationId != null">
  255. #{stationId,jdbcType=INTEGER},
  256. </if>
  257. <if test="stationName != null">
  258. #{stationName,jdbcType=VARCHAR},
  259. </if>
  260. <if test="stationAddress != null">
  261. #{stationAddress,jdbcType=VARCHAR},
  262. </if>
  263. <if test="oilGunNum != null">
  264. #{oilGunNum,jdbcType=INTEGER},
  265. </if>
  266. <if test="contacts != null">
  267. #{contacts,jdbcType=VARCHAR},
  268. </if>
  269. <if test="phone != null">
  270. #{phone,jdbcType=VARCHAR},
  271. </if>
  272. <if test="stationLongitude != null">
  273. #{stationLongitude,jdbcType=VARCHAR},
  274. </if>
  275. <if test="stationLatitude != null">
  276. #{stationLatitude,jdbcType=VARCHAR},
  277. </if>
  278. <if test="mno != null">
  279. #{mno,jdbcType=INTEGER},
  280. </if>
  281. <if test="stationPic != null">
  282. #{stationPic,jdbcType=LONGVARBINARY},
  283. </if>
  284. </trim>
  285. </insert>
  286. <select id="countByExample" parameterType="com.platform.yijia.pojo.StationInfoExample" resultType="java.lang.Long">
  287. <!--
  288. WARNING - @mbg.generated
  289. This element is automatically generated by MyBatis Generator, do not modify.
  290. -->
  291. select count(*) from sys_dept
  292. <if test="_parameter != null">
  293. <include refid="Example_Where_Clause" />
  294. </if>
  295. </select>
  296. <update id="updateByExampleSelective" parameterType="map">
  297. <!--
  298. WARNING - @mbg.generated
  299. This element is automatically generated by MyBatis Generator, do not modify.
  300. -->
  301. update sys_dept
  302. <set>
  303. <if test="record.stationId != null">
  304. dept_id = #{record.stationId,jdbcType=INTEGER},
  305. </if>
  306. <if test="record.stationName != null">
  307. dept_name = #{record.stationName,jdbcType=VARCHAR},
  308. </if>
  309. <if test="record.stationAddress != null">
  310. dept_address = #{record.stationAddress,jdbcType=VARCHAR},
  311. </if>
  312. <if test="record.oilGunNum != null">
  313. oil_gun_num = #{record.oilGunNum,jdbcType=INTEGER},
  314. </if>
  315. <if test="record.contacts != null">
  316. leader = #{record.contacts,jdbcType=VARCHAR},
  317. </if>
  318. <if test="record.phone != null">
  319. phone = #{record.phone,jdbcType=VARCHAR},
  320. </if>
  321. <if test="record.stationLongitude != null">
  322. station_longitude = #{record.stationLongitude,jdbcType=VARCHAR},
  323. </if>
  324. <if test="record.stationLatitude != null">
  325. station_latitude = #{record.stationLatitude,jdbcType=VARCHAR},
  326. </if>
  327. <if test="record.mno != null">
  328. mno = #{record.mno,jdbcType=INTEGER},
  329. </if>
  330. <if test="record.stationPic != null">
  331. station_pic = #{record.stationPic,jdbcType=LONGVARBINARY},
  332. </if>
  333. </set>
  334. <if test="_parameter != null">
  335. <include refid="Update_By_Example_Where_Clause" />
  336. </if>
  337. </update>
  338. <update id="updateByExampleWithBLOBs" parameterType="map">
  339. <!--
  340. WARNING - @mbg.generated
  341. This element is automatically generated by MyBatis Generator, do not modify.
  342. -->
  343. update sys_dept
  344. set dept_id = #{record.stationId,jdbcType=INTEGER},
  345. dept_name = #{record.stationName,jdbcType=VARCHAR},
  346. dept_address = #{record.stationAddress,jdbcType=VARCHAR},
  347. oil_gun_num = #{record.oilGunNum,jdbcType=INTEGER},
  348. leader = #{record.contacts,jdbcType=VARCHAR},
  349. phone = #{record.phone,jdbcType=VARCHAR},
  350. station_longitude = #{record.stationLongitude,jdbcType=VARCHAR},
  351. station_latitude = #{record.stationLatitude,jdbcType=VARCHAR},
  352. mno = #{record.mno,jdbcType=INTEGER},
  353. station_pic = #{record.stationPic,jdbcType=LONGVARBINARY}
  354. <if test="_parameter != null">
  355. <include refid="Update_By_Example_Where_Clause" />
  356. </if>
  357. </update>
  358. <update id="updateByExample" parameterType="map">
  359. <!--
  360. WARNING - @mbg.generated
  361. This element is automatically generated by MyBatis Generator, do not modify.
  362. -->
  363. update sys_dept
  364. set dept_id = #{record.stationId,jdbcType=INTEGER},
  365. dept_name = #{record.stationName,jdbcType=VARCHAR},
  366. dept_address = #{record.stationAddress,jdbcType=VARCHAR},
  367. oil_gun_num = #{record.oilGunNum,jdbcType=INTEGER},
  368. leader = #{record.contacts,jdbcType=VARCHAR},
  369. phone = #{record.phone,jdbcType=VARCHAR},
  370. station_longitude = #{record.stationLongitude,jdbcType=VARCHAR},
  371. station_latitude = #{record.stationLatitude,jdbcType=VARCHAR},
  372. mno = #{record.mno,jdbcType=INTEGER}
  373. <if test="_parameter != null">
  374. <include refid="Update_By_Example_Where_Clause" />
  375. </if>
  376. </update>
  377. <update id="updateByPrimaryKeySelective" parameterType="com.platform.yijia.pojo.StationInfo">
  378. <!--
  379. WARNING - @mbg.generated
  380. This element is automatically generated by MyBatis Generator, do not modify.
  381. -->
  382. update sys_dept
  383. <set>
  384. <if test="stationName != null">
  385. dept_name = #{stationName,jdbcType=VARCHAR},
  386. </if>
  387. <if test="stationAddress != null">
  388. dept_address = #{stationAddress,jdbcType=VARCHAR},
  389. </if>
  390. <if test="oilGunNum != null">
  391. oil_gun_num = #{oilGunNum,jdbcType=INTEGER},
  392. </if>
  393. <if test="contacts != null">
  394. leader = #{contacts,jdbcType=VARCHAR},
  395. </if>
  396. <if test="phone != null">
  397. phone = #{phone,jdbcType=VARCHAR},
  398. </if>
  399. <if test="stationLongitude != null">
  400. station_longitude = #{stationLongitude,jdbcType=VARCHAR},
  401. </if>
  402. <if test="stationLatitude != null">
  403. station_latitude = #{stationLatitude,jdbcType=VARCHAR},
  404. </if>
  405. <if test="mno != null">
  406. mno = #{mno,jdbcType=INTEGER},
  407. </if>
  408. <if test="stationPic != null">
  409. station_pic = #{stationPic,jdbcType=LONGVARBINARY},
  410. </if>
  411. </set>
  412. where dept_id = #{stationId,jdbcType=INTEGER}
  413. </update>
  414. <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.platform.yijia.pojo.StationInfo">
  415. <!--
  416. WARNING - @mbg.generated
  417. This element is automatically generated by MyBatis Generator, do not modify.
  418. -->
  419. update sys_dept
  420. set dept_name = #{stationName,jdbcType=VARCHAR},
  421. dept_address = #{stationAddress,jdbcType=VARCHAR},
  422. oil_gun_num = #{oilGunNum,jdbcType=INTEGER},
  423. leader = #{contacts,jdbcType=VARCHAR},
  424. phone = #{phone,jdbcType=VARCHAR},
  425. station_longitude = #{stationLongitude,jdbcType=VARCHAR},
  426. station_latitude = #{stationLatitude,jdbcType=VARCHAR},
  427. mno = #{mno,jdbcType=INTEGER},
  428. station_pic = #{stationPic,jdbcType=LONGVARBINARY}
  429. where dept_id = #{stationId,jdbcType=INTEGER}
  430. </update>
  431. <update id="updateByPrimaryKey" parameterType="com.platform.yijia.pojo.StationInfo">
  432. <!--
  433. WARNING - @mbg.generated
  434. This element is automatically generated by MyBatis Generator, do not modify.
  435. -->
  436. update sys_dept
  437. set dept_name = #{stationName,jdbcType=VARCHAR},
  438. dept_address = #{stationAddress,jdbcType=VARCHAR},
  439. oil_gun_num = #{oilGunNum,jdbcType=INTEGER},
  440. leader = #{contacts,jdbcType=VARCHAR},
  441. phone = #{phone,jdbcType=VARCHAR},
  442. station_longitude = #{stationLongitude,jdbcType=VARCHAR},
  443. station_latitude = #{stationLatitude,jdbcType=VARCHAR},
  444. mno = #{mno,jdbcType=INTEGER}
  445. where dept_id = #{stationId,jdbcType=INTEGER}
  446. </update>
  447. <!--查询油站的公告-->
  448. <select id="getStationNoticeInfo" parameterType="Integer" resultType="map">
  449. SELECT
  450. notice AS notice
  451. FROM
  452. station_pay
  453. <where>
  454. <if test="stationId !='' and stationId != null" >
  455. station_id = #{stationId}
  456. </if>
  457. </where>
  458. </select>
  459. <!--查询油站的优惠方式-->
  460. <select id="getStationDiscountWay" parameterType="String" resultType="String">
  461. SELECT
  462. discount_setting AS discountSetting
  463. FROM
  464. station_pay
  465. <where>
  466. <if test="stationId !='' and stationId != null" >
  467. station_id = #{stationId}
  468. </if>
  469. </where>
  470. </select>
  471. <!--查询油站小程序AppId和AppSecret-->
  472. <select id="getStationAppIdAndAppSecret" parameterType="Integer" resultType="Map">
  473. SELECT
  474. mno AS mno,
  475. dept_name AS stationName,
  476. app_id AS appId,
  477. app_secret AS appSecret,
  478. gzh_app_id AS gzhAppId,
  479. gzh_app_secret AS gzhAppSecret
  480. FROM
  481. sys_dept
  482. <where>
  483. <if test="stationId != null" >
  484. dept_id = #{stationId}
  485. </if>
  486. </where>
  487. </select>
  488. <!--油站轮播图片信息返回结果-->
  489. <resultMap id="StationPicResultMap" type="com.platform.yijia.pojo.StationPic">
  490. <id column="id" jdbcType="INTEGER" property="id" />
  491. <result column="name" jdbcType="VARCHAR" property="name" />
  492. <result column="url" jdbcType="VARCHAR" property="url" />
  493. <result column="station_id" jdbcType="INTEGER" property="stationId" />
  494. <result column="station_name" jdbcType="VARCHAR" property="stationName" />
  495. <result column="parent_id" jdbcType="VARCHAR" property="parentId" />
  496. </resultMap>
  497. <!--查询油站轮播图片信息-->
  498. <select id="getStationPicList" resultMap="StationPicResultMap" parameterType="com.platform.yijia.pojo.StationPic">
  499. SELECT
  500. id,
  501. name,
  502. url,
  503. station_id,
  504. station_name,
  505. parent_id
  506. FROM
  507. station_pic
  508. <where>
  509. <if test="stationId !=null and stationId !=''">
  510. AND station_id = #{stationId}
  511. </if>
  512. </where>
  513. </select>
  514. <!--根据油站Id油枪号获取打印机编号 -->
  515. <select id="getStationPrinterList" parameterType="Integer" resultType="Map">
  516. SELECT
  517. A.station_id AS stationId,
  518. A.device_no AS printerSn,
  519. B.integral_print_flag AS integralPrintFlag
  520. FROM station_device_manage AS A
  521. LEFT JOIN station_pay AS B ON A.station_id = B.station_id
  522. <where>
  523. A.device_status = "1"
  524. <if test="stationId != null and stationId !=''">
  525. AND A.station_id = #{stationId}
  526. </if>
  527. </where>
  528. </select>
  529. <!--获取油站的打印设备信息-->
  530. <select id="getStationDeviceManager" parameterType="com.platform.yijia.pojo.StationDeviceManager" resultType="com.platform.yijia.pojo.StationDeviceManager">
  531. SELECT
  532. device_id AS deviceId,
  533. device_no AS deviceNo,
  534. device_name AS deviceName,
  535. station_id AS stationId,
  536. station_name AS stationName,
  537. device_type AS deviceType,
  538. device_serial_num AS deviceSerialNum,
  539. gun_no AS gunNo,
  540. device_status AS deviceStatus,
  541. device_factory AS deviceFactory,
  542. pos_fanout_exchange AS posFanoutExchange,
  543. pos_queue AS posQueue
  544. FROM station_device_manage
  545. <where>
  546. device_status = "1"
  547. <if test="stationId != null and stationId !=''">
  548. AND station_id = #{stationId}
  549. </if>
  550. <if test="deviceType != null and deviceType !=''">
  551. AND device_type = #{deviceType}
  552. </if>
  553. <if test="gunNo != null and gunNo !=''">
  554. AND FIND_IN_SET(#{gunNo}, gun_no)
  555. </if>
  556. </where>
  557. </select>
  558. </mapper>