<?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.ots.project.exam.mapper.SysUserPaperMapper">
|
|
<resultMap type="SysUserPaper" id="SysUserPaperResult">
|
<result property="userId" column="user_id" />
|
<result property="prodId" column="prod_id" />
|
<result property="prodName" column="prodName" />
|
<result property="reportTemplateId" column="report_template_id" />
|
</resultMap>
|
|
<sql id="selectSysUserPaperVo">
|
SELECT t.user_id, t.prod_id, p.name prodName ,t.report_template_id FROM sys_user_paper t ,t_exam_paper p
|
</sql>
|
|
<select id="selectSysUserPaperList" parameterType="SysUserPaper" resultMap="SysUserPaperResult">
|
<include refid="selectSysUserPaperVo"/>
|
<where>
|
t.prod_id = p.id AND p.deleted IN(0,1)
|
<if test="userId != null and userId != ''"> and t.user_id = #{userId}</if>
|
<if test="prodId != null and prodId != ''"> and t.prod_id = #{prodId}</if>
|
<if test="prodName != null and prodName != ''"> and p.prodName = #{prodName}</if>
|
</where>
|
</select>
|
|
<select id="selectSysUserPaperById" parameterType="Long" resultMap="SysUserPaperResult">
|
<include refid="selectSysUserPaperVo"/>
|
where t.user_id = #{userId} and t.prod_id = p.id AND p.deleted IN(0,1)
|
</select>
|
|
<insert id="insertSysUserPaper" parameterType="SysUserPaper">
|
insert into sys_user_paper
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="userId != null ">user_id,</if>
|
<if test="prodId != null ">prod_id,</if>
|
<if test="reportTemplateId != null ">report_template_id,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="userId != null ">#{userId},</if>
|
<if test="prodId != null ">#{prodId},</if>
|
<if test="reportTemplateId != null ">#{reportTemplateId},</if>
|
</trim>
|
</insert>
|
|
<update id="updateSysUserPaper" parameterType="SysUserPaper">
|
update sys_user_paper
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="prodId != null ">prod_id = #{prodId},</if>
|
<if test="reportTemplateId != null ">prod_id = #{reportTemplateId},</if>
|
</trim>
|
where user_id = #{userId}
|
</update>
|
|
<delete id="deleteSysUserPaperById" parameterType="Long">
|
delete from sys_user_paper where user_id = #{userId}
|
</delete>
|
|
<delete id="deleteSysUserPaperByIds" parameterType="String">
|
delete from sys_user_paper where user_id in
|
<foreach item="userId" collection="array" open="(" separator="," close=")">
|
#{userId}
|
</foreach>
|
</delete>
|
|
</mapper>
|