吉安感知网项目-后端
xiebin
2026-01-06 d207a86cdf1ab52ef8cb7cd83bad8fceab8038cf
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
66
67
68
69
70
71
72
73
74
75
76
<?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="org.sxkj.system.mapper.DevicePerShareMapper">
 
    <!--自定义分页查询-->
    <select id="selectDevicePerSharePage" resultType="org.sxkj.system.vo.DevicePerShareVO">
        SELECT
            ddps.id,
            ddps.device_sn,
            ddps.loan_from_dept_id,
            ddps.loan_to_dept_id as deptId,
            ddps.create_time,
            bd.dept_name as deptName
        FROM
        manage_device_per_share ddps
        LEFT JOIN blade_dept bd ON bd.id = ddps.loan_to_dept_id AND bd.is_deleted = 0
        <where>
            <if test="devicePerShare.deptName!=null and devicePerShare.deptName!=''">
                and bd.dept_name like concat('%',#{devicePerShare.deptName},'%')
            </if>
            <if test="devicePerShare.deviceSn!=null and devicePerShare.deviceSn!=''">
                and ddps.device_sn = #{devicePerShare.deviceSn}
            </if>
        </where>
        GROUP BY ddps.id
    </select>
 
    <select id="findActiveLoansByToDeptId" resultType="org.sxkj.system.entity.DevicePerShareEntity">
        SELECT a.*,b.device_name
        FROM manage_device_per_share a
        LEFT JOIN manage_device b ON a.device_sn = b.device_sn
        <where>
            b.is_deleted = 0
            <if test="param.nickname!=null and param.nickname!=''">
                and b.nickname like concat('%',#{param.nickname},'%')
            </if>
            <if test="deptIdList!=null and deptIdList.size>0">
                AND a.loan_to_dept_id IN
                <foreach collection="deptIdList" index="index" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
            <if test="param.hiddenFlag!=null">
                and b.hidden_flag = #{param.hiddenFlag}
            </if>
            <if test="param.onlineStatus!=null and param.onlineStatus">
                and b.mode_code != -1
            </if>
        </where>
    </select>
 
    <select id="findActiveLoansAreaCodeByToDeptId" resultType="java.lang.String">
        SELECT b.area_code
        FROM manage_device_per_share a
        LEFT JOIN manage_device b ON a.device_sn = b.device_sn
        <where>
            b.is_deleted = 0
            <if test="param.nickname!=null and param.nickname!=''">
                and b.nickname like concat('%',#{param.nickname},'%')
            </if>
            <if test="deptIdList!=null and deptIdList.size>0">
                AND a.loan_to_dept_id IN
                <foreach collection="deptIdList" index="index" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
            <if test="param.hiddenFlag!=null">
                and b.hidden_flag = #{param.hiddenFlag}
            </if>
            <if test="param.onlineStatus!=null and param.onlineStatus">
                and b.mode_code != -1
            </if>
        </where>
    </select>
 
</mapper>