|  | @@ -0,0 +1,161 @@
 | 
	
		
			
				|  |  | +<?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.keao.edu.user.dao.ExaminationBasicDao">
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +	<resultMap type="com.keao.edu.user.entity.ExaminationBasic" id="ExaminationBasic">
 | 
	
		
			
				|  |  | +		<result column="id_" property="id" />
 | 
	
		
			
				|  |  | +		<result column="name_" property="name" />
 | 
	
		
			
				|  |  | +		<result column="exam_mode_" property="examMode" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler" />
 | 
	
		
			
				|  |  | +		<result column="exam_location_id_list_" property="examLocationIdList" />
 | 
	
		
			
				|  |  | +		<result column="status_" property="status" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler" />
 | 
	
		
			
				|  |  | +		<result column="enroll_start_time_" property="enrollStartTime" />
 | 
	
		
			
				|  |  | +		<result column="enroll_end_time_" property="enrollEndTime" />
 | 
	
		
			
				|  |  | +		<result column="expect_exam_start_time_" property="expectExamStartTime" />
 | 
	
		
			
				|  |  | +		<result column="expect_exam_end_time_" property="expectExamEndTime" />
 | 
	
		
			
				|  |  | +		<result column="poster_title_" property="posterTitle" />
 | 
	
		
			
				|  |  | +		<result column="poster_profile_" property="posterProfile" />
 | 
	
		
			
				|  |  | +		<result column="poster_background_img_" property="posterBackgroundImg" />
 | 
	
		
			
				|  |  | +		<result column="create_time_" property="createTime" />
 | 
	
		
			
				|  |  | +		<result column="update_time_" property="updateTime" />
 | 
	
		
			
				|  |  | +		<result column="tenant_id_" property="tenantId" />
 | 
	
		
			
				|  |  | +	</resultMap>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<!-- 根据主键查询一条记录 -->
 | 
	
		
			
				|  |  | +	<select id="get" resultMap="ExaminationBasic" >
 | 
	
		
			
				|  |  | +		SELECT * FROM examination_basic WHERE id_ = #{id}
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<!-- 全查询 -->
 | 
	
		
			
				|  |  | +	<select id="findAll" resultMap="ExaminationBasic">
 | 
	
		
			
				|  |  | +		SELECT * FROM examination_basic WHERE tenant_id_=#{tenantId}
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +	<!-- 向数据库增加一条记录 -->
 | 
	
		
			
				|  |  | +	<insert id="insert" parameterType="com.keao.edu.user.entity.ExaminationBasic" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 | 
	
		
			
				|  |  | +		INSERT INTO examination_basic (id_,name_,exam_mode_,exam_location_id_list_,status_,enroll_start_time_,enroll_end_time_,expect_exam_start_time_,expect_exam_end_time_,poster_title_,poster_profile_,poster_background_img_,create_time_,update_time_,tenant_id_)
 | 
	
		
			
				|  |  | +		VALUES(#{id},#{name},#{examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{examLocationIdList},#{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{enrollStartTime},#{enrollEndTime},#{expectExamStartTime},#{expectExamEndTime},#{posterTitle},#{posterProfile},#{posterBackgroundImg},NOW(),NOW(),#{tenantId})
 | 
	
		
			
				|  |  | +	</insert>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<update id="update" parameterType="com.keao.edu.user.entity.ExamAgencyRelation">
 | 
	
		
			
				|  |  | +		UPDATE examination_basic
 | 
	
		
			
				|  |  | +		<set>
 | 
	
		
			
				|  |  | +			<if test="name != null">
 | 
	
		
			
				|  |  | +				AND name_ = #{name},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="examMode != null">
 | 
	
		
			
				|  |  | +				AND exam_mode_ = #{examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="examLocationIdList != null">
 | 
	
		
			
				|  |  | +				AND exam_location_id_list_ = #{examLocationIdList},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="status != null">
 | 
	
		
			
				|  |  | +				AND status_ = #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="enrollStartTime != null">
 | 
	
		
			
				|  |  | +				AND enroll_start_time_ = #{enrollStartTime},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="enrollEndTime != null">
 | 
	
		
			
				|  |  | +				AND enroll_end_time_ = #{enrollEndTime},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="expectExamStartTime != null">
 | 
	
		
			
				|  |  | +				AND expect_exam_start_time_ = #{expectExamStartTime},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="expectExamEndTime != null">
 | 
	
		
			
				|  |  | +				AND expect_exam_end_time_ = #{expectExamEndTime},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="posterTitle != null">
 | 
	
		
			
				|  |  | +				AND poster_title_ = #{posterTitle},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="posterProfile != null">
 | 
	
		
			
				|  |  | +				AND poster_profile_ = #{posterProfile},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="posterBackgroundImg != null">
 | 
	
		
			
				|  |  | +				AND poster_profile_ = #{posterBackgroundImg},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			<if test="tenantId != null">
 | 
	
		
			
				|  |  | +				AND tenant_id_ = #{tenantId},
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +			update_time_ = NOW()
 | 
	
		
			
				|  |  | +		</set> WHERE id_ = #{id}
 | 
	
		
			
				|  |  | +	</update>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<update id="batchUpdate" parameterType="com.keao.edu.user.entity.ExamAgencyRelation">
 | 
	
		
			
				|  |  | +		<foreach collection="exams" item="exam" separator=";">
 | 
	
		
			
				|  |  | +			UPDATE examination_basic
 | 
	
		
			
				|  |  | +			<set>
 | 
	
		
			
				|  |  | +				<if test="name != null">
 | 
	
		
			
				|  |  | +					AND name_ = #{exam.name},
 | 
	
		
			
				|  |  | +				</if>
 | 
	
		
			
				|  |  | +				<if test="examMode != null">
 | 
	
		
			
				|  |  | +					AND exam_mode_ = #{exam.examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
 | 
	
		
			
				|  |  | +				</if>
 | 
	
		
			
				|  |  | +				<if test="examLocationIdList != null">
 | 
	
		
			
				|  |  | +					AND exam_location_id_list_ = #{exam.examLocationIdList},
 | 
	
		
			
				|  |  | +				</if>
 | 
	
		
			
				|  |  | +				<if test="status != null">
 | 
	
		
			
				|  |  | +					AND status_ = #{exam.status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
 | 
	
		
			
				|  |  | +				</if>
 | 
	
		
			
				|  |  | +				<if test="enrollStartTime != null">
 | 
	
		
			
				|  |  | +					AND enroll_start_time_ = #{exam.enrollStartTime},
 | 
	
		
			
				|  |  | +				</if>
 | 
	
		
			
				|  |  | +				<if test="enrollEndTime != null">
 | 
	
		
			
				|  |  | +					AND enroll_end_time_ = #{exam.enrollEndTime},
 | 
	
		
			
				|  |  | +				</if>
 | 
	
		
			
				|  |  | +				<if test="expectExamStartTime != null">
 | 
	
		
			
				|  |  | +					AND expect_exam_start_time_ = #{exam.expectExamStartTime},
 | 
	
		
			
				|  |  | +				</if>
 | 
	
		
			
				|  |  | +				<if test="expectExamEndTime != null">
 | 
	
		
			
				|  |  | +					AND expect_exam_end_time_ = #{exam.expectExamEndTime},
 | 
	
		
			
				|  |  | +				</if>
 | 
	
		
			
				|  |  | +				<if test="posterTitle != null">
 | 
	
		
			
				|  |  | +					AND poster_title_ = #{exam.posterTitle},
 | 
	
		
			
				|  |  | +				</if>
 | 
	
		
			
				|  |  | +				<if test="posterProfile != null">
 | 
	
		
			
				|  |  | +					AND poster_profile_ = #{exam.posterProfile},
 | 
	
		
			
				|  |  | +				</if>
 | 
	
		
			
				|  |  | +				<if test="posterBackgroundImg != null">
 | 
	
		
			
				|  |  | +					AND poster_profile_ = #{exam.posterBackgroundImg},
 | 
	
		
			
				|  |  | +				</if>
 | 
	
		
			
				|  |  | +				<if test="tenantId != null">
 | 
	
		
			
				|  |  | +					AND tenant_id_ = #{exam.tenantId},
 | 
	
		
			
				|  |  | +				</if>
 | 
	
		
			
				|  |  | +				update_time_ = NOW()
 | 
	
		
			
				|  |  | +			</set> WHERE id_ = #{exam.id}
 | 
	
		
			
				|  |  | +		</foreach>
 | 
	
		
			
				|  |  | +	</update>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<!-- 根据主键删除一条记录 -->
 | 
	
		
			
				|  |  | +	<delete id="delete" >
 | 
	
		
			
				|  |  | +		DELETE FROM examination_basic WHERE id_ = #{id}
 | 
	
		
			
				|  |  | +	</delete>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<sql id="queryCondition">
 | 
	
		
			
				|  |  | +		<where>
 | 
	
		
			
				|  |  | +			tenant_id_=#{tenantId}
 | 
	
		
			
				|  |  | +			<if test="examStatus!=null">
 | 
	
		
			
				|  |  | +				status_=#{examStatus}
 | 
	
		
			
				|  |  | +			</if>
 | 
	
		
			
				|  |  | +		</where>
 | 
	
		
			
				|  |  | +	</sql>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<!-- 分页查询 -->
 | 
	
		
			
				|  |  | +	<select id="queryPage" resultMap="ExaminationBasic" parameterType="map">
 | 
	
		
			
				|  |  | +		SELECT * FROM examination_basic
 | 
	
		
			
				|  |  | +		<include refid="queryCondition"/>
 | 
	
		
			
				|  |  | +		<include refid="global.limit"/>
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +	
 | 
	
		
			
				|  |  | +	<!-- 查询当前表的总记录数 -->
 | 
	
		
			
				|  |  | +	<select id="queryCount" resultType="int">
 | 
	
		
			
				|  |  | +		SELECT COUNT(*) FROM examination_basic
 | 
	
		
			
				|  |  | +		<include refid="queryCondition"/>
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="getNeedUpdateStatusExams" resultMap="ExaminationBasic">
 | 
	
		
			
				|  |  | +		SELECT * FROM examination_basic WHERE status_ IN ('NOT_START', 'APPLYING', 'APPLIED')
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +</mapper>
 |