徐州低空平台
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.

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