58 lines
2.4 KiB
XML
58 lines
2.4 KiB
XML
<?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="net.lab1024.sa.admin.module.business.device.dao.DeviceDao">
|
|
<update id="batchUpdateDeleted">
|
|
update t_device
|
|
WHERE id IN
|
|
<foreach collection="deviceIdList" open="(" close=")" separator="," item="item">
|
|
#{item}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 分页 查询商品 -->
|
|
<select id="query" resultType="net.lab1024.sa.admin.module.business.device.domain.entity.DeviceEntity">
|
|
SELECT d.*, r.name distributorName FROM t_device d left join t_distributor r on d.distributor_id = r.id
|
|
<if test="query.userId != null and query.userId !=''">
|
|
left join t_user_device ud on d.id = ud.device_id
|
|
</if>
|
|
where 1 = 1
|
|
<if test="query.searchWord != null and query.searchWord !=''">
|
|
AND (
|
|
INSTR(d.device_id,#{query.searchWord})
|
|
OR INSTR(d.device_name,#{query.searchWord})
|
|
OR INSTR(r.name,#{query.searchWord})
|
|
)
|
|
</if>
|
|
<if test="query.deviceIds != null and query.deviceIds !=''">
|
|
AND d.id IN
|
|
<foreach collection="query.deviceIds" open="(" close=")" separator="," item="item">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="query.distributorId != null and query.distributorId != ''">
|
|
AND d.distributor_id = #{query.distributorId}
|
|
</if>
|
|
<if test="query.userId != null and query.userId !=''">
|
|
AND ud.type = 1 AND ud.user_id = #{query.userId}
|
|
</if>
|
|
<if test="query.sortItemList == null or query.sortItemList.size == 0">
|
|
ORDER BY id DESC
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<!-- 查询我的设备 -->
|
|
<select id="getMyList" resultType="net.lab1024.sa.admin.module.business.device.domain.vo.DeviceVO">
|
|
SELECT d.*, ud.type FROM t_device d left join t_user_device ud on d.id = ud.device_id
|
|
where 1 = 1
|
|
<if test="query.userId != null and query.userId !=''">
|
|
AND ud.user_id = #{query.userId}
|
|
</if>
|
|
<if test="query.searchWord != null and query.searchWord !=''">
|
|
AND INSTR(d.device_name,#{query.searchWord})
|
|
</if>
|
|
<if test="query.sortItemList == null or query.sortItemList.size == 0">
|
|
ORDER BY id DESC
|
|
</if>
|
|
</select>
|
|
</mapper> |