<?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.smis.mapper.ShiftModelMapper">
|
<resultMap id="shiftMap" type="com.qianwen.smartman.modules.smis.vo.ShiftVO">
|
<id column="id" property="id"/>
|
<result column="code" property="code"/>
|
<result column="name" property="name"/>
|
<result column="shift_number" property="shiftNumber"/>
|
<result column="colour" property="colour"/>
|
<result column="start_time" property="startTime"/>
|
<result column="end_time" property="endTime"/>
|
<collection property="shiftDetailVOList" ofType="com.qianwen.smartman.modules.smis.vo.ShiftDetailVO">
|
<id column="shiftId" property="id"/>
|
<result column="shift_index" property="shiftIndex"/>
|
<result column="shift_start_time" property="shiftStartTime"/>
|
<result column="shift_end_time" property="shiftEndTime"/>
|
<result column="rest_number" property="restNumber"/>
|
<result column="index_name" property="indexName"/>
|
<collection property="shiftRestTimeVOList" ofType="com.qianwen.smartman.modules.smis.vo.ShiftRestTimeVO">
|
<id column="restId" property="id"/>
|
<result column="rest_start_time" property="restStartTime"/>
|
<result column="rest_end_time" property="restEndTime"/>
|
<result column="rest_index" property="restIndex"/>
|
</collection>
|
</collection>
|
</resultMap>
|
|
<!--查询班次模型详情-->
|
<select id="getShiftDetail" resultMap="shiftMap">
|
select
|
t1.id,t1.code,t1.name,t1.shift_number,t1.colour,t1.start_time,t1.end_time,
|
t2.id as shiftId,t2.shift_index,t2.shift_start_time,t2.shift_end_time,t2.rest_number,t2.index_name,
|
t3.id as restId,t3.rest_start_time,t3.rest_end_time,t3.rest_index
|
from blade_shift_model t1
|
left join blade_shift_detail t2 on t1.id = t2.model_id
|
LEFT JOIN blade_shift_rest_time t3 on t2.id = t3.shift_id
|
<where>
|
t1.id = #{modelId}
|
</where>
|
</select>
|
|
<!--根据租户id获取班次下标名称-->
|
<select id="getShiftIndexNameByTenantId" resultType="com.qianwen.smartman.modules.smis.entity.ShiftDetail">
|
select distinct t1.shift_index,
|
t1.index_name
|
from blade_shift_detail t1
|
left join blade_shift_model t2 on t1.model_id = t2.id
|
where t2.tenant_id = #{tenantId}
|
and t2.is_deleted = 0
|
and t2.status = 1
|
</select>
|
|
<select id="getShiftTime" resultType="com.qianwen.smartman.modules.smis.entity.ShiftDetail">
|
select t4.shift_start_time, t4.shift_end_time
|
from blade_shift_model t3
|
left join blade_shift_detail t4 on t3.id = t4.model_id
|
where t3.id = (select t2.model_id
|
from blade_production_calendar t1
|
left join blade_production_calendar_day t2 on t1.id = t2.calendar_id
|
where t1.year = #{year}
|
and t1.code = #{calendarCode}
|
and t1.tenant_id = #{tenantId}
|
and t1.is_deleted = 0
|
and t2.calendar_date = #{localDate})
|
and t4.shift_index = #{shiftIndex}
|
</select>
|
</mapper>
|