SysNfcBindMapper.xml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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. a.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. WHERE
  98. del_flag = 0
  99. <choose>
  100. <when test="info.checkSub">
  101. AND b.path like concat('%', #{info.orgPath}, '%')
  102. </when>
  103. <otherwise>
  104. AND b.id = #{info.orgId}
  105. </otherwise>
  106. </choose>
  107. <if test="info.areaName != null and info.areaName != ''">
  108. and a.area_name like concat("%",#{info.areaName},"%")
  109. </if>
  110. <if test="info.orgType !=null and info.orgType !=''">
  111. and b.type=#{info.orgType}
  112. </if>
  113. <if test="info.code != null and info.code != ''">
  114. and a.code like concat("%",#{info.code},"%")
  115. </if>
  116. <if test="info.enable != null and info.enable != ''">
  117. and a.enable = #{info.enable}
  118. </if>
  119. <if test="info.labelName !=null and info.labelName !=''">
  120. and a.label_name=#{info.labelName}
  121. </if>
  122. order by a.org_id,a.area_id,code
  123. </select>
  124. <select id="selectSysNfcBindByCode" resultType="com.xunmei.system.domain.SysNfcBind">
  125. SELECT *
  126. FROM sys_nfc_bind
  127. WHERE del_flag = 0
  128. AND code = #{code}
  129. </select>
  130. <select id="selectSysNfcBindByCodeAndOrgId" resultType="java.lang.Long">
  131. SELECT
  132. org_id
  133. FROM
  134. sys_nfc_bind
  135. WHERE
  136. area_name = '设备间'
  137. AND `code` = #{code}
  138. </select>
  139. <insert id="insertSysNfcBind" parameterType="com.xunmei.system.domain.SysNfcBind">
  140. insert into sys_nfc_bind
  141. <trim prefix="(" suffix=")" suffixOverrides=",">
  142. <if test="id != null">id,
  143. </if>
  144. <if test="areaId != null">area_id,
  145. </if>
  146. <if test="enable != null">enable,
  147. </if>
  148. <if test="code != null">code,
  149. </if>
  150. <if test="createTime != null">create_time,
  151. </if>
  152. <if test="updateId != null">update_id,
  153. </if>
  154. <if test="updateBy != null">update_by,
  155. </if>
  156. <if test="updateTime != null">update_time,
  157. </if>
  158. <if test="orgId != null">org_id,
  159. </if>
  160. <if test="orgName != null">org_name,
  161. </if>
  162. <if test="orgPath != null">org_path,
  163. </if>
  164. <if test="collectionAreaName != null">collection_area_name,
  165. </if>
  166. <if test="checkId != null">check_id,
  167. </if>
  168. </trim>
  169. <trim prefix="values (" suffix=")" suffixOverrides=",">
  170. <if test="id != null">#{id},
  171. </if>
  172. <if test="areaId != null">#{areaId},
  173. </if>
  174. <if test="enable != null">#{enable},
  175. </if>
  176. <if test="code != null">#{code},
  177. </if>
  178. <if test="createTime != null">#{createTime},
  179. </if>
  180. <if test="updateId != null">#{updateId},
  181. </if>
  182. <if test="updateBy != null">#{updateBy},
  183. </if>
  184. <if test="updateTime != null">#{updateTime},
  185. </if>
  186. <if test="orgId != null">#{orgId},
  187. </if>
  188. <if test="orgName != null">#{orgName},
  189. </if>
  190. <if test="orgPath != null">#{orgPath},
  191. </if>
  192. <if test="collectionAreaName != null">#{collectionAreaName},
  193. </if>
  194. <if test="checkId != null">#{checkId},
  195. </if>
  196. </trim>
  197. </insert>
  198. <update id="updateSysNfcBind" parameterType="com.xunmei.system.domain.SysNfcBind">
  199. update sys_nfc_bind
  200. <trim prefix="SET" suffixOverrides=",">
  201. <if test="areaId != null">area_id =
  202. #{areaId},
  203. </if>
  204. <if test="enable != null">enable =
  205. #{enable},
  206. </if>
  207. <if test="code != null">code =
  208. #{code},
  209. </if>
  210. <if test="createTime != null">create_time =
  211. #{createTime},
  212. </if>
  213. <if test="updateId != null">update_id =
  214. #{updateId},
  215. </if>
  216. <if test="updateBy != null">update_by =
  217. #{updateBy},
  218. </if>
  219. <if test="updateTime != null">update_time =
  220. #{updateTime},
  221. </if>
  222. <if test="orgId != null">org_id =
  223. #{orgId},
  224. </if>
  225. <if test="orgName != null">org_name =
  226. #{orgName},
  227. </if>
  228. <if test="orgPath != null">org_path =
  229. #{orgPath},
  230. </if>
  231. <if test="collectionAreaName != null">collection_area_name =
  232. #{collectionAreaName},
  233. </if>
  234. <if test="checkId != null">check_id =
  235. #{checkId},
  236. </if>
  237. <if test="delFlag !=null">
  238. del_flag= #{delFlag}
  239. </if>
  240. </trim>
  241. where id = #{id}
  242. </update>
  243. <update id="updateAreaNameByAreaId">
  244. UPDATE sys_nfc_bind
  245. SET area_name = #{areaName}
  246. WHERE area_id = #{areaId}
  247. </update>
  248. <update id="updateAreaCheckNameByCheckId">
  249. UPDATE sys_nfc_bind
  250. SET collection_area_name = #{collectionAreaName}
  251. WHERE check_id = #{checkId}
  252. </update>
  253. <delete id="deleteSysNfcBindById" parameterType="Long">
  254. delete
  255. from sys_nfc_bind
  256. where id = #{id}
  257. </delete>
  258. <delete id="deleteSysNfcBindByIds" parameterType="String">
  259. delete from sys_nfc_bind where id in
  260. <foreach item="id" collection="array" open="(" separator="," close=")">
  261. #{id}
  262. </foreach>
  263. </delete>
  264. <delete id="deleteSysNfcBindByCode">
  265. UPDATE sys_nfc_bind
  266. set del_flag=2
  267. where code = #{code}
  268. </delete>
  269. </mapper>