<?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="com.qianwen.smartman.modules.trace.mapper.TraceCatalogMapper">
|
|
<select id="traceCatalogPage" resultType="com.qianwen.smartman.modules.trace.entity.TraceCatalog">
|
select
|
tc.id,
|
tc.part_no,
|
tc.batch_number,
|
tc.online_time,
|
tc.offline_time,
|
tc.qualified,
|
tc.is_rework_part,
|
tc.shift_index,
|
tc.shift_index_name,
|
tc.plan_id,
|
tc.trace_status,
|
tc.workstation_group_id
|
from blade_trace_catalog tc
|
<where>
|
<if test="searchVO.keywords != null and searchVO.keywords != ''">
|
(tc.part_no like concat(#{searchVO.keywords},'%') or tc.batch_number like concat(#{searchVO.keywords},'%') )
|
</if>
|
<if test="searchVO.workstationId != null and searchVO.workstationId != ''">
|
AND exists ( select * from blade_trace_flow_record tfr where tfr.part_no=tc.part_no and tfr.workstation_id = #{searchVO.workstationId} )
|
</if>
|
<if test="searchVO.workstationGroupIds != null and searchVO.workstationGroupIds.size() > 0 ">
|
AND tc.workstation_group_id in
|
<foreach collection="searchVO.workstationGroupIds" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</if>
|
<if test="searchVO.onlineStartTime != null and searchVO.onlineEndTime != null">
|
and tc.online_time between #{searchVO.onlineStartTime} and #{searchVO.onlineEndTime}
|
</if>
|
<if test="searchVO.offlineStartTime != null and searchVO.offlineEndTime != null">
|
and tc.offline_time between #{searchVO.offlineStartTime} and #{searchVO.offlineEndTime}
|
</if>
|
</where>
|
order by tc.online_time desc
|
</select>
|
<select id="countRelatedCatalog" resultType="java.lang.Long"
|
parameterType="com.qianwen.smartman.modules.trace.vo.TraceCatalogSearchVO">
|
select
|
count(*)
|
from blade_trace_catalog tc
|
<where>
|
<if test="searchVO.keywords != null and searchVO.keywords != ''">
|
(tc.part_no like concat(#{searchVO.keywords},'%') or tc.batch_number like concat(#{searchVO.keywords},'%') )
|
</if>
|
<if test="searchVO.workstationId != null and searchVO.workstationId != ''">
|
AND exists ( select * from blade_trace_flow_record tfr where tfr.part_no=tc.part_no and tfr.workstation_id = #{searchVO.workstationId} )
|
</if>
|
<if test="searchVO.workstationGroupIds != null and searchVO.workstationGroupIds.size() > 0 ">
|
AND tc.workstation_group_id in
|
<foreach collection="searchVO.workstationGroupIds" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</if>
|
<if test="searchVO.onlineStartTime != null and searchVO.onlineEndTime != null">
|
and tc.online_time between #{searchVO.onlineStartTime} and #{searchVO.onlineEndTime}
|
</if>
|
<if test="searchVO.offlineStartTime != null and searchVO.offlineEndTime != null">
|
and tc.offline_time between #{searchVO.offlineStartTime} and #{searchVO.offlineEndTime}
|
</if>
|
</where>
|
</select>
|
</mapper>
|