徐州低空平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
3.1 KiB

8 months ago
<?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.dromara.sample.manage.mapper.IDeviceProMapper">
<resultMap id="listDeviceProEntityMap" type="org.dromara.sample.manage.model.entity.DeviceProEntity">
<result column="pro_id" property="id" jdbcType="VARCHAR"/>
8 months ago
<result column="pro_name" property="proName" jdbcType="VARCHAR"/>
<result column="bind_code" property="bindCode" jdbcType="VARCHAR"/>
<result column="bind_type" property="bindType" jdbcType="VARCHAR"/>
<collection property="deviceProUserEntityList" ofType="org.dromara.sample.manage.model.entity.DeviceProUserEntity">
<result column="pro_user_id" property="id"/>
<result column="device_pro_id" property="deviceProId"/>
8 months ago
<result column="user_id" property="userId"/>
<result column="nick_name" property="nickName"/>
8 months ago
</collection>
<collection property="deviceEntityList" ofType="org.dromara.sample.manage.model.entity.DeviceEntity">
<result column="device_id" property="id"/>
8 months ago
<result column="device_sn" property="deviceSn"/>
<result column="device_name" property="deviceName"/>
<result column="device_type" property="deviceType"/>
<result column="sub_type" property="subType"/>
<result column="domain" property="domain"/>
<result column="child_sn" property="childSn"/>
<result column="workspace_id" property="workspaceId"/>
<result column="device_pro_number" property="proId"/>
<result column="device_nick_name" property="nickname"/>
8 months ago
</collection>
</resultMap>
<select id="listDeviceProEntityMap" resultMap="listDeviceProEntityMap">
SELECT
dp.id pro_id,
dp.pro_name,
dp.bind_code,
dp.bind_type,
dpu.user_id pro_user_id,
dpu.device_pro_id,
dpu.user_id,
dpu.nick_name,
d.id device_id,
d.device_sn,
d.device_name,
d.device_type,
d.sub_type,
d.domain,
d.child_sn,
d.workspace_id,
d.pro_id device_pro_number,
d.nickname device_nick_name
8 months ago
FROM
manage_device_pro dp
LEFT JOIN manage_device d ON dp.id = d.pro_id
LEFT JOIN manage_device_pro_user dpu ON dp.id = dpu.device_pro_id
8 months ago
<where>
<if test="condition.deviceSn != null and condition.deviceSn != ''">
and d.device_sn like concat(concat('%',#{condition.deviceSn}),'%')
8 months ago
</if>
<if test="condition.deviceName != null and condition.deviceName != ''">
and d.device_name like concat(concat('%',#{condition.deviceName}),'%')
8 months ago
</if>
<if test="condition.nickname != null and condition.nickname != ''">
and dpu.nickname like concat(concat('%',#{condition.nickname}),'%')
8 months ago
</if>
<if test="condition.userId != null and condition.userId != ''">
and dpu.user_id = #{condition.userId}
8 months ago
</if>
</where>
8 months ago
</select>
</mapper>