You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

570 lines
27 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="com.foreverwin.mesnac.dispatch.mapper.ProductionCalendarMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.dispatch.model.ProductionCalendar">
<id column="HANDLE" property="handle"/>
<result column="SITE" property="site"/>
<result column="WORK_CENTER" property="workCenter"/>
<result column="YEAR_ID" property="yearId"/>
<result column="MONTH_ID" property="monthId"/>
<result column="DATE_ID" property="dateId"/>
<result column="PRODUCTION_DAY_TYPE_BO" property="productionDayTypeBo"/>
<result column="CREATED_DATE_TIME" property="createdDateTime"/>
<result column="MODIFIED_DATE_TIME" property="modifiedDateTime"/>
<result column="CREATOR" property="creator"/>
<result column="UPDATER" property="updater"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, WORK_CENTER, YEAR_ID, MONTH_ID, DATE_ID, PRODUCTION_DAY_TYPE_BO, CREATED_DATE_TIME,
MODIFIED_DATE_TIME, CREATOR, UPDATER
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_PRODUCTION_CALENDAR WHERE HANDLE=#{handle}
</select>
<select id="selectByMap" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"></include>
FROM Z_PRODUCTION_CALENDAR
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</select>
<select id="selectBatchIds" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"></include>
FROM Z_PRODUCTION_CALENDAR WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</select>
<select id="selectOne" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_PRODUCTION_CALENDAR
<where>
<if test="ew.handle!=null">
HANDLE=#{ew.handle}
</if>
<if test="ew.site!=null">AND SITE=#{ew.site}</if>
<if test="ew.workCenter!=null">AND WORK_CENTER=#{ew.workCenter}</if>
<if test="ew.yearId!=null">AND YEAR_ID=#{ew.yearId}</if>
<if test="ew.monthId!=null">AND MONTH_ID=#{ew.monthId}</if>
<if test="ew.dateId!=null">AND DATE_ID=#{ew.dateId}</if>
<if test="ew.productionDayTypeBo!=null">AND PRODUCTION_DAY_TYPE_BO=#{ew.productionDayTypeBo}</if>
<if test="ew.createdDateTime!=null">AND CREATED_DATE_TIME=#{ew.createdDateTime}</if>
<if test="ew.modifiedDateTime!=null">AND MODIFIED_DATE_TIME=#{ew.modifiedDateTime}</if>
<if test="ew.creator!=null">AND CREATOR=#{ew.creator}</if>
<if test="ew.updater!=null">AND UPDATER=#{ew.updater}</if>
</where>
</select>
<select id="selectCount" resultType="Integer">
SELECT COUNT(1) FROM Z_PRODUCTION_CALENDAR
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null">AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null">AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.yearId!=null">AND YEAR_ID=#{ew.entity.yearId}</if>
<if test="ew.entity.monthId!=null">AND MONTH_ID=#{ew.entity.monthId}</if>
<if test="ew.entity.dateId!=null">AND DATE_ID=#{ew.entity.dateId}</if>
<if test="ew.entity.productionDayTypeBo!=null">AND
PRODUCTION_DAY_TYPE_BO=#{ew.entity.productionDayTypeBo}
</if>
<if test="ew.entity.createdDateTime!=null">AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null">AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}
</if>
<if test="ew.entity.creator!=null">AND CREATOR=#{ew.entity.creator}</if>
<if test="ew.entity.updater!=null">AND UPDATER=#{ew.entity.updater}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectList" resultMap="BaseResultMap">
SELECT
<choose>
<when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when>
<otherwise>
<include refid="Base_Column_List"></include>
</otherwise>
</choose>
FROM Z_PRODUCTION_CALENDAR
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null">AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null">AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.yearId!=null">AND YEAR_ID=#{ew.entity.yearId}</if>
<if test="ew.entity.monthId!=null">AND MONTH_ID=#{ew.entity.monthId}</if>
<if test="ew.entity.dateId!=null">AND DATE_ID=#{ew.entity.dateId}</if>
<if test="ew.entity.productionDayTypeBo!=null">AND
PRODUCTION_DAY_TYPE_BO=#{ew.entity.productionDayTypeBo}
</if>
<if test="ew.entity.createdDateTime!=null">AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null">AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}
</if>
<if test="ew.entity.creator!=null">AND CREATOR=#{ew.entity.creator}</if>
<if test="ew.entity.updater!=null">AND UPDATER=#{ew.entity.updater}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMaps" resultType="HashMap">
SELECT
<choose>
<when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when>
<otherwise>
<include refid="Base_Column_List"></include>
</otherwise>
</choose>
FROM Z_PRODUCTION_CALENDAR
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null">AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null">AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.yearId!=null">AND YEAR_ID=#{ew.entity.yearId}</if>
<if test="ew.entity.monthId!=null">AND MONTH_ID=#{ew.entity.monthId}</if>
<if test="ew.entity.dateId!=null">AND DATE_ID=#{ew.entity.dateId}</if>
<if test="ew.entity.productionDayTypeBo!=null">AND
PRODUCTION_DAY_TYPE_BO=#{ew.entity.productionDayTypeBo}
</if>
<if test="ew.entity.createdDateTime!=null">AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null">AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}
</if>
<if test="ew.entity.creator!=null">AND CREATOR=#{ew.entity.creator}</if>
<if test="ew.entity.updater!=null">AND UPDATER=#{ew.entity.updater}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectObjs" resultType="Object">
SELECT
<choose>
<when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when>
<otherwise>
<include refid="Base_Column_List"></include>
</otherwise>
</choose>
FROM Z_PRODUCTION_CALENDAR
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null">AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null">AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.yearId!=null">AND YEAR_ID=#{ew.entity.yearId}</if>
<if test="ew.entity.monthId!=null">AND MONTH_ID=#{ew.entity.monthId}</if>
<if test="ew.entity.dateId!=null">AND DATE_ID=#{ew.entity.dateId}</if>
<if test="ew.entity.productionDayTypeBo!=null">AND
PRODUCTION_DAY_TYPE_BO=#{ew.entity.productionDayTypeBo}
</if>
<if test="ew.entity.createdDateTime!=null">AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null">AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}
</if>
<if test="ew.entity.creator!=null">AND CREATOR=#{ew.entity.creator}</if>
<if test="ew.entity.updater!=null">AND UPDATER=#{ew.entity.updater}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectPage" resultMap="BaseResultMap">
SELECT
<choose>
<when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when>
<otherwise>
<include refid="Base_Column_List"></include>
</otherwise>
</choose>
FROM Z_PRODUCTION_CALENDAR
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null">AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null">AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.yearId!=null">AND YEAR_ID=#{ew.entity.yearId}</if>
<if test="ew.entity.monthId!=null">AND MONTH_ID=#{ew.entity.monthId}</if>
<if test="ew.entity.dateId!=null">AND DATE_ID=#{ew.entity.dateId}</if>
<if test="ew.entity.productionDayTypeBo!=null">AND
PRODUCTION_DAY_TYPE_BO=#{ew.entity.productionDayTypeBo}
</if>
<if test="ew.entity.createdDateTime!=null">AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null">AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}
</if>
<if test="ew.entity.creator!=null">AND CREATOR=#{ew.entity.creator}</if>
<if test="ew.entity.updater!=null">AND UPDATER=#{ew.entity.updater}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMapsPage" resultType="HashMap">
SELECT
<choose>
<when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when>
<otherwise>
<include refid="Base_Column_List"></include>
</otherwise>
</choose>
FROM Z_PRODUCTION_CALENDAR
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null">AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null">AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.yearId!=null">AND YEAR_ID=#{ew.entity.yearId}</if>
<if test="ew.entity.monthId!=null">AND MONTH_ID=#{ew.entity.monthId}</if>
<if test="ew.entity.dateId!=null">AND DATE_ID=#{ew.entity.dateId}</if>
<if test="ew.entity.productionDayTypeBo!=null">AND
PRODUCTION_DAY_TYPE_BO=#{ew.entity.productionDayTypeBo}
</if>
<if test="ew.entity.createdDateTime!=null">AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null">AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}
</if>
<if test="ew.entity.creator!=null">AND CREATOR=#{ew.entity.creator}</if>
<if test="ew.entity.updater!=null">AND UPDATER=#{ew.entity.updater}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<insert id="insert" parameterType="com.foreverwin.mesnac.dispatch.model.ProductionCalendar">
INSERT INTO Z_PRODUCTION_CALENDAR
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="site!=null">SITE,</if>
<if test="workCenter!=null">WORK_CENTER,</if>
<if test="yearId!=null">YEAR_ID,</if>
<if test="monthId!=null">MONTH_ID,</if>
<if test="dateId!=null">DATE_ID,</if>
<if test="productionDayTypeBo!=null">PRODUCTION_DAY_TYPE_BO,</if>
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
<if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
<if test="creator!=null">CREATOR,</if>
<if test="updater!=null">UPDATER,</if>
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="site!=null">#{site},</if>
<if test="workCenter!=null">#{workCenter},</if>
<if test="yearId!=null">#{yearId},</if>
<if test="monthId!=null">#{monthId},</if>
<if test="dateId!=null">#{dateId},</if>
<if test="productionDayTypeBo!=null">#{productionDayTypeBo},</if>
<if test="createdDateTime!=null">#{createdDateTime},</if>
<if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
<if test="creator!=null">#{creator},</if>
<if test="updater!=null">#{updater},</if>
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.dispatch.model.ProductionCalendar">
INSERT INTO Z_PRODUCTION_CALENDAR
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{site},
#{workCenter},
#{yearId},
#{monthId},
#{dateId},
#{productionDayTypeBo},
#{createdDateTime},
#{modifiedDateTime},
#{creator},
#{updater},
</trim>
</insert>
<update id="updateById">
UPDATE Z_PRODUCTION_CALENDAR
<trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.workCenter!=null">WORK_CENTER=#{et.workCenter},</if>
<if test="et.yearId!=null">YEAR_ID=#{et.yearId},</if>
<if test="et.monthId!=null">MONTH_ID=#{et.monthId},</if>
<if test="et.dateId!=null">DATE_ID=#{et.dateId},</if>
<if test="et.productionDayTypeBo!=null">PRODUCTION_DAY_TYPE_BO=#{et.productionDayTypeBo},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
<if test="et.creator!=null">CREATOR=#{et.creator},</if>
<if test="et.updater!=null">UPDATER=#{et.updater},</if>
</trim>
WHERE HANDLE=#{et.handle}
<if test="et instanceof java.util.Map">
<if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and
${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}
</if>
</if>
</update>
<update id="updateAllColumnById">
UPDATE Z_PRODUCTION_CALENDAR <trim prefix="SET" suffixOverrides=",">
SITE=#{et.site},
WORK_CENTER=#{et.workCenter},
YEAR_ID=#{et.yearId},
MONTH_ID=#{et.monthId},
DATE_ID=#{et.dateId},
PRODUCTION_DAY_TYPE_BO=#{et.productionDayTypeBo},
CREATED_DATE_TIME=#{et.createdDateTime},
MODIFIED_DATE_TIME=#{et.modifiedDateTime},
CREATOR=#{et.creator},
UPDATER=#{et.updater},
</trim> WHERE HANDLE=#{et.handle}
<if test="et instanceof java.util.Map">
<if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and
${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}
</if>
</if>
</update>
<update id="update">
UPDATE Z_PRODUCTION_CALENDAR
<trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.workCenter!=null">WORK_CENTER=#{et.workCenter},</if>
<if test="et.yearId!=null">YEAR_ID=#{et.yearId},</if>
<if test="et.monthId!=null">MONTH_ID=#{et.monthId},</if>
<if test="et.dateId!=null">DATE_ID=#{et.dateId},</if>
<if test="et.productionDayTypeBo!=null">PRODUCTION_DAY_TYPE_BO=#{et.productionDayTypeBo},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
<if test="et.creator!=null">CREATOR=#{et.creator},</if>
<if test="et.updater!=null">UPDATER=#{et.updater},</if>
</trim>
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
HANDLE=#{ew.entity.handle}
<if test="ew.entity.site!=null">AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null">AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.yearId!=null">AND YEAR_ID=#{ew.entity.yearId}</if>
<if test="ew.entity.monthId!=null">AND MONTH_ID=#{ew.entity.monthId}</if>
<if test="ew.entity.dateId!=null">AND DATE_ID=#{ew.entity.dateId}</if>
<if test="ew.entity.productionDayTypeBo!=null">AND
PRODUCTION_DAY_TYPE_BO=#{ew.entity.productionDayTypeBo}
</if>
<if test="ew.entity.createdDateTime!=null">AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null">AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}
</if>
<if test="ew.entity.creator!=null">AND CREATOR=#{ew.entity.creator}</if>
<if test="ew.entity.updater!=null">AND UPDATER=#{ew.entity.updater}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</update>
<delete id="deleteById">
DELETE FROM Z_PRODUCTION_CALENDAR WHERE HANDLE=#{handle}
</delete>
<delete id="deleteByMap">
DELETE FROM Z_PRODUCTION_CALENDAR
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</delete>
<delete id="delete">
DELETE FROM Z_PRODUCTION_CALENDAR
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null">AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.workCenter!=null">AND WORK_CENTER=#{ew.entity.workCenter}</if>
<if test="ew.entity.yearId!=null">AND YEAR_ID=#{ew.entity.yearId}</if>
<if test="ew.entity.monthId!=null">AND MONTH_ID=#{ew.entity.monthId}</if>
<if test="ew.entity.dateId!=null">AND DATE_ID=#{ew.entity.dateId}</if>
<if test="ew.entity.productionDayTypeBo!=null">AND
PRODUCTION_DAY_TYPE_BO=#{ew.entity.productionDayTypeBo}
</if>
<if test="ew.entity.createdDateTime!=null">AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
<if test="ew.entity.modifiedDateTime!=null">AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}
</if>
<if test="ew.entity.creator!=null">AND CREATOR=#{ew.entity.creator}</if>
<if test="ew.entity.updater!=null">AND UPDATER=#{ew.entity.updater}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</delete>
<delete id="deleteBatchIds">
DELETE FROM Z_PRODUCTION_CALENDAR WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
<resultMap id="ResultMapWithDayType" extends="BaseResultMap"
type="com.foreverwin.mesnac.dispatch.dto.ProductionCalendarDTO">
<result column="PRODUCTION_DAY_TYPE" property="productionDayType"/>
<result column="COLOR" property="color"/>
</resultMap>
<resultMap id="WorkCenterWorkTimeResultMap" extends="BaseResultMap"
type="com.foreverwin.mesnac.dispatch.dto.WorkCenterWorkTimeDTO">
<result column="WORK_CENTER" property="workCenter"/>
<result column="YEAR_ID" property="yearId"/>
<result column="MONTH_ID" property="monthId"/>
<result column="DATE_ID" property="dateId"/>
<result column="PRODUCTION_DAY_TYPE" property="productionDayType"/>
<result column="START_TIME" property="startTime"/>
<result column="END_TIME" property="endTime"/>
</resultMap>
<select id="listByWorkCenterYearMonth" resultMap="ResultMapWithDayType">
SELECT APC.*, APDT.PRODUCTION_DAY_TYPE, APDT.COLOR
FROM Z_PRODUCTION_CALENDAR APC
INNER JOIN Z_PRODUCTION_DAY_TYPE APDT
ON APC.PRODUCTION_DAY_TYPE_BO = APDT.HANDLE
WHERE APC.SITE = #{site}
AND APC.WORK_CENTER = #{workCenter}
AND APC.YEAR_ID = #{year}
AND APC.MONTH_ID = #{month}
ORDER BY DATE_ID
</select>
<select id="listWorkCenterWorkTimeByDateRange" resultMap="WorkCenterWorkTimeResultMap">
SELECT APC.WORK_CENTER, APC.YEAR_ID, APC.MONTH_ID, APC.DATE_ID, APDT.PRODUCTION_DAY_TYPE, WS.START_TIME,
WS.END_TIME
FROM Z_PRODUCTION_CALENDAR APC
INNER JOIN Z_PRODUCTION_DAY_TYPE APDT
ON APC.PRODUCTION_DAY_TYPE_BO = APDT.HANDLE
LEFT JOIN Z_WORK_SHIFT WS
ON WS.PRODUCTION_DAY_TYPE_BO = APDT.HANDLE
WHERE APC.SITE = #{site}
AND APC.WORK_CENTER = #{workCenter}
AND APC.DATE_ID >= #{startDate}
AND APC.DATE_ID &lt;= #{endDate}
ORDER BY APC.DATE_ID, WS.START_TIME
</select>
<select id="listWorkTimeByRange" resultMap="WorkCenterWorkTimeResultMap">
SELECT APC.WORK_CENTER, APC.YEAR_ID, APC.MONTH_ID, APC.DATE_ID, APDT.PRODUCTION_DAY_TYPE, WS.START_TIME,
WS.END_TIME
FROM Z_PRODUCTION_CALENDAR APC
INNER JOIN Z_PRODUCTION_DAY_TYPE APDT
ON APC.PRODUCTION_DAY_TYPE_BO = APDT.HANDLE
LEFT JOIN Z_WORK_SHIFT WS
ON WS.PRODUCTION_DAY_TYPE_BO = APDT.HANDLE
WHERE APC.SITE = #{site}
AND APC.DATE_ID >= #{startDate}
AND APC.DATE_ID &lt;= #{endDate}
ORDER BY APC.DATE_ID, WS.START_TIME
</select>
<select id="listWorkTime" resultMap="WorkCenterWorkTimeResultMap">
SELECT APC.WORK_CENTER, APC.YEAR_ID, APC.MONTH_ID, APC.DATE_ID, APDT.PRODUCTION_DAY_TYPE, WS.START_TIME,
WS.END_TIME
FROM Z_PRODUCTION_CALENDAR APC
INNER JOIN Z_PRODUCTION_DAY_TYPE APDT
ON APC.PRODUCTION_DAY_TYPE_BO = APDT.HANDLE
LEFT JOIN Z_WORK_SHIFT WS
ON WS.PRODUCTION_DAY_TYPE_BO = APDT.HANDLE
WHERE APC.SITE = #{site}
AND APC.WORK_CENTER IN
<foreach collection="workCenterList" item="workCenter" index="index" open="(" close=")" separator=",">
#{workCenter}
</foreach>
AND APC.DATE_ID >= #{startDate}
AND APC.DATE_ID &lt;= #{endDate}
ORDER BY APC.DATE_ID, WS.START_TIME
</select>
</mapper>