<?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.zcloud.mapper.datasource.safetyMeeting.SafetyMeetingPeopleMapper">

	<!--表名 -->
	<sql id="tableName">
		SAFETY_MEETING_PEOPLE
	</sql>

	<!--数据字典表名 -->
	<sql id="dicTableName">
		SYS_DICTIONARIES
	</sql>

	<!-- 字段 -->
	<sql id="Field">
		f.SAFETY_MEETING_PEOPLE_ID,
		f.SAFETY_MEETING_ID,
		f.USER_ID,
		f.DEPARTMENT_ID,
		f.POST_ID,
		f.FEED_BACK,
		f.CORPINFO_ID,
		f.CREATOR,
		f.CREATTIME,
		f.OPERATOR,
		f.OPERATTIME,
		f.ISDELETE
	</sql>

	<!-- 字段用于新增 -->
	<sql id="Field2">
		SAFETY_MEETING_PEOPLE_ID,
		SAFETY_MEETING_ID,
		DEPARTMENT_ID,
		POST_ID,
		USER_ID,
		FEED_BACK,
		CORPINFO_ID,
		CREATOR,
		CREATTIME,
		OPERATOR,
		OPERATTIME,
		ISDELETE
	</sql>

	<!-- 字段值 -->
	<sql id="FieldValue">
		#{SAFETY_MEETING_PEOPLE_ID},
		#{SAFETY_MEETING_ID},
		#{DEPARTMENT_ID},
		#{POST_ID},
		#{USER_ID},
		#{FEED_BACK},
		#{CORPINFO_ID},
		#{CREATOR},
		#{CREATTIME},
		#{OPERATOR},
		#{OPERATTIME},
		#{ISDELETE}
	</sql>
	<sql id="FieldValue2">
		#{item.SAFETY_MEETING_PEOPLE_ID},
		#{item.SAFETY_MEETING_ID},
		#{item.DEPARTMENT_ID},
		#{item.POST_ID},
		#{item.USER_ID},
		#{item.FEED_BACK},
		#{item.CORPINFO_ID},
		#{item.CREATOR},
		#{item.CREATTIME},
		#{item.OPERATOR},
		#{item.OPERATTIME},
		#{item.ISDELETE}
	</sql>
	<!-- 新增-->
	<insert id="save" parameterType="pd">
		insert into
	<include refid="tableName"></include>
		(
	<include refid="Field2"></include>
		) values (
	<include refid="FieldValue"></include>
		)
	</insert>
	<insert id="saveBatch">
		insert into <include refid="tableName"></include>
		(<include refid="Field2"></include>) values
		<foreach item="item" index="index" collection="list" separator="," >
			(<include refid="FieldValue2"></include>)
		</foreach>
	</insert>
	<update id="removeBySafetMeetingId">
		update
		<include refid="tableName"></include>
		set
		ISDELETE = '1',
		OPERATOR=#{OPERATOR},
		OPERATTIME=#{OPERATTIME}
		where
		SAFETY_MEETING_ID = #{SAFETY_MEETING_ID}
	</update>
	<update id="saveOrUpdateBatch">
		insert into <include refid="tableName"></include>
		(<include refid="Field2"></include>) values
		<foreach item="item" index="index" collection="list" separator="," >
			(<include refid="FieldValue2"></include>)
		</foreach>
		ON DUPLICATE KEY UPDATE `ISDELETE` = 0
	</update>
	<update id="removeBySafetMeetingUserFeedback">
		update
		<include refid="tableName"></include>
		set
		FEED_BACK = null
		where
		SAFETY_MEETING_ID = #{SAFETY_MEETING_ID} and ISDELETE = 1
	</update>

</mapper>
