|
|
@ -4,11 +4,10 @@ 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_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="device_pro_id" property="deviceProId"/> |
|
|
@ -16,47 +15,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
|
<result column="nick_name" property="nickName"/> |
|
|
|
</collection> |
|
|
|
<collection property="deviceEntityList" ofType="org.dromara.sample.manage.model.entity.DeviceEntity"> |
|
|
|
<result column="id" property="id"/> |
|
|
|
<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"/> |
|
|
|
<result column="workspace_id" property="workspaceId"/> |
|
|
|
<result column="device_pro_number" property="proId"/> |
|
|
|
<result column="device_nick_name" property="nickname"/> |
|
|
|
</collection> |
|
|
|
</resultMap> |
|
|
|
<select id="listDeviceProEntityMap" resultMap="listDeviceProEntityMap"> |
|
|
|
SELECT |
|
|
|
dp.*, |
|
|
|
dpu.user_id, |
|
|
|
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, |
|
|
|
d.id device_id, |
|
|
|
d.device_sn, |
|
|
|
d.device_name, |
|
|
|
d.device_type, |
|
|
|
d.sub_type, |
|
|
|
d.domain, |
|
|
|
d.nickname, |
|
|
|
d.child_sn |
|
|
|
d.child_sn, |
|
|
|
d.workspace_id, |
|
|
|
d.pro_id device_pro_number, |
|
|
|
d.nickname device_nick_name |
|
|
|
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.pro_id |
|
|
|
LEFT JOIN manage_device_pro_user dpu ON dp.id = dpu.device_pro_id |
|
|
|
<where> |
|
|
|
<if test="condition.deviceSn != null and condition.deviceSn != ''"> |
|
|
|
or d.device_sn like concat(concat('%',#{condition.deviceSn}),'%') |
|
|
|
and d.device_sn like concat(concat('%',#{condition.deviceSn}),'%') |
|
|
|
</if> |
|
|
|
<if test="condition.deviceName != null and condition.deviceName != ''"> |
|
|
|
or d.device_name like concat(concat('%',#{condition.deviceName}),'%') |
|
|
|
and d.device_name like concat(concat('%',#{condition.deviceName}),'%') |
|
|
|
</if> |
|
|
|
<if test="condition.nickname != null and condition.nickname != ''"> |
|
|
|
or dpu.nickname like concat(concat('%',#{condition.nickname}),'%') |
|
|
|
and dpu.nickname like concat(concat('%',#{condition.nickname}),'%') |
|
|
|
</if> |
|
|
|
<if test="condition.userId != null and condition.userId != ''"> |
|
|
|
or dpu.user_id = #{condition.userId} |
|
|
|
and dpu.user_id = #{condition.userId} |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
</select> |
|
|
|