<?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.persagy.calendar.mapper.WorkCalendarLabelMapper">

	<resultMap id="BaseResultMap" type="com.persagy.calendar.pojo.dto.WorkCalendarLabel">
		<result column="CALENDAR_ID" property="calendarId" jdbcType="VARCHAR" />
		<result column="GROUP_CODE" property="groupCode" jdbcType="VARCHAR" />
		<result column="PROJECT_ID" property="projectId" jdbcType="VARCHAR" />
		<result column="LABEL_DATE" property="labelDate" jdbcType="VARCHAR" />
		<result column="DICT_TYPE" property="dictType" jdbcType="VARCHAR" />
		<result column="DICT_CODE" property="dictCode" jdbcType="VARCHAR" />
		<result column="DIY_LABEL" property="diyLabel" jdbcType="VARCHAR" />
		<result column="DIY_VALUE" property="diyValue" jdbcType="VARCHAR" 
			typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler" />
		<result column="CREATE_TIME" property="createTime" jdbcType="VARCHAR" />
		<result column="UPDATE_TIME" property="updateTime" jdbcType="VARCHAR" />
		<result column="UPDATE_USER" property="updateUser" jdbcType="VARCHAR" />
	</resultMap>

	<insert id="batchCreateCalendarLabel">
		INSERT INTO work_calendar_label
		(
			ID, CALENDAR_ID, GROUP_CODE, PROJECT_ID, LABEL_DATE, DICT_TYPE, DICT_CODE, DIY_LABEL, DIY_VALUE, 
			CREATE_TIME, UPDATE_TIME, UPDATE_USER
		) VALUES
		<foreach collection="labels" index="index" item="label" separator="," >
		(
			#{label.id}, #{label.calendarId}, #{label.groupCode}, #{label.projectId}, #{label.labelDate}, 
			#{label.dictType},#{label.dictCode}, #{label.diyLabel}, #{label.diyValueStr},
			#{label.createTime}, #{label.updateTime}, #{label.updateUser}
		)
		</foreach>
	</insert>
		
</mapper>