<?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.sxkj.system.mapper.DevicePerShareMapper">
|
|
<!--自定义分页查询-->
|
<select id="selectDevicePerSharePage" resultType="org.sxkj.system.vo.DevicePerShareVO">
|
SELECT
|
ddps.id,
|
ddps.device_sn,
|
ddps.loan_from_dept_id,
|
ddps.loan_to_dept_id as deptId,
|
ddps.create_time,
|
bd.dept_name as deptName
|
FROM
|
manage_device_per_share ddps
|
LEFT JOIN blade_dept bd ON bd.id = ddps.loan_to_dept_id AND bd.is_deleted = 0
|
<where>
|
<if test="devicePerShare.deptName!=null and devicePerShare.deptName!=''">
|
and bd.dept_name like concat('%',#{devicePerShare.deptName},'%')
|
</if>
|
<if test="devicePerShare.deviceSn!=null and devicePerShare.deviceSn!=''">
|
and ddps.device_sn = #{devicePerShare.deviceSn}
|
</if>
|
</where>
|
GROUP BY ddps.id
|
</select>
|
|
<select id="findActiveLoansByToDeptId" resultType="org.sxkj.system.entity.DevicePerShareEntity">
|
SELECT a.*,b.device_name
|
FROM manage_device_per_share a
|
LEFT JOIN manage_device b ON a.device_sn = b.device_sn
|
<where>
|
b.is_deleted = 0
|
<if test="param.nickname!=null and param.nickname!=''">
|
and b.nickname like concat('%',#{param.nickname},'%')
|
</if>
|
<if test="deptIdList!=null and deptIdList.size>0">
|
AND a.loan_to_dept_id IN
|
<foreach collection="deptIdList" index="index" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="param.hiddenFlag!=null">
|
and b.hidden_flag = #{param.hiddenFlag}
|
</if>
|
<if test="param.onlineStatus!=null and param.onlineStatus">
|
and b.mode_code != -1
|
</if>
|
</where>
|
</select>
|
|
<select id="findActiveLoansAreaCodeByToDeptId" resultType="java.lang.String">
|
SELECT b.area_code
|
FROM manage_device_per_share a
|
LEFT JOIN manage_device b ON a.device_sn = b.device_sn
|
<where>
|
b.is_deleted = 0
|
<if test="param.nickname!=null and param.nickname!=''">
|
and b.nickname like concat('%',#{param.nickname},'%')
|
</if>
|
<if test="deptIdList!=null and deptIdList.size>0">
|
AND a.loan_to_dept_id IN
|
<foreach collection="deptIdList" index="index" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="param.hiddenFlag!=null">
|
and b.hidden_flag = #{param.hiddenFlag}
|
</if>
|
<if test="param.onlineStatus!=null and param.onlineStatus">
|
and b.mode_code != -1
|
</if>
|
</where>
|
</select>
|
|
</mapper>
|