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
<?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.jeecg.modules.dnc.mapper.DeviceTypeMapper">
    <select id="getDeviceTypeByAttribution" resultType="org.jeecg.modules.dnc.entity.DeviceType">
        SELECT
        nc_device_type.*,
        nc_device_management.device_management_name,
        nc_device_management.device_management_code
        FROM
        nc_device_type
        LEFT JOIN nc_device_management
        ON nc_device_type.device_management_id = nc_device_management.id
        WHERE
        1 = 1
        <if test="attributionIds != null and attributionIds.size() > 0">
            AND nc_device_type.attribution_id IN
            <foreach collection="attributionIds" item="attributionId" open="(" close=")" separator=",">
                #{attributionId}
            </foreach>
        </if>
        AND nc_device_type.attribution_type = #{attributionType}
        <if test="deviceManagementName != null and deviceManagementName != ''">
            AND nc_device_management.device_management_name LIKE CONCAT('%', #{deviceManagementName}, '%')
        </if>
        <if test="deviceManagementCode != null and deviceManagementCode != ''">
            AND nc_device_management.device_management_code LIKE CONCAT('%', #{deviceManagementCode}, '%')
        </if>
    </select>
</mapper>