CashierDao.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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.kmall.admin.dao.CashierDao">
  4. <resultMap type="com.kmall.admin.entity.CashierEntity" id="cashierMap">
  5. <id property="mcId" column="mc_id"/>
  6. <result property="machineCodeType" column="machine_code_type"/>
  7. <result property="machineCode" column="machine_code"/>
  8. <result property="cashierSn" column="cashier_sn"/>
  9. <result property="stationCode" column="station_code"/>
  10. <result property="shopSn" column="shop_sn"/>
  11. <result property="merchSn" column="merch_sn"/>
  12. <result property="thirdMerchSn" column="third_merch_sn"/>
  13. <result property="createrSn" column="creater_sn"/>
  14. <result property="createTime" column="create_time"/>
  15. <result property="moderSn" column="moder_sn"/>
  16. <result property="modTime" column="mod_time"/>
  17. <result property="tstm" column="tstm"/>
  18. </resultMap>
  19. <select id="queryObject" resultType="com.kmall.admin.entity.CashierEntity">
  20. select
  21. `mc_id`,
  22. `machine_code_type`,
  23. `machine_code`,
  24. `cashier_sn`,
  25. `station_code`,
  26. `shop_sn`,
  27. `merch_sn`,
  28. `third_merch_sn`,
  29. `creater_sn`,
  30. `create_time`,
  31. `moder_sn`,
  32. `mod_time`,
  33. `tstm`
  34. from mall2_cashier
  35. where mc_id = #{id}
  36. </select>
  37. <select id="queryList" resultType="com.kmall.admin.entity.CashierEntity">
  38. select
  39. cashier.mc_id,
  40. cashier.machine_code_type,
  41. cashier.machine_code,
  42. cashier.cashier_sn,
  43. cashier.station_code,
  44. cashier.shop_sn,
  45. cashier.merch_sn,
  46. cashier.third_merch_sn,
  47. cashier.creater_sn,
  48. cashier.create_time,
  49. cashier.moder_sn,
  50. cashier.mod_time,
  51. cashier.tstm,
  52. store.store_name as shopName,
  53. merch.merch_name as merchName
  54. from mall2_cashier cashier
  55. left join mall_store store on cashier.shop_sn = store.id
  56. left join mall_merch merch on cashier.merch_sn = merch.merch_sn
  57. WHERE 1=1
  58. <if test="machineCode != null and machineCode.trim() != ''">
  59. AND cashier.machine_code LIKE concat('%',#{machineCode},'%')
  60. </if>
  61. <if test="storeName != null and storeName.trim() != ''">
  62. AND store.store_name LIKE concat('%',#{storeName},'%')
  63. </if>
  64. <choose>
  65. <when test="sidx != null and sidx.trim() != ''">
  66. order by ${sidx} ${order}
  67. </when>
  68. <otherwise>
  69. order by mc_id desc
  70. </otherwise>
  71. </choose>
  72. <if test="offset != null and limit != null">
  73. limit #{offset}, #{limit}
  74. </if>
  75. </select>
  76. <select id="queryTotal" resultType="int">
  77. select count(*) from mall2_cashier cashier
  78. left join mall_store store on cashier.shop_sn = store.id
  79. WHERE 1=1
  80. <if test="machineCode != null and machineCode.trim() != ''">
  81. AND cashier.machine_code LIKE concat('%',#{machineCode},'%')
  82. </if>
  83. <if test="storeName != null and storeName.trim() != ''">
  84. AND store.store_name LIKE concat('%',#{storeName},'%')
  85. </if>
  86. </select>
  87. <insert id="save" parameterType="com.kmall.admin.entity.CashierEntity" useGeneratedKeys="true" keyProperty="mcId">
  88. insert into mall2_cashier(
  89. `machine_code_type`,
  90. `machine_code`,
  91. `cashier_sn`,
  92. `station_code`,
  93. `shop_sn`,
  94. `merch_sn`,
  95. `third_merch_sn`,
  96. `creater_sn`,
  97. `create_time`,
  98. `moder_sn`,
  99. `mod_time`,
  100. `tstm`)
  101. values(
  102. #{machineCodeType},
  103. #{machineCode},
  104. #{cashierSn},
  105. #{stationCode},
  106. #{shopSn},
  107. #{merchSn},
  108. #{thirdMerchSn},
  109. #{createrSn},
  110. #{createTime},
  111. #{moderSn},
  112. #{modTime},
  113. #{tstm})
  114. </insert>
  115. <update id="update" parameterType="com.kmall.admin.entity.CashierEntity">
  116. update mall2_cashier
  117. <set>
  118. <if test="machineCodeType != null">`machine_code_type` = #{machineCodeType}, </if>
  119. <if test="machineCode != null">`machine_code` = #{machineCode}, </if>
  120. <if test="cashierSn != null">`cashier_sn` = #{cashierSn}, </if>
  121. <if test="stationCode != null">`station_code` = #{stationCode}, </if>
  122. <if test="shopSn != null">`shop_sn` = #{shopSn}, </if>
  123. <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
  124. <if test="thirdMerchSn != null">`third_merch_sn` = #{thirdMerchSn}, </if>
  125. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  126. <if test="createTime != null">`create_time` = #{createTime}, </if>
  127. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  128. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  129. <if test="tstm != null">`tstm` = #{tstm}</if>
  130. </set>
  131. where mc_id = #{mcId}
  132. </update>
  133. <delete id="delete">
  134. delete from mall2_cashier where mc_id = #{value}
  135. </delete>
  136. <delete id="deleteBatch">
  137. delete from mall2_cashier where mc_id in
  138. <foreach item="mcId" collection="array" open="(" separator="," close=")">
  139. #{mcId}
  140. </foreach>
  141. </delete>
  142. <select id="queryByMachineCode" resultType="com.kmall.admin.entity.CashierEntity">
  143. select
  144. `mc_id`,
  145. `machine_code_type`,
  146. `machine_code`,
  147. `cashier_sn`,
  148. `station_code`,
  149. `shop_sn`,
  150. `merch_sn`,
  151. `third_merch_sn`,
  152. `creater_sn`,
  153. `create_time`,
  154. `moder_sn`,
  155. `mod_time`,
  156. `tstm`
  157. from mall2_cashier
  158. where machine_code = #{machineCode}
  159. and shop_sn = #{storeId}
  160. </select>
  161. </mapper>