<?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.yida.data.user.mapper.EduFaceGroupStrategyPlanMapper">
	
	<resultMap id="planMap" type="com.yida.data.user.vo.StrategyPlanVO">
		<id column="id" property="planId"/>
		<result column="face_group_id" property="faceGroupId"/>
		<result column="face_group_strategy_id" property="faceGroupStrategyId"/>
		<result column="unique_code" property="uniqueCode"/>
		
		<collection property="planTimeList" ofType="com.yida.data.user.vo.StrategyPlanTimeVO"
				select="listStrategyPlanTime"
				column="{planId=id}">
		</collection>
	</resultMap>
	
	<!-- 查询人脸组-策略-通行计划 -->
	<select id="listStrategyPlan" resultMap="planMap">
		SELECT
			id,
			face_group_id,
			face_group_strategy_id,
			unique_code
		FROM
			edu_face_group_strategy_plan
		WHERE
			face_group_strategy_id = #{strategyId}
		  AND del_flag = 0
	</select>
	
	<!-- 查询人脸组-策略-通行计划-时间段 -->
	<select id="listStrategyPlanTime" resultType="com.yida.data.user.vo.StrategyPlanTimeVO">
		SELECT
			face_group_id,
			face_group_strategy_id,
			face_group_strategy_plan_id,
			plan_start_time,
			plan_end_time
		FROM
			edu_face_group_strategy_plan_time
		WHERE
			face_group_strategy_plan_id = #{planId}
		  AND del_flag = 0
	</select>
	
</mapper>
