fuliqi
2023-11-28 d8524dc5ef974bcfacba99128d5e79a268ccdf3f
src/main/resources/mapper/ExamTemplatesMapper.xml
@@ -10,16 +10,18 @@
        <result column="ctime" jdbcType="TIMESTAMP" property="ctime"/>
        <result column="status" jdbcType="VARCHAR" property="status"/>
        <result column="menu_ids" jdbcType="VARCHAR" property="menuIds"/>
        <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
        <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , name, paper_type, suggest_time, title_name, ctime, status, menu_ids
        , name, paper_type, suggest_time, title_name, ctime, status, menu_ids,start_time,end_time
    </sql>
    <insert id="add" parameterType="com.mindskip.xzs.domain.ExamTemplates" useGeneratedKeys="true" keyProperty="id">
        insert into t_exam_templates (name, paper_type, suggest_time, title_name, ctime, status, menu_ids)
        values (#{name}, #{paperType}, #{suggestTime}, #{titleName}, #{ctime}, #{status}, #{menuIds})
        insert into t_exam_templates (name, paper_type, suggest_time, title_name, ctime, status, menu_ids,start_time,end_time)
        values (#{name}, #{paperType}, #{suggestTime}, #{titleName}, #{ctime}, #{status}, #{menuIds},#{startTime},#{endTime})
    </insert>
    <select id="getTime" resultMap="BaseResultMap">
@@ -36,6 +38,7 @@
        from t_exam_templates e
        inner join t_exam_templates_user u on e.id = u.templates_id
        <where>
            paper_type != 7
            <if test="status != null">
                and e.status = 0
            </if>
@@ -46,6 +49,26 @@
                and u.user_id = #{userId}
            </if>
        </where>
        union all
        select
        e.*
        from t_exam_templates e
        inner join t_exam_templates_user u on e.id = u.templates_id
        <where>
            paper_type = 7
            <if test="status != null">
                and e.status = 0
            </if>
            <if test="status == null">
                and e.status is null
            </if>
            <if test="userId != null">
                and u.user_id = #{userId}
            </if>
            <if test="now !=null">
                and #{now} between e.start_time and e.end_time
            </if>
        </where>
    </select>
    <select id="getById" resultMap="BaseResultMap">