<?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.mindskip.xzs.repository.ExamTemplatesMapper">
|
<resultMap id="BaseResultMap" type="com.mindskip.xzs.domain.ExamTemplates">
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
<result column="paper_type" jdbcType="VARCHAR" property="paperType"/>
|
<result column="suggest_time" jdbcType="VARCHAR" property="suggestTime"/>
|
<result column="title_name" jdbcType="VARCHAR" property="titleName"/>
|
<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,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,start_time,end_time)
|
values (#{name}, #{paperType}, #{suggestTime}, #{titleName}, #{ctime}, #{status}, #{menuIds},#{startTime},#{endTime})
|
</insert>
|
|
<select id="getTime" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List"/>
|
from t_exam_templates where status is null
|
order by ctime desc
|
limit 1
|
</select>
|
|
<select id="gets" resultMap="BaseResultMap" parameterType="com.mindskip.xzs.domain.vo.ExamTemplatesVO">
|
select
|
DISTINCT e.id
|
, e.name, e.paper_type, e.suggest_time, e.title_name, e.ctime, e.status, e.menu_ids,e.start_time,e.end_time
|
from t_exam_templates e
|
inner join t_exam_templates_user u on e.id = u.templates_id
|
<where>
|
<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="getByadmins" resultMap="BaseResultMap" parameterType="com.mindskip.xzs.domain.vo.ExamTemplatesVO">
|
select
|
DISTINCT e.id
|
, e.name, e.paper_type, e.suggest_time, e.title_name, e.ctime, e.status, e.menu_ids,e.start_time,e.end_time
|
from t_exam_templates e
|
left join t_exam_templates_user u on e.id = u.templates_id
|
<where>
|
<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="deptId != null">
|
and e.dept_id = #{deptId}
|
</if>
|
<if test="now !=null">
|
and #{now} between e.start_time and e.end_time
|
</if>
|
</where>
|
</select>
|
|
<select id="getById" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List"/>
|
from t_exam_templates where id = #{id}
|
</select>
|
|
<select id="getByName" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List"/>
|
from t_exam_templates where name = #{name}/
|
</select>
|
|
<delete id="removeById" parameterType="java.lang.Integer">
|
delete from t_exam_templates
|
where id = #{id}
|
</delete>
|
|
</mapper>
|