郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?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.gkhy.safePlatform.account.repository.CameraRepository" >
 
    <resultMap id="baseMap" type="com.gkhy.safePlatform.account.entity.device.Camera">
        <id property="id" column="id" jdbcType="BIGINT"/>
        <result property="bizDepId" column="biz_dep_id" jdbcType="BIGINT"/>
        <result property="deviceNo" column="device_no" jdbcType="VARCHAR"/>
        <result property="name" column="name" jdbcType="VARCHAR"/>
        <result property="shortName" column="short_name" jdbcType="VARCHAR"/>
    </resultMap>
 
    <select id="listCamerasByBizDepId" resultMap="baseMap">
        select * from sys_camera where biz_dep_id = #{bizDepId}
    </select>
 
    <delete id="deleteCameraById">
        delete from sys_camera where id = #{id}
    </delete>
 
    <select id="listCamerasByCondition" resultMap="baseMap" parameterType="com.gkhy.safePlatform.account.model.dto.req.CameraQuery">
        select * from sys_camera
        <where>
            <if test="param.bizDepId != null and param.bizDepId > 0">
                and biz_dep_id = #{param.bizDepId}
            </if>
            <if test="param.name != null and param.name != ''">
                and name like concat("%",#{param.name},"%")
            </if>
            <if test="param.shortName != null and param.shortName != ''">
                and short_name like concat("%",#{param.shortName},"%")
            </if>
        </where>
    </select>
 
    <select id="findByDeviceNo" resultMap="baseMap">
        select * from sys_camera where device_no = #{deviceNo}
    </select>
 
    <select id="listCamerasByName" resultMap="baseMap">
        select * from sys_camera where name = #{name}
    </select>
 
    <select id="listCamerasByShortName" resultMap="baseMap">
        select * from sys_camera where short_name = #{shortName}
    </select>
 
    <select id="listAllCameras" resultMap="baseMap">
        select * from sys_camera
    </select>
 
    <select id="listByCameraIdList" resultMap="baseMap">
        select * from sys_camera
        <where>
            <if test="cameraIdList != null">
                id in
                <foreach collection="cameraIdList" item="id" open="(" close=")" separator=",">
                    #{id}
                </foreach>
            </if>
        </where>
    </select>
 
 
</mapper>