| | |
| | | |
| | | <select id="selectFwDevicePage" resultMap="fwDeviceResultMap"> |
| | | select |
| | | * |
| | | * |
| | | from |
| | | ja_fw_device |
| | | ja_fw_device |
| | | <where> |
| | | is_deleted = 0 |
| | | is_deleted = 0 |
| | | <if test="param2.id != null and param2.id != ''"> |
| | | and id = #{param2.id} |
| | | and id::text = #{param2.id}::text |
| | | </if> |
| | | <if test="param2.deviceName != null and param2.deviceName != ''"> |
| | | and device_name like concat('%',#{param2.deviceName},'%') |
| | | </if> |
| | | <if test="param2.deviceType != null and param2.deviceType != ''"> |
| | | and device_type = #{param2.deviceType} |
| | | and device_type::text = #{param2.deviceType}::text |
| | | </if> |
| | | <if test="param2.deviceModel != null and param2.deviceModel != ''"> |
| | | and device_model = #{param2.deviceModel} |
| | |
| | | and belong_dept = #{param2.belongDept} |
| | | </if> |
| | | <if test="param2.deviceStatusList != null and param2.deviceStatusList != ''"> |
| | | and status in |
| | | and status::text in |
| | | <foreach item="item" collection="param2.deviceStatusList" separator="," open="(" close=")" index=""> |
| | | #{item} |
| | | #{item}::text |
| | | </foreach> |
| | | </if> |
| | | <if test="param2.status != null"> |
| | | and status = #{param2.status} |
| | | and status::text = #{param2.status}::text |
| | | </if> |
| | | <if test="param2.isTrack != null and param2.isTrack == 1"> |
| | | and (SELECT COUNT(*) FROM ja_fw_device_track tmp WHERE ja_fw_device.id::VARCHAR = tmp.device_id::VARCHAR) > 0 |
| | | and (SELECT COUNT(*) FROM ja_fw_device_track tmp WHERE ja_fw_device.id::text = tmp.device_id::text) > 0 |
| | | </if> |
| | | <if test="param2.isTrack != null and param2.isTrack == 2"> |
| | | and (SELECT COUNT(*) FROM ja_fw_device_track tmp WHERE ja_fw_device.id::VARCHAR = tmp.device_id::VARCHAR) = 0 |
| | | and (SELECT COUNT(*) FROM ja_fw_device_track tmp WHERE ja_fw_device.id::text = tmp.device_id::text) = 0 |
| | | </if> |
| | | <if test="param2.deptList != null and param2.deptList.size > 0"> |
| | | and ( create_dept in |
| | | and ( create_dept::text in |
| | | <foreach collection="param2.deptList" item="deptId" open="(" separator="," close=")"> |
| | | #{deptId} |
| | | #{deptId}::text |
| | | </foreach> |
| | | <!-- 或者设备是共享给当前部门的 --> |
| | | <if test="param2.currentDeptId != null and param2.currentDeptId != '' "> |
| | | or id in ( |
| | | SELECT device_id FROM ja_fw_device_per_share |
| | | WHERE loan_to_dept_id = #{param2.currentDeptId} |
| | | WHERE |
| | | loan_to_dept_id = #{param2.currentDeptId}::bigint |
| | | AND is_deleted = 0 |
| | | ) |
| | | </if> |
| | |
| | | </if> |
| | | </where> |
| | | order by |
| | | create_time desc |
| | | create_time desc |
| | | </select> |
| | | |
| | | <select id="selectFwDeviceList" resultMap="fwDeviceResultMap"> |