<?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.xintong.visualinspection.dao.master.UserClassDao" >
   
   
   <insert id="insert" parameterType="com.xintong.visualinspection.bean.UserClass">
   		INSERT INTO
        sys_user_class
        (work_date,dept_id,user_id,class_type,team_id,start_time,end_time,lane)
        VALUES
        (#{work_date},#{dept_id},#{user_id},#{class_type},#{team_id},#{start_time},#{end_time},#{lane})
   </insert>
   
   <select id="selectList" parameterType="com.xintong.visualinspection.bean.UserClass" resultType="com.xintong.visualinspection.bean.UserClass" >
   		SELECT * from sys_user_class where work_date = #{work_date} and dept_id=#{dept_id} order by class_type asc , lane asc
   </select>
   
   <delete id="delete" parameterType="com.xintong.visualinspection.bean.UserClass">
   		DELETE FROM
        sys_user_class
        WHERE
        work_date =#{work_date} and dept_id=#{dept_id}
   </delete>
   
   <select id="getUsersByTeamId" parameterType="java.lang.Integer" resultType="String"  >
        SELECT user_ids
        FROM sys_team
        WHERE id = 
		        (	SELECT team_id
		        	FROM sys_user_class
		        	where id = #{user_class_id}
	        	)
    </select>
</mapper>