<?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.ExamPaperDepartmentMapper">
|
<resultMap id="BaseResultMap" type="com.mindskip.xzs.domain.ExamPaperDepartment">
|
<id column="id" jdbcType="INTEGER" property="id" />
|
<result column="department_id" jdbcType="INTEGER" property="departmentId" />
|
<result column="exam_paper_id" jdbcType="INTEGER" property="examPaperId" />
|
<result column="deleted" jdbcType="VARCHAR" property="deleted" />
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
id
|
,department_id,exam_paper_id,deleted
|
</sql>
|
|
<insert id="saves" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
insert into t_exam_paper_department(id,department_id,exam_paper_id,deleted)
|
values
|
<foreach collection="list" item="item" index="index" separator=",">
|
(#{item.id},#{item.departmentId},#{item.examPaperId},#{item.deleted})
|
</foreach>
|
</insert>
|
|
<delete id="removes" parameterType="java.lang.Integer">
|
delete from t_exam_paper_department
|
where id in
|
<foreach item="id" collection="ids" open="(" separator=","
|
close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
<select id="getByExamPaperId" resultMap="BaseResultMap">
|
select * from t_exam_paper_department
|
where exam_paper_id = #{id} and deleted = 0
|
</select>
|
|
<select id="selectByUserId" resultType="java.lang.String">
|
SELECT GROUP_CONCAT(b.name)
|
FROM t_user_department a
|
INNER JOIN t_department b ON a.department_id = b.id
|
WHERE a.user_id = #{userId}
|
GROUP BY a.user_id
|
ORDER BY a.user_id
|
</select>
|
|
<delete id="removeByExamPaperId" parameterType="java.lang.Integer">
|
delete from t_exam_paper_department
|
where exam_paper_id = #{id}
|
</delete>
|
|
<delete id="removeByExamPaperIds" parameterType="java.lang.Integer">
|
delete from t_exam_paper_department
|
where exam_paper_id in
|
<foreach item="id" collection="ids" open="(" separator=","
|
close=")">
|
#{id}
|
</foreach>
|
</delete>
|
</mapper>
|