forked from dyf/fys-Multi-tenant
WEB:导出数据设备
This commit is contained in:
@ -38,10 +38,7 @@
|
||||
|
||||
<!-- 分页查询设备 -->
|
||||
<select id="findAll" resultType="com.fuyuanshen.equipment.domain.Device">
|
||||
select
|
||||
d.id,d.device_name,
|
||||
d.device_pic, d.device_mac, d.device_sn, d.update_by,d.device_imei,
|
||||
d.update_time, d.device_type, d.remark, d.binding_status,t.type_name
|
||||
select d.* ,t.type_name
|
||||
FROM device d
|
||||
LEFT JOIN device_type t ON d.device_type = t.id
|
||||
<where>
|
||||
@ -73,68 +70,6 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="findAll1" resultType="com.fuyuanshen.equipment.domain.Device">
|
||||
SELECT
|
||||
d.id, d.customer_id, d.customer_name, d.device_name,
|
||||
d.device_pic, d.device_mac, d.device_sn, d.create_by, d.update_by,
|
||||
d.create_time, d.update_time, d.device_type, d.remark, d.device_status, t.type_name
|
||||
from device d
|
||||
left join device_type t
|
||||
on d.device_type = t.id
|
||||
<where>
|
||||
<!-- 时间范围等其他条件保持原样 -->
|
||||
<if test="criteria.deviceName != null and criteria.deviceName.trim() != ''">
|
||||
and d.device_name like concat('%', TRIM(#{criteria.deviceName}), '%')
|
||||
</if>
|
||||
<if test="criteria.deviceMac != null">
|
||||
and d.device_mac = #{criteria.deviceMac}
|
||||
</if>
|
||||
<if test="criteria.deviceSn != null">
|
||||
and d.device_sn = #{criteria.deviceSn}
|
||||
</if>
|
||||
<if test="criteria.deviceType != null">
|
||||
and d.device_type = #{criteria.deviceType}
|
||||
</if>
|
||||
<if test="criteria.createTime != null and criteria.createTime.size() != 0">
|
||||
and d.create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
|
||||
</if>
|
||||
|
||||
<!-- 将两个客户相关条件合并成一个逻辑组 -->
|
||||
<if test="criteria.customerId != null or (criteria.customerIds != null and !criteria.customerIds.isEmpty())">
|
||||
AND (
|
||||
<!-- 条件1: 用户或其下属创建,且 customer_id 为空 -->
|
||||
<if test="criteria.customerId != null">
|
||||
d.create_by IN (
|
||||
SELECT username FROM sys_user
|
||||
WHERE user_id = #{criteria.customerId} OR pid = #{criteria.customerId}
|
||||
) AND d.customer_id IS NULL
|
||||
</if>
|
||||
|
||||
<!-- 如果前面的条件不存在,则只保留第二个条件 -->
|
||||
<choose>
|
||||
<when test="criteria.customerId != null and (criteria.customerIds != null and !criteria.customerIds.isEmpty())">
|
||||
OR
|
||||
</when>
|
||||
<when test="criteria.customerId == null and (criteria.customerIds != null and !criteria.customerIds.isEmpty())">
|
||||
<!-- 仅当第一个条件不存在时才开始括号 -->
|
||||
</when>
|
||||
</choose>
|
||||
|
||||
<!-- 条件2: 客户ID在列表中 -->
|
||||
<if test="criteria.customerIds != null and !criteria.customerIds.isEmpty()">
|
||||
(d.customer_id IN
|
||||
<foreach item="customerId" collection="criteria.customerIds" open="(" separator="," close=")">
|
||||
#{customerId}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
|
||||
order by d.id desc
|
||||
</select>
|
||||
|
||||
<select id="findAllDevices" resultType="com.fuyuanshen.equipment.domain.Device">
|
||||
select
|
||||
d.id, d.customer_id, d.device_name,
|
||||
|
Reference in New Issue
Block a user