123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.huaxu.dao.CameraManageMapper">
- <!-- 结果集 -->
- <resultMap type="com.huaxu.entity.CameraManage" id="CameraManageMap">
- <result property="id" column="ID" jdbcType="INTEGER"/>
- <result property="tenantId" column="TENANT_ID" jdbcType="VARCHAR"/>
- <result property="companyOrgId" column="COMPANY_ORG_ID" jdbcType="INTEGER"/>
- <result property="deptOrgId" column="DEPT_ORG_ID" jdbcType="INTEGER"/>
- <result property="sceneId" column="SCENE_ID" jdbcType="INTEGER"/>
- <result property="address" column="address" jdbcType="VARCHAR"/>
- <result property="geo" column="geo" jdbcType="VARCHAR"/>
- <result property="palyUrl" column="PALY_URL" jdbcType="VARCHAR"/>
- <result property="replayUrl" column="REPLAY_URL" jdbcType="VARCHAR"/>
- <result property="appkey" column="APPKEY" jdbcType="VARCHAR"/>
- <result property="scrert" column="SCRERT" jdbcType="VARCHAR"/>
- <result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
- <result property="dateUpdate" column="DATE_UPDATE" jdbcType="TIMESTAMP"/>
- <result property="updateBy" column="UPDATE_BY" jdbcType="VARCHAR"/>
- <result property="dateCreate" column="DATE_CREATE" jdbcType="TIMESTAMP"/>
- <result property="name" column="name" jdbcType="VARCHAR"/>
- <result property="deviceSerial" column="device_serial" jdbcType="VARCHAR"/>
- <result property="channelNo" column="channel_no" jdbcType="INTEGER"/>
- <result property="status" column="status" jdbcType="INTEGER"/>
- <result property="sceneName" column="SCENE_NAME" jdbcType="VARCHAR"/>
- </resultMap>
- <!-- 基本字段 -->
- <sql id="Base_Column_List">
- 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>
- <!-- 查询单个 -->
- <select id="selectById" resultMap="CameraManageMap">
- select
- <include refid="Base_Column_List"/>
- from sms_camera_manage a
- where ID = #{id}
- </select>
- <!-- 查询全部 -->
- <select id="selectAll" resultMap="CameraManageMap">
- select
- <include refid="Base_Column_List"/>
- from sms_camera_manage
- </select>
- <!--通过实体作为筛选条件查询-->
- <select id="selectList" resultMap="CameraManageMap">
- select
- <include refid="Base_Column_List"/>
- from sms_camera_manage a
- <where>
- a.status=1
- <if test="items != null">
- and (a.COMPANY_ORG_ID in
- <foreach item="item" index="index" collection="items" open="(" separator="," close=")">
- <if test="item.orgCompanyId!= null">
- #{item.orgCompanyId}
- </if>
- </foreach>
- or a.DEPT_ORG_ID in
- <foreach item="item" index="index" collection="items" open="(" separator="," close=")">
- <if test="item.orgDeparmtmentId!= null">
- #{item.orgDeparmtmentId}
- </if>
- </foreach>
- )
- </if>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="tenantId != null and tenantId != ''">
- and TENANT_ID = #{tenantId}
- </if>
- <if test="companyOrgId != null">
- and COMPANY_ORG_ID = #{companyOrgId}
- </if>
- <if test="deptOrgId != null">
- and DEPT_ORG_ID = #{deptOrgId}
- </if>
- <if test="sceneId != null">
- and SCENE_ID = #{sceneId}
- </if>
- <if test="address != null and address != ''">
- and address = #{address}
- </if>
- <if test="geo != null and geo != ''">
- and geo = #{geo}
- </if>
- <if test="palyUrl != null and palyUrl != ''">
- and PALY_URL = #{palyUrl}
- </if>
- <if test="replayUrl != null and replayUrl != ''">
- and REPLAY_URL = #{replayUrl}
- </if>
- <if test="appkey != null and appkey != ''">
- and APPKEY = #{appkey}
- </if>
- <if test="scrert != null and scrert != ''">
- and SCRERT = #{scrert}
- </if>
- <if test="createBy != null and createBy != ''">
- and CREATE_BY = #{createBy}
- </if>
- <if test="dateUpdate != null">
- and DATE_UPDATE = #{dateUpdate}
- </if>
- <if test="updateBy != null and updateBy != ''">
- and UPDATE_BY = #{updateBy}
- </if>
- <if test="dateCreate != null">
- and DATE_CREATE = #{dateCreate}
- </if>
- <if test="name != null and name != ''">
- and name = #{name}
- </if>
- <if test="deviceSerial != null and deviceSerial != ''">
- and device_serial = #{deviceSerial}
- </if>
- <if test="channelNo != null">
- and channel_no = #{channelNo}
- </if>
- <if test="status != null">
- and status = #{status}
- </if>
- </where>
- </select>
- <!-- 新增所有列 -->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into sms_camera_manage(ID, TENANT_ID, COMPANY_ORG_ID, DEPT_ORG_ID, SCENE_ID, address, geo, PALY_URL,
- REPLAY_URL, APPKEY, SCRERT, CREATE_BY, DATE_UPDATE, UPDATE_BY, DATE_CREATE, name,
- device_serial, channel_no, status)
- values (#{id}, #{tenantId}, #{companyOrgId}, #{deptOrgId}, #{sceneId}, #{address}, #{geo}, #{palyUrl},
- #{replayUrl}, #{appkey}, #{scrert}, #{createBy}, #{dateUpdate}, #{updateBy}, #{dateCreate}, #{name},
- #{deviceSerial}, #{channelNo}, #{status})
- </insert>
- <!-- 批量新增 -->
- <insert id="batchInsert">
- insert into sms_camera_manage(ID, TENANT_ID, COMPANY_ORG_ID, DEPT_ORG_ID, SCENE_ID, address, geo, PALY_URL,
- REPLAY_URL, APPKEY, SCRERT, CREATE_BY, DATE_UPDATE, UPDATE_BY, DATE_CREATE, name, device_serial, channel_no,
- status)
- values
- <foreach collection="cameraManages" item="item" index="index" separator=",">
- (
- #{item.id}, #{item.tenantId}, #{item.companyOrgId}, #{item.deptOrgId}, #{item.sceneId}, #{item.address},
- #{item.geo}, #{item.palyUrl}, #{item.replayUrl}, #{item.appkey}, #{item.scrert}, #{item.createBy},
- #{item.dateUpdate}, #{item.updateBy}, #{item.dateCreate}, #{item.name}, #{item.deviceSerial},
- #{item.channelNo}, #{item.status} )
- </foreach>
- </insert>
- <!-- 通过主键修改数据 -->
- <update id="update">
- update sms.sms_camera_manage
- <set>
- <if test="tenantId != null and tenantId != ''">
- TENANT_ID = #{tenantId},
- </if>
- <if test="companyOrgId != null">
- COMPANY_ORG_ID = #{companyOrgId},
- </if>
- <if test="deptOrgId != null">
- DEPT_ORG_ID = #{deptOrgId},
- </if>
- <if test="deptOrgId == null">
- DEPT_ORG_ID =null,
- </if>
- <if test="sceneId != null">
- SCENE_ID = #{sceneId},
- </if>
- <if test="address != null and address != ''">
- address = #{address},
- </if>
- <if test="geo != null and geo != ''">
- geo = #{geo},
- </if>
- <if test="palyUrl != null and palyUrl != ''">
- PALY_URL = #{palyUrl},
- </if>
- <if test="replayUrl != null ">
- REPLAY_URL = #{replayUrl},
- </if>
- <if test="appkey != null and appkey != ''">
- APPKEY = #{appkey},
- </if>
- <if test="scrert != null and scrert != ''">
- SCRERT = #{scrert},
- </if>
- <if test="createBy != null and createBy != ''">
- CREATE_BY = #{createBy},
- </if>
- <if test="dateUpdate != null">
- DATE_UPDATE = #{dateUpdate},
- </if>
- <if test="updateBy != null and updateBy != ''">
- UPDATE_BY = #{updateBy},
- </if>
- <if test="dateCreate != null">
- DATE_CREATE = #{dateCreate},
- </if>
- <if test="name != null and name != ''">
- name = #{name},
- </if>
- <if test="deviceSerial != null and deviceSerial != ''">
- device_serial = #{deviceSerial},
- </if>
- <if test="channelNo != null">
- channel_no = #{channelNo},
- </if>
- <if test="status != null">
- status = #{status},
- </if>
- </set>
- where ID = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete
- from sms_camera_manage
- where ID = #{id}
- </delete>
- <!-- 总数 -->
- <select id="count" resultType="int">
- select count(*)
- from sms_camera_manage
- </select>
- <select id="selectPage" resultMap="CameraManageMap">
- select
- <include refid="Base_Column_List"/> ,b.SCENE_NAME
- from sms_camera_manage a join sms_scene b on a.SCENE_ID=b.ID
- <where>
- a.status=1
- <if test="cameraManage.items != null">
- and (a.COMPANY_ORG_ID in
- <foreach item="item" index="index" collection="cameraManage.items" open="(" separator="," close=")">
- <if test="item.orgCompanyId!= null">
- #{item.orgCompanyId}
- </if>
- </foreach>
- or a.DEPT_ORG_ID in
- <foreach item="item" index="index" collection="cameraManage.items" open="(" separator="," close=")">
- <if test="item.orgDeparmtmentId!= null">
- #{item.orgDeparmtmentId}
- </if>
- </foreach>
- )
- </if>
- <if test="cameraManage.id != null">
- and ID = #{cameraManage.id}
- </if>
- <if test="cameraManage.tenantId != null and cameraManage.tenantId != ''">
- and a.TENANT_ID = #{cameraManage.tenantId}
- </if>
- <if test="cameraManage.companyOrgId != null">
- and a.COMPANY_ORG_ID = #{cameraManage.companyOrgId}
- </if>
- <if test="cameraManage.deptOrgId != null">
- and a.DEPT_ORG_ID = #{cameraManage.deptOrgId}
- </if>
- <if test="cameraManage.sceneId != null">
- and SCENE_ID = #{cameraManage.sceneId}
- </if>
- <if test="cameraManage.address != null and cameraManage.address != ''">
- and a.address = #{cameraManage.address}
- </if>
- <if test="cameraManage.geo != null and cameraManage.geo != ''">
- and geo = #{cameraManage.geo}
- </if>
- <if test="cameraManage.palyUrl != null and cameraManage.palyUrl != ''">
- and PALY_URL = #{cameraManage.palyUrl}
- </if>
- <if test="cameraManage.replayUrl != null and cameraManage.replayUrl != ''">
- and REPLAY_URL = #{cameraManage.replayUrl}
- </if>
- <if test="cameraManage.appkey != null and cameraManage.appkey != ''">
- and APPKEY = #{cameraManage.appkey}
- </if>
- <if test="cameraManage.scrert != null and cameraManage.scrert != ''">
- and SCRERT = #{cameraManage.scrert}
- </if>
- <if test="cameraManage.createBy != null and cameraManage.createBy != ''">
- and a.CREATE_BY = #{cameraManage.createBy}
- </if>
- <if test="cameraManage.dateUpdate != null">
- and DATE_UPDATE = #{cameraManage.dateUpdate}
- </if>
- <if test="cameraManage.updateBy != null and cameraManage.updateBy != ''">
- and UPDATE_BY = #{cameraManage.updateBy}
- </if>
- <if test="cameraManage.dateCreate != null">
- and DATE_CREATE = #{cameraManage.dateCreate}
- </if>
- <if test="cameraManage.name != null and cameraManage.name != ''">
- and name LIKE concat('%',#{cameraManage.name},'%')
- </if>
- <if test="cameraManage.deviceSerial != null and cameraManage.deviceSerial != ''">
- and device_serial = #{cameraManage.deviceSerial}
- </if>
- <if test="cameraManage.channelNo != null">
- and channel_no = #{cameraManage.channelNo}
- </if>
- <if test="cameraManage.status != null">
- and status = #{cameraManage.status}
- </if>
- </where>
- </select>
- <update id="deleteAll">
- update sms_camera_manage set STATUS=0 where STATUS=1 and ID in
- <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </update>
- </mapper>
|