CameraManageMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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.huaxu.dao.CameraManageMapper">
  4. <!-- 结果集 -->
  5. <resultMap type="com.huaxu.entity.CameraManage" id="CameraManageMap">
  6. <result property="id" column="ID" jdbcType="INTEGER"/>
  7. <result property="tenantId" column="TENANT_ID" jdbcType="VARCHAR"/>
  8. <result property="companyOrgId" column="COMPANY_ORG_ID" jdbcType="INTEGER"/>
  9. <result property="deptOrgId" column="DEPT_ORG_ID" jdbcType="INTEGER"/>
  10. <result property="sceneId" column="SCENE_ID" jdbcType="INTEGER"/>
  11. <result property="address" column="address" jdbcType="VARCHAR"/>
  12. <result property="geo" column="geo" jdbcType="VARCHAR"/>
  13. <result property="palyUrl" column="PALY_URL" jdbcType="VARCHAR"/>
  14. <result property="replayUrl" column="REPLAY_URL" jdbcType="VARCHAR"/>
  15. <result property="appkey" column="APPKEY" jdbcType="VARCHAR"/>
  16. <result property="scrert" column="SCRERT" jdbcType="VARCHAR"/>
  17. <result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
  18. <result property="dateUpdate" column="DATE_UPDATE" jdbcType="TIMESTAMP"/>
  19. <result property="updateBy" column="UPDATE_BY" jdbcType="VARCHAR"/>
  20. <result property="dateCreate" column="DATE_CREATE" jdbcType="TIMESTAMP"/>
  21. <result property="name" column="name" jdbcType="VARCHAR"/>
  22. <result property="deviceSerial" column="device_serial" jdbcType="VARCHAR"/>
  23. <result property="channelNo" column="channel_no" jdbcType="INTEGER"/>
  24. <result property="status" column="status" jdbcType="INTEGER"/>
  25. <result property="sceneName" column="SCENE_NAME" jdbcType="VARCHAR"/>
  26. </resultMap>
  27. <!-- 基本字段 -->
  28. <sql id="Base_Column_List">
  29. a.ID, a.TENANT_ID, a.COMPANY_ORG_ID, a.DEPT_ORG_ID, SCENE_ID, a.address, geo, PALY_URL, REPLAY_URL, APPKEY, SCRERT, a.CREATE_BY, a.DATE_UPDATE, a.UPDATE_BY, a.DATE_CREATE, a.name, device_serial, channel_no </sql>
  30. <!-- 查询单个 -->
  31. <select id="selectById" resultMap="CameraManageMap">
  32. select
  33. <include refid="Base_Column_List"/>
  34. from sms_camera_manage a
  35. where ID = #{id}
  36. </select>
  37. <!-- 查询全部 -->
  38. <select id="selectAll" resultMap="CameraManageMap">
  39. select
  40. <include refid="Base_Column_List"/>
  41. from sms_camera_manage
  42. </select>
  43. <!--通过实体作为筛选条件查询-->
  44. <select id="selectList" resultMap="CameraManageMap">
  45. select
  46. <include refid="Base_Column_List"/>
  47. from sms_camera_manage a
  48. <where>
  49. a.status=1
  50. <if test="items != null">
  51. and (a.COMPANY_ORG_ID in
  52. <foreach item="item" index="index" collection="items" open="(" separator="," close=")">
  53. <if test="item.orgCompanyId!= null">
  54. #{item.orgCompanyId}
  55. </if>
  56. </foreach>
  57. or a.DEPT_ORG_ID in
  58. <foreach item="item" index="index" collection="items" open="(" separator="," close=")">
  59. <if test="item.orgDeparmtmentId!= null">
  60. #{item.orgDeparmtmentId}
  61. </if>
  62. </foreach>
  63. )
  64. </if>
  65. <if test="id != null">
  66. and ID = #{id}
  67. </if>
  68. <if test="tenantId != null and tenantId != ''">
  69. and TENANT_ID = #{tenantId}
  70. </if>
  71. <if test="companyOrgId != null">
  72. and COMPANY_ORG_ID = #{companyOrgId}
  73. </if>
  74. <if test="deptOrgId != null">
  75. and DEPT_ORG_ID = #{deptOrgId}
  76. </if>
  77. <if test="sceneId != null">
  78. and SCENE_ID = #{sceneId}
  79. </if>
  80. <if test="address != null and address != ''">
  81. and address = #{address}
  82. </if>
  83. <if test="geo != null and geo != ''">
  84. and geo = #{geo}
  85. </if>
  86. <if test="palyUrl != null and palyUrl != ''">
  87. and PALY_URL = #{palyUrl}
  88. </if>
  89. <if test="replayUrl != null and replayUrl != ''">
  90. and REPLAY_URL = #{replayUrl}
  91. </if>
  92. <if test="appkey != null and appkey != ''">
  93. and APPKEY = #{appkey}
  94. </if>
  95. <if test="scrert != null and scrert != ''">
  96. and SCRERT = #{scrert}
  97. </if>
  98. <if test="createBy != null and createBy != ''">
  99. and CREATE_BY = #{createBy}
  100. </if>
  101. <if test="dateUpdate != null">
  102. and DATE_UPDATE = #{dateUpdate}
  103. </if>
  104. <if test="updateBy != null and updateBy != ''">
  105. and UPDATE_BY = #{updateBy}
  106. </if>
  107. <if test="dateCreate != null">
  108. and DATE_CREATE = #{dateCreate}
  109. </if>
  110. <if test="name != null and name != ''">
  111. and name = #{name}
  112. </if>
  113. <if test="deviceSerial != null and deviceSerial != ''">
  114. and device_serial = #{deviceSerial}
  115. </if>
  116. <if test="channelNo != null">
  117. and channel_no = #{channelNo}
  118. </if>
  119. <if test="status != null">
  120. and status = #{status}
  121. </if>
  122. </where>
  123. </select>
  124. <!-- 新增所有列 -->
  125. <insert id="insert" keyProperty="id" useGeneratedKeys="true">
  126. insert into sms_camera_manage(ID, TENANT_ID, COMPANY_ORG_ID, DEPT_ORG_ID, SCENE_ID, address, geo, PALY_URL,
  127. REPLAY_URL, APPKEY, SCRERT, CREATE_BY, DATE_UPDATE, UPDATE_BY, DATE_CREATE, name,
  128. device_serial, channel_no, status)
  129. values (#{id}, #{tenantId}, #{companyOrgId}, #{deptOrgId}, #{sceneId}, #{address}, #{geo}, #{palyUrl},
  130. #{replayUrl}, #{appkey}, #{scrert}, #{createBy}, #{dateUpdate}, #{updateBy}, #{dateCreate}, #{name},
  131. #{deviceSerial}, #{channelNo}, #{status})
  132. </insert>
  133. <!-- 批量新增 -->
  134. <insert id="batchInsert">
  135. insert into sms_camera_manage(ID, TENANT_ID, COMPANY_ORG_ID, DEPT_ORG_ID, SCENE_ID, address, geo, PALY_URL,
  136. REPLAY_URL, APPKEY, SCRERT, CREATE_BY, DATE_UPDATE, UPDATE_BY, DATE_CREATE, name, device_serial, channel_no,
  137. status)
  138. values
  139. <foreach collection="cameraManages" item="item" index="index" separator=",">
  140. (
  141. #{item.id}, #{item.tenantId}, #{item.companyOrgId}, #{item.deptOrgId}, #{item.sceneId}, #{item.address},
  142. #{item.geo}, #{item.palyUrl}, #{item.replayUrl}, #{item.appkey}, #{item.scrert}, #{item.createBy},
  143. #{item.dateUpdate}, #{item.updateBy}, #{item.dateCreate}, #{item.name}, #{item.deviceSerial},
  144. #{item.channelNo}, #{item.status} )
  145. </foreach>
  146. </insert>
  147. <!-- 通过主键修改数据 -->
  148. <update id="update">
  149. update sms.sms_camera_manage
  150. <set>
  151. <if test="tenantId != null and tenantId != ''">
  152. TENANT_ID = #{tenantId},
  153. </if>
  154. <if test="companyOrgId != null">
  155. COMPANY_ORG_ID = #{companyOrgId},
  156. </if>
  157. <if test="deptOrgId != null">
  158. DEPT_ORG_ID = #{deptOrgId},
  159. </if>
  160. <if test="deptOrgId == null">
  161. DEPT_ORG_ID =null,
  162. </if>
  163. <if test="sceneId != null">
  164. SCENE_ID = #{sceneId},
  165. </if>
  166. <if test="address != null and address != ''">
  167. address = #{address},
  168. </if>
  169. <if test="geo != null and geo != ''">
  170. geo = #{geo},
  171. </if>
  172. <if test="palyUrl != null and palyUrl != ''">
  173. PALY_URL = #{palyUrl},
  174. </if>
  175. <if test="replayUrl != null ">
  176. REPLAY_URL = #{replayUrl},
  177. </if>
  178. <if test="appkey != null and appkey != ''">
  179. APPKEY = #{appkey},
  180. </if>
  181. <if test="scrert != null and scrert != ''">
  182. SCRERT = #{scrert},
  183. </if>
  184. <if test="createBy != null and createBy != ''">
  185. CREATE_BY = #{createBy},
  186. </if>
  187. <if test="dateUpdate != null">
  188. DATE_UPDATE = #{dateUpdate},
  189. </if>
  190. <if test="updateBy != null and updateBy != ''">
  191. UPDATE_BY = #{updateBy},
  192. </if>
  193. <if test="dateCreate != null">
  194. DATE_CREATE = #{dateCreate},
  195. </if>
  196. <if test="name != null and name != ''">
  197. name = #{name},
  198. </if>
  199. <if test="deviceSerial != null and deviceSerial != ''">
  200. device_serial = #{deviceSerial},
  201. </if>
  202. <if test="channelNo != null">
  203. channel_no = #{channelNo},
  204. </if>
  205. <if test="status != null">
  206. status = #{status},
  207. </if>
  208. </set>
  209. where ID = #{id}
  210. </update>
  211. <!--通过主键删除-->
  212. <delete id="deleteById">
  213. delete
  214. from sms_camera_manage
  215. where ID = #{id}
  216. </delete>
  217. <!-- 总数 -->
  218. <select id="count" resultType="int">
  219. select count(*)
  220. from sms_camera_manage
  221. </select>
  222. <select id="selectPage" resultMap="CameraManageMap">
  223. select
  224. <include refid="Base_Column_List"/> ,b.SCENE_NAME
  225. from sms_camera_manage a join sms_scene b on a.SCENE_ID=b.ID
  226. <where>
  227. a.status=1
  228. <if test="cameraManage.items != null">
  229. and (a.COMPANY_ORG_ID in
  230. <foreach item="item" index="index" collection="cameraManage.items" open="(" separator="," close=")">
  231. <if test="item.orgCompanyId!= null">
  232. #{item.orgCompanyId}
  233. </if>
  234. </foreach>
  235. or a.DEPT_ORG_ID in
  236. <foreach item="item" index="index" collection="cameraManage.items" open="(" separator="," close=")">
  237. <if test="item.orgDeparmtmentId!= null">
  238. #{item.orgDeparmtmentId}
  239. </if>
  240. </foreach>
  241. )
  242. </if>
  243. <if test="cameraManage.id != null">
  244. and ID = #{cameraManage.id}
  245. </if>
  246. <if test="cameraManage.tenantId != null and cameraManage.tenantId != ''">
  247. and a.TENANT_ID = #{cameraManage.tenantId}
  248. </if>
  249. <if test="cameraManage.companyOrgId != null">
  250. and a.COMPANY_ORG_ID = #{cameraManage.companyOrgId}
  251. </if>
  252. <if test="cameraManage.deptOrgId != null">
  253. and a.DEPT_ORG_ID = #{cameraManage.deptOrgId}
  254. </if>
  255. <if test="cameraManage.sceneId != null">
  256. and SCENE_ID = #{cameraManage.sceneId}
  257. </if>
  258. <if test="cameraManage.address != null and cameraManage.address != ''">
  259. and a.address = #{cameraManage.address}
  260. </if>
  261. <if test="cameraManage.geo != null and cameraManage.geo != ''">
  262. and geo = #{cameraManage.geo}
  263. </if>
  264. <if test="cameraManage.palyUrl != null and cameraManage.palyUrl != ''">
  265. and PALY_URL = #{cameraManage.palyUrl}
  266. </if>
  267. <if test="cameraManage.replayUrl != null and cameraManage.replayUrl != ''">
  268. and REPLAY_URL = #{cameraManage.replayUrl}
  269. </if>
  270. <if test="cameraManage.appkey != null and cameraManage.appkey != ''">
  271. and APPKEY = #{cameraManage.appkey}
  272. </if>
  273. <if test="cameraManage.scrert != null and cameraManage.scrert != ''">
  274. and SCRERT = #{cameraManage.scrert}
  275. </if>
  276. <if test="cameraManage.createBy != null and cameraManage.createBy != ''">
  277. and a.CREATE_BY = #{cameraManage.createBy}
  278. </if>
  279. <if test="cameraManage.dateUpdate != null">
  280. and DATE_UPDATE = #{cameraManage.dateUpdate}
  281. </if>
  282. <if test="cameraManage.updateBy != null and cameraManage.updateBy != ''">
  283. and UPDATE_BY = #{cameraManage.updateBy}
  284. </if>
  285. <if test="cameraManage.dateCreate != null">
  286. and DATE_CREATE = #{cameraManage.dateCreate}
  287. </if>
  288. <if test="cameraManage.name != null and cameraManage.name != ''">
  289. and name LIKE concat('%',#{cameraManage.name},'%')
  290. </if>
  291. <if test="cameraManage.deviceSerial != null and cameraManage.deviceSerial != ''">
  292. and device_serial = #{cameraManage.deviceSerial}
  293. </if>
  294. <if test="cameraManage.channelNo != null">
  295. and channel_no = #{cameraManage.channelNo}
  296. </if>
  297. <if test="cameraManage.status != null">
  298. and status = #{cameraManage.status}
  299. </if>
  300. </where>
  301. </select>
  302. <update id="deleteAll">
  303. update sms_camera_manage set STATUS=0 where STATUS=1 and ID in
  304. <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
  305. #{id}
  306. </foreach>
  307. </update>
  308. </mapper>