123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- <?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" />
- <result column="memo_" property="memo" />
- <result column="organ_id_" property="organId"/>
- <result column="creator_id_" property="creatorId"/>
- </resultMap>
- <resultMap id="ExaminationBasicDto" type="com.keao.edu.user.dto.ExaminationBasicDto" extends="ExaminationBasic">
- </resultMap>
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="ExaminationBasic" >
- SELECT * FROM examination_basic WHERE id_ = #{id}
- </select>
- <select id="getExaminationBasic" resultMap="ExaminationBasicDto" >
- SELECT * FROM examination_basic WHERE id_ = #{examId}
- </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_,creator_id_,create_time_,update_time_,tenant_id_,memo_,organ_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},#{creatorId},NOW(),NOW(),#{tenantId},#{memo},#{organId})
- </insert>
- <update id="update" parameterType="com.keao.edu.user.entity.ExamOrganizationRelation">
- UPDATE examination_basic
- <set>
- <if test="name != null">
- name_ = #{name},
- </if>
- <if test="examMode != null">
- exam_mode_ = #{examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="examLocationIdList != null">
- exam_location_id_list_ = #{examLocationIdList},
- </if>
- <if test="status != null">
- status_ = #{status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="enrollStartTime != null">
- enroll_start_time_ = #{enrollStartTime},
- </if>
- <if test="enrollEndTime != null">
- enroll_end_time_ = #{enrollEndTime},
- </if>
- <if test="expectExamStartTime != null">
- expect_exam_start_time_ = #{expectExamStartTime},
- </if>
- <if test="expectExamEndTime != null">
- expect_exam_end_time_ = #{expectExamEndTime},
- </if>
- <if test="posterTitle != null">
- poster_title_ = #{posterTitle},
- </if>
- <if test="posterProfile != null">
- poster_profile_ = #{posterProfile},
- </if>
- <if test="posterBackgroundImg != null">
- poster_profile_ = #{posterBackgroundImg},
- </if>
- <if test="tenantId != null">
- tenant_id_ = #{tenantId},
- </if>
- <if test="memo!=null">
- memo_=#{memo},
- </if>
- <if test="creatorId!=null">
- creator_id_=#{creatorId},
- </if>
- update_time_ = NOW()
- </set> WHERE id_ = #{id}
- </update>
- <update id="batchUpdate" parameterType="com.keao.edu.user.entity.ExamOrganizationRelation">
- <foreach collection="exams" item="exam" separator=";">
- UPDATE examination_basic
- <set>
- <if test="name != null">
- name_ = #{exam.name},
- </if>
- <if test="examMode != null">
- exam_mode_ = #{exam.examMode,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="examLocationIdList != null">
- exam_location_id_list_ = #{exam.examLocationIdList},
- </if>
- <if test="status != null">
- status_ = #{exam.status,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="enrollStartTime != null">
- enroll_start_time_ = #{exam.enrollStartTime},
- </if>
- <if test="enrollEndTime != null">
- enroll_end_time_ = #{exam.enrollEndTime},
- </if>
- <if test="expectExamStartTime != null">
- expect_exam_start_time_ = #{exam.expectExamStartTime},
- </if>
- <if test="expectExamEndTime != null">
- expect_exam_end_time_ = #{exam.expectExamEndTime},
- </if>
- <if test="posterTitle != null">
- poster_title_ = #{exam.posterTitle},
- </if>
- <if test="posterProfile != null">
- poster_profile_ = #{exam.posterProfile},
- </if>
- <if test="posterBackgroundImg != null">
- poster_profile_ = #{exam.posterBackgroundImg},
- </if>
- <if test="tenantId != null">
- tenant_id_ = #{exam.tenantId},
- </if>
- <if test="memo!=null">
- memo_=#{memo},
- </if>
- <if test="creatorId!=null">
- creator_id_=#{creatorId},
- </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">
- AND status_=#{examStatus}
- </if>
- <if test="search!=null">
- AND (id_=#{search} OR name_ LIKE CONCAT(#{search}, '%'))
- </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="findExaminationBasics" resultMap="ExaminationBasicDto" parameterType="map">
- SELECT * FROM examination_basic
- <include refid="queryCondition"/>
- ORDER BY id_ DESC
- <include refid="global.limit"/>
- </select>
- <select id="countExaminationBasics" 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>
- <select id="getExams" resultMap="ExaminationBasicDto">
- SELECT * FROM examination_basic
- WHERE status_ IN ('EXAM_END')
- AND id_ IN
- <foreach collection="examIds" item="examId" separator="," open="(" close=")">
- #{examId}
- </foreach>
- </select>
- </mapper>
|