215 lines
8.0 KiB
XML
215 lines
8.0 KiB
XML
<?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="tech.unissense.pms.business.examine.user.mapper.ExamineUserMapper">
|
|
|
|
<resultMap type="tech.unissense.pms.business.examine.user.domain.ExamineUser" id="ExamineUserMap">
|
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
|
<result property="taskId" column="task_id" jdbcType="INTEGER"/>
|
|
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
|
<result property="score" column="score" jdbcType="NUMERIC"/>
|
|
<result property="judgeContent" column="judge_content" jdbcType="VARCHAR"/>
|
|
<result property="selfJudgeContent" column="self_judge_content" jdbcType="VARCHAR"/>
|
|
<result property="manageScore" column="manage_score" jdbcType="NUMERIC"/>
|
|
<result property="examineStatus" column="examine_status" jdbcType="VARCHAR"/>
|
|
<result property="examineStatusSelf" column="examine_status_self" jdbcType="VARCHAR"/>
|
|
<result property="manageUserId" column="manage_user_id" jdbcType="INTEGER"/>
|
|
<result property="selfScore" column="self_score" jdbcType="NUMERIC"/>
|
|
</resultMap>
|
|
|
|
<sql id="base_query">
|
|
select id,
|
|
task_id,
|
|
user_id,
|
|
score,
|
|
judge_content,
|
|
self_judge_content,
|
|
manage_score,
|
|
examine_status,
|
|
examine_status_self,
|
|
manage_user_id,
|
|
self_score
|
|
from pms_examine_user
|
|
|
|
</sql>
|
|
<!--查询单个-->
|
|
<select id="queryById" resultMap="ExamineUserMap">
|
|
<include refid="base_query"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
|
|
|
|
<!--统计总行数-->
|
|
<select id="count" resultType="java.lang.Long">
|
|
select count(1)
|
|
from pms_examine_user
|
|
<where>
|
|
<if test="id != null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="taskId != null">
|
|
and task_id = #{taskId}
|
|
</if>
|
|
<if test="userId != null">
|
|
and user_id = #{userId}
|
|
</if>
|
|
<if test="score != null">
|
|
and score = #{score}
|
|
</if>
|
|
<if test="judgeContent != null and judgeContent != ''">
|
|
and judge_content = #{judgeContent}
|
|
</if>
|
|
<if test="manageScore != null">
|
|
and manage_score = #{manageScore}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="list" resultType="ExamineUser">
|
|
select t1.id,
|
|
t1.task_id,
|
|
t1.user_id,
|
|
t1.score,
|
|
t1.judge_content,
|
|
t1.self_judge_content,
|
|
t1.manage_score,
|
|
t1.examine_status,
|
|
t1.examine_status_self,
|
|
t1.manage_user_id,
|
|
t1.self_score,
|
|
t2.nick_name as userName,
|
|
t3.nick_name as manageUserName
|
|
from pms_examine_user t1 left join sys_user t2 on t1.user_id = t2.user_id
|
|
left join sys_user t3 on t1.manage_user_id = t3.user_id
|
|
<where>
|
|
<if test="id != null">
|
|
and t1.id = #{id}
|
|
</if>
|
|
<if test="taskId != null">
|
|
and t1.task_id = #{taskId}
|
|
</if>
|
|
<if test="userId != null">
|
|
and t1.user_id = #{userId}
|
|
</if>
|
|
<if test="userIdList != null and userIdList.size>0">
|
|
and t1.user_id in
|
|
<foreach collection="userIdList" item="userId" open="(" separator="," close=")">
|
|
#{userId}
|
|
</foreach>
|
|
</if>
|
|
<if test="score != null">
|
|
and t1.score = #{score}
|
|
</if>
|
|
<if test="judgeContent != null and judgeContent != ''">
|
|
and t1.judge_content = #{judgeContent}
|
|
</if>
|
|
<if test="manageScore != null">
|
|
and t1.manage_score = #{manageScore}
|
|
</if>
|
|
<if test="examineStatus != null and examineStatus != ''">
|
|
and t1.examine_status = #{examineStatus}
|
|
</if>
|
|
<if test="examineStatusSelf != null and examineStatusSelf != ''">
|
|
and t1.examine_status_self = #{examineStatusSelf}
|
|
</if>
|
|
<if test="deptId != null and deptId != ''">
|
|
and t2.dept_id = #{deptId}
|
|
</if>
|
|
${params.dataScope}
|
|
</where>
|
|
${orderBySql}
|
|
</select>
|
|
<select id="queryByTaskIdAndUserId" resultMap="ExamineUserMap">
|
|
<include refid="base_query"/>
|
|
where task_id = #{taskId} and user_id = #{userId}
|
|
</select>
|
|
|
|
<!--新增所有列-->
|
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
|
insert into pms_examine_user(task_id, user_id, score, judge_content,self_judge_content, manage_score)
|
|
values (#{taskId}, #{userId}, #{score}, #{judgeContent}, #{selfJudgeContent}, #{manageScore})
|
|
</insert>
|
|
|
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
|
insert into pms_examine_user(task_id, user_id, score, judge_content, self_judge_content,manage_score)
|
|
values
|
|
<foreach collection="entities" item="entity" separator=",">
|
|
(#{entity.taskId}, #{entity.userId}, #{entity.score}, #{entity.judgeContent},#{entity.selfJudgeContent}, #{entity.manageScore})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
|
insert into pms_examine_user(task_id, user_id, score, judge_content,self_judge_content, manage_score)
|
|
values
|
|
<foreach collection="entities" item="entity" separator=",">
|
|
(#{entity.taskId}, #{entity.userId}, #{entity.score}, #{entity.judgeContent}, #{entity.selfJudgeContent}, #{entity.manageScore})
|
|
</foreach>
|
|
on duplicate key update
|
|
task_id = values(task_id),
|
|
user_id = values(user_id),
|
|
score = values(score),
|
|
judge_content = values(judge_content),
|
|
self_judge_content = values(self_judge_content),
|
|
manage_score = values(manage_score)
|
|
</insert>
|
|
|
|
<!--通过主键修改数据-->
|
|
<update id="update">
|
|
update pms_examine_user
|
|
<set>
|
|
<if test="taskId != null">
|
|
task_id = #{taskId},
|
|
</if>
|
|
<if test="userId != null">
|
|
user_id = #{userId},
|
|
</if>
|
|
<if test="score != null">
|
|
score = #{score},
|
|
</if>
|
|
<if test="judgeContent != null and judgeContent != ''">
|
|
judge_content = #{judgeContent},
|
|
</if>
|
|
<if test="selfJudgeContent != null and selfJudgeContent != ''">
|
|
self_judge_content = #{selfJudgeContent},
|
|
</if>
|
|
<if test="manageScore != null">
|
|
manage_score = #{manageScore},
|
|
</if>
|
|
<if test="selfScore != null">
|
|
self_score = #{selfScore},
|
|
</if>
|
|
<if test="examineStatus != null and examineStatus != ''">
|
|
examine_status = #{examineStatus},
|
|
</if>
|
|
<if test="examineStatusSelf != null and examineStatusSelf != ''">
|
|
examine_status_self = #{examineStatusSelf},
|
|
</if>
|
|
<if test="manageUserId != null">
|
|
manage_user_id = #{manageUserId},
|
|
</if>
|
|
</set>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<!--通过主键删除-->
|
|
<delete id="deleteById">
|
|
delete
|
|
from pms_examine_user
|
|
where id = #{id}
|
|
</delete>
|
|
<delete id="deleteByIdList">
|
|
delete
|
|
from pms_examine_user
|
|
where id in
|
|
<foreach collection="list" item="id" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
<delete id="clearUserByTaskId">
|
|
update pms_examine_user
|
|
set score=null,judge_content=null,manage_score=null,examine_status=0,examine_status_self=0,self_score=null
|
|
where task_id=#{id}
|
|
</delete>
|
|
|
|
</mapper>
|
|
|