SysNfcBindMapper.xml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.xunmei.system.mapper.SysNfcBindMapper">
  6. <resultMap type="com.xunmei.system.domain.SysNfcBind" id="SysNfcBindResult">
  7. <result property="id" column="id"/>
  8. <result property="areaId" column="area_id"/>
  9. <result property="enable" column="enable"/>
  10. <result property="code" column="code"/>
  11. <result property="createTime" column="create_time"/>
  12. <result property="updateId" column="update_id"/>
  13. <result property="updateBy" column="update_by"/>
  14. <result property="updateTime" column="update_time"/>
  15. <result property="orgId" column="org_id"/>
  16. <result property="orgName" column="org_name"/>
  17. <result property="orgPath" column="org_path"/>
  18. <result property="collectionAreaName" column="collection_area_name"/>
  19. <result property="checkId" column="check_id"/>
  20. </resultMap>
  21. <sql id="selectSysNfcBindVo">
  22. select id,
  23. area_id,
  24. enable,
  25. code,
  26. create_time,
  27. update_id,
  28. update_by,
  29. update_time,
  30. org_id,
  31. org_name,
  32. org_path,
  33. collection_area_name,
  34. check_id
  35. from sys_nfc_bind
  36. </sql>
  37. <select id="selectSysNfcBindList" parameterType="com.xunmei.system.domain.SysNfcBind"
  38. resultMap="SysNfcBindResult">
  39. <include refid="selectSysNfcBindVo"/>
  40. <where>
  41. <if test="areaId != null ">
  42. and area_id = #{areaId}
  43. </if>
  44. <if test="enable != null ">
  45. and enable = #{enable}
  46. </if>
  47. <if test="code != null and code != ''">
  48. and code = #{code}
  49. </if>
  50. <if test="updateId != null ">
  51. and update_id = #{updateId}
  52. </if>
  53. <if test="orgId != null ">
  54. and org_id = #{orgId}
  55. </if>
  56. <if test="orgName != null and orgName != ''">
  57. and org_name like concat('%', #{orgName}, '%')
  58. </if>
  59. <if test="orgPath != null and orgPath != ''">
  60. and org_path = #{orgPath}
  61. </if>
  62. <if test="collectionAreaName != null and collectionAreaName != ''">
  63. and collection_area_name like concat('%', #{collectionAreaName}, '%')
  64. </if>
  65. <if test="checkId != null ">
  66. and check_id = #{checkId}
  67. </if>
  68. </where>
  69. </select>
  70. <select id="selectSysNfcBindById" parameterType="Long"
  71. resultMap="SysNfcBindResult">
  72. <include refid="selectSysNfcBindVo"/>
  73. where id = #{id}
  74. </select>
  75. <select id="selectNFCPage" resultType="com.xunmei.system.domain.SysNfcBind">
  76. SELECT
  77. a.id,
  78. a.area_id,
  79. a.area_name,
  80. a.enable,
  81. a.del_flag,
  82. a.code,
  83. a.label_name,
  84. a.update_id,
  85. a.org_id,
  86. a.org_name,
  87. a.org_path,
  88. c.check_name as collection_area_name,
  89. a.check_id,
  90. a.create_by,
  91. a.create_time,
  92. a.update_by,
  93. a.update_time
  94. FROM
  95. sys_nfc_bind a
  96. LEFT JOIN sys_org b on a.org_id = b.id
  97. LEFT JOIN sys_area_check c on a.check_id = c.id
  98. WHERE
  99. a.del_flag = 0
  100. <choose>
  101. <when test="info.checkSub">
  102. AND b.path like concat('%', #{info.orgPath}, '%')
  103. </when>
  104. <otherwise>
  105. AND b.id = #{info.orgId}
  106. </otherwise>
  107. </choose>
  108. <if test="info.areaName != null and info.areaName != ''">
  109. and a.area_name like concat("%",#{info.areaName},"%")
  110. </if>
  111. <if test="info.orgType !=null and info.orgType !=''">
  112. and b.type=#{info.orgType}
  113. </if>
  114. <if test="info.code != null and info.code != ''">
  115. and a.code like concat("%",#{info.code},"%")
  116. </if>
  117. <if test="info.enable != null and info.enable != ''">
  118. and a.enable = #{info.enable}
  119. </if>
  120. <if test="info.labelName !=null and info.labelName !=''">
  121. and a.label_name=#{info.labelName}
  122. </if>
  123. order by a.org_id,a.area_id,code
  124. </select>
  125. <select id="selectSysNfcBindByCode" resultType="com.xunmei.system.domain.SysNfcBind">
  126. SELECT *
  127. FROM sys_nfc_bind
  128. WHERE del_flag = 0
  129. AND code = #{code}
  130. </select>
  131. <select id="selectSysNfcBindByCodeAndOrgId" resultType="java.lang.Long">
  132. SELECT
  133. org_id
  134. FROM
  135. sys_nfc_bind
  136. WHERE
  137. area_name = '设备间'
  138. AND `code` = #{code}
  139. </select>
  140. <insert id="insertSysNfcBind" parameterType="com.xunmei.system.domain.SysNfcBind">
  141. insert into sys_nfc_bind
  142. <trim prefix="(" suffix=")" suffixOverrides=",">
  143. <if test="id != null">id,
  144. </if>
  145. <if test="areaId != null">area_id,
  146. </if>
  147. <if test="enable != null">enable,
  148. </if>
  149. <if test="code != null">code,
  150. </if>
  151. <if test="createTime != null">create_time,
  152. </if>
  153. <if test="updateId != null">update_id,
  154. </if>
  155. <if test="updateBy != null">update_by,
  156. </if>
  157. <if test="updateTime != null">update_time,
  158. </if>
  159. <if test="orgId != null">org_id,
  160. </if>
  161. <if test="orgName != null">org_name,
  162. </if>
  163. <if test="orgPath != null">org_path,
  164. </if>
  165. <if test="collectionAreaName != null">collection_area_name,
  166. </if>
  167. <if test="checkId != null">check_id,
  168. </if>
  169. </trim>
  170. <trim prefix="values (" suffix=")" suffixOverrides=",">
  171. <if test="id != null">#{id},
  172. </if>
  173. <if test="areaId != null">#{areaId},
  174. </if>
  175. <if test="enable != null">#{enable},
  176. </if>
  177. <if test="code != null">#{code},
  178. </if>
  179. <if test="createTime != null">#{createTime},
  180. </if>
  181. <if test="updateId != null">#{updateId},
  182. </if>
  183. <if test="updateBy != null">#{updateBy},
  184. </if>
  185. <if test="updateTime != null">#{updateTime},
  186. </if>
  187. <if test="orgId != null">#{orgId},
  188. </if>
  189. <if test="orgName != null">#{orgName},
  190. </if>
  191. <if test="orgPath != null">#{orgPath},
  192. </if>
  193. <if test="collectionAreaName != null">#{collectionAreaName},
  194. </if>
  195. <if test="checkId != null">#{checkId},
  196. </if>
  197. </trim>
  198. </insert>
  199. <update id="updateSysNfcBind" parameterType="com.xunmei.system.domain.SysNfcBind">
  200. update sys_nfc_bind
  201. <trim prefix="SET" suffixOverrides=",">
  202. <if test="areaId != null">area_id =
  203. #{areaId},
  204. </if>
  205. <if test="enable != null">enable =
  206. #{enable},
  207. </if>
  208. <if test="code != null">code =
  209. #{code},
  210. </if>
  211. <if test="createTime != null">create_time =
  212. #{createTime},
  213. </if>
  214. <if test="updateId != null">update_id =
  215. #{updateId},
  216. </if>
  217. <if test="updateBy != null">update_by =
  218. #{updateBy},
  219. </if>
  220. <if test="updateTime != null">update_time =
  221. #{updateTime},
  222. </if>
  223. <if test="orgId != null">org_id =
  224. #{orgId},
  225. </if>
  226. <if test="orgName != null">org_name =
  227. #{orgName},
  228. </if>
  229. <if test="orgPath != null">org_path =
  230. #{orgPath},
  231. </if>
  232. <if test="collectionAreaName != null">collection_area_name =
  233. #{collectionAreaName},
  234. </if>
  235. <if test="checkId != null">check_id =
  236. #{checkId},
  237. </if>
  238. <if test="delFlag !=null">
  239. del_flag= #{delFlag}
  240. </if>
  241. </trim>
  242. where id = #{id}
  243. </update>
  244. <update id="updateAreaNameByAreaId">
  245. UPDATE sys_nfc_bind
  246. SET area_name = #{areaName}
  247. WHERE area_id = #{areaId}
  248. </update>
  249. <update id="updateAreaCheckNameByCheckId">
  250. UPDATE sys_nfc_bind
  251. SET collection_area_name = #{collectionAreaName}
  252. WHERE check_id = #{checkId}
  253. </update>
  254. <delete id="deleteSysNfcBindById" parameterType="Long">
  255. delete
  256. from sys_nfc_bind
  257. where id = #{id}
  258. </delete>
  259. <delete id="deleteSysNfcBindByIds" parameterType="String">
  260. delete from sys_nfc_bind where id in
  261. <foreach item="id" collection="array" open="(" separator="," close=")">
  262. #{id}
  263. </foreach>
  264. </delete>
  265. <delete id="deleteSysNfcBindByCode">
  266. UPDATE sys_nfc_bind
  267. set del_flag=2
  268. where code = #{code}
  269. </delete>
  270. </mapper>