2025-04-21 15:33:19 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
<!DOCTYPE mapper
|
2025-08-07 15:12:44 +08:00
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
2025-04-22 11:08:29 +08:00
|
|
|
<mapper namespace="pc.exam.pp.module.exam.dal.mysql.specialty.ExamSpecialtyMapper">
|
2025-04-21 15:33:19 +08:00
|
|
|
|
|
|
|
<resultMap type="ExamSpecialty" id="ExamSpecialtyResult">
|
2025-08-07 15:12:44 +08:00
|
|
|
<result property="spId" column="sp_id"/>
|
|
|
|
<result property="parentId" column="parent_id"/>
|
|
|
|
<result property="ancestors" column="ancestors"/>
|
|
|
|
<result property="spName" column="sp_name"/>
|
|
|
|
<result property="orderNum" column="order_num"/>
|
|
|
|
<result property="status" column="status"/>
|
|
|
|
<result property="unite" column="unite"/>
|
|
|
|
<result property="treeNum" column="tree_num"/>
|
|
|
|
<result property="roles" column="roles"/>
|
2025-04-21 15:33:19 +08:00
|
|
|
</resultMap>
|
|
|
|
|
2025-06-10 17:16:34 +08:00
|
|
|
<resultMap type="ExamKnowledgePoints" id="KnowledgePointsResult">
|
2025-08-07 15:12:44 +08:00
|
|
|
<result property="spId" column="sp_id"/>
|
|
|
|
<result property="parentId" column="parent_id"/>
|
|
|
|
<result property="ancestors" column="ancestors"/>
|
|
|
|
<result property="spName" column="sp_name"/>
|
|
|
|
<result property="orderNum" column="order_num"/>
|
|
|
|
<result property="status" column="status"/>
|
|
|
|
<result property="treeNum" column="tree_num"/>
|
2025-06-10 17:16:34 +08:00
|
|
|
</resultMap>
|
2025-04-21 15:33:19 +08:00
|
|
|
<sql id="selectExamSpecialtyVo">
|
2025-08-07 15:12:44 +08:00
|
|
|
select sp_id,
|
|
|
|
parent_id,
|
|
|
|
ancestors,
|
|
|
|
sp_name,
|
|
|
|
order_num,
|
|
|
|
status,
|
|
|
|
creator,
|
|
|
|
create_time,
|
|
|
|
updater,
|
|
|
|
update_time,
|
|
|
|
unite,
|
|
|
|
tree_num,
|
|
|
|
roles,
|
|
|
|
tenant_id
|
|
|
|
from exam_specialty
|
2025-04-21 15:33:19 +08:00
|
|
|
</sql>
|
|
|
|
|
2025-08-07 15:12:44 +08:00
|
|
|
<select id="selectExamSpecialtyListVo"
|
|
|
|
resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo">
|
2025-05-18 00:00:49 +08:00
|
|
|
select sp_id as id, sp_name as name, parent_id, status, create_time,roles from exam_specialty
|
2025-04-21 15:33:19 +08:00
|
|
|
<where>
|
2025-08-07 15:12:44 +08:00
|
|
|
<if test="name != null and name != ''">and sp_name like concat('%', #{name}, '%')</if>
|
|
|
|
<if test="status != null and status != ''">and status = #{status}</if>
|
2025-04-21 15:33:19 +08:00
|
|
|
and deleted = 0
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
2025-08-07 15:12:44 +08:00
|
|
|
<select id="selectExamSpecialtyAll"
|
|
|
|
resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo">
|
|
|
|
select sp_id as id, sp_name as name, parent_id, status, create_time
|
|
|
|
from exam_specialty
|
|
|
|
where deleted = 0
|
|
|
|
and status = 0
|
2025-04-24 14:42:04 +08:00
|
|
|
</select>
|
|
|
|
|
2025-08-07 15:12:44 +08:00
|
|
|
<select id="selectExamSpecialtyByids"
|
|
|
|
resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo">
|
|
|
|
SELECT sp_id AS id, sp_name AS name, ancestors, parent_id, status, create_time from exam_specialty
|
2025-04-24 14:42:04 +08:00
|
|
|
WHERE sp_id IN
|
|
|
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
AND deleted = 0 and status = 0
|
|
|
|
</select>
|
|
|
|
|
2025-08-07 15:12:44 +08:00
|
|
|
<select id="selectExamSpecialtyPart"
|
|
|
|
resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo">
|
2025-04-23 17:24:58 +08:00
|
|
|
select sp_id as id, sp_name as name, parent_id, status, create_time
|
|
|
|
FROM exam_specialty
|
2025-08-07 15:12:44 +08:00
|
|
|
WHERE (
|
|
|
|
LENGTH(ancestors) - LENGTH(REPLACE(ancestors, ',', ''))
|
|
|
|
) + 1 <= 2
|
|
|
|
and status = 0
|
|
|
|
and deleted = 0
|
2025-04-23 17:24:58 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
2025-04-21 15:33:19 +08:00
|
|
|
<select id="selectExamSpecialtyList" resultType="ExamSpecialty">
|
|
|
|
<include refid="selectExamSpecialtyVo"/>
|
|
|
|
<where>
|
2025-08-07 15:12:44 +08:00
|
|
|
<if test="name != null and name != ''">and sp_name like concat('%', #{name}, '%')</if>
|
|
|
|
<if test="status != null and status != ''">and status = #{status}</if>
|
2025-04-21 15:33:19 +08:00
|
|
|
and deleted = 0
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectSpIds" parameterType="ExamSpecialty" resultMap="ExamSpecialtyResult">
|
|
|
|
<include refid="selectExamSpecialtyVo"/>
|
2025-08-07 15:12:44 +08:00
|
|
|
<!-- <where>-->
|
|
|
|
<!-- <if test="spId != null "> and sp_id = #{spId}</if>-->
|
|
|
|
<!-- </where>-->
|
2025-04-21 15:33:19 +08:00
|
|
|
where sp_id in
|
|
|
|
<foreach item="spId" collection="array" open="(" separator="," close=")">
|
|
|
|
#{spId}
|
|
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<update id="updateExamSpecialty" parameterType="ExamSpecialty">
|
|
|
|
update exam_specialty
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
|
|
|
<if test="ancestors != null">ancestors = #{ancestors},</if>
|
|
|
|
<if test="spName != null">sp_name = #{spName},</if>
|
|
|
|
<if test="orderNum != null">order_num = #{orderNum},</if>
|
|
|
|
<if test="status != null">status = #{status},</if>
|
|
|
|
<if test="unite != null">unite = #{unite},</if>
|
|
|
|
<if test="treeNum != null">tree_num = #{treeNum},</if>
|
|
|
|
</trim>
|
|
|
|
where sp_id = #{spId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<select id="selectExamSpecialtyBySpId" parameterType="Long" resultMap="ExamSpecialtyResult">
|
|
|
|
<include refid="selectExamSpecialtyVo"/>
|
|
|
|
where sp_id = #{spId}
|
|
|
|
</select>
|
2025-06-05 13:53:42 +08:00
|
|
|
|
2025-08-07 15:12:44 +08:00
|
|
|
<select id="selectExamSpecialtyBySpName" parameterType="String" resultType="pc.exam.pp.module.exam.dal.dataobject.specialty.ExamSpecialty">
|
|
|
|
SELECT *
|
|
|
|
from exam_specialty
|
|
|
|
where sp_name = #{spName}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectExamSpecialtyByParentId"
|
|
|
|
resultType="pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo">
|
|
|
|
SELECT sp_id AS id, sp_name AS name, ancestors, parent_id, status, create_time
|
|
|
|
from exam_specialty
|
2025-06-05 13:53:42 +08:00
|
|
|
where parent_id = #{parentId}
|
|
|
|
</select>
|
2025-05-18 00:00:49 +08:00
|
|
|
<select id="getRoleById" resultType="java.lang.String">
|
|
|
|
select roles
|
2025-08-07 15:12:44 +08:00
|
|
|
from exam_specialty
|
|
|
|
where sp_id = #{id};
|
2025-05-18 00:00:49 +08:00
|
|
|
</select>
|
2025-05-19 22:00:57 +08:00
|
|
|
<select id="selectBySpecCourseSub" resultMap="ExamSpecialtyResult">
|
2025-08-07 15:12:44 +08:00
|
|
|
SELECT q3.*
|
2025-05-19 22:00:57 +08:00
|
|
|
FROM exam_specialty q1
|
|
|
|
JOIN exam_specialty q2 ON q2.parent_id = q1.sp_id
|
|
|
|
JOIN exam_specialty q3 ON q3.parent_id = q2.sp_id
|
|
|
|
WHERE q1.sp_name = #{specialtyName}
|
|
|
|
AND q2.sp_name = #{courseName}
|
|
|
|
AND q3.sp_name = #{subjectName}
|
|
|
|
AND q1.deleted = '0'
|
|
|
|
AND q2.deleted = '0'
|
2025-08-07 15:12:44 +08:00
|
|
|
AND q3.deleted = '0' LIMIT 1;
|
2025-05-19 22:00:57 +08:00
|
|
|
</select>
|
2025-06-10 17:16:34 +08:00
|
|
|
<select id="selectByPointsSub" resultMap="KnowledgePointsResult">
|
2025-08-07 15:12:44 +08:00
|
|
|
SELECT q3.*
|
2025-06-10 17:16:34 +08:00
|
|
|
FROM exam_knowledge_points q1
|
|
|
|
JOIN exam_knowledge_points q2 ON q2.parent_id = q1.sp_id
|
|
|
|
JOIN exam_knowledge_points q3 ON q3.parent_id = q2.sp_id
|
|
|
|
WHERE q1.sp_name = #{specialtyName}
|
|
|
|
AND q2.sp_name = #{chapteridDictText}
|
|
|
|
AND q3.sp_name = #{pointNames}
|
|
|
|
AND q1.deleted = '0'
|
|
|
|
AND q2.deleted = '0'
|
2025-08-07 15:12:44 +08:00
|
|
|
AND q3.deleted = '0' LIMIT 1;
|
2025-06-10 17:16:34 +08:00
|
|
|
</select>
|
2025-06-25 16:22:40 +08:00
|
|
|
<select id="selectAllSpecialtyRelations"
|
|
|
|
resultType="pc.exam.pp.module.exam.service.monitor.vo.SpecialtyRelation">
|
2025-08-07 15:12:44 +08:00
|
|
|
SELECT sp_id AS spId, parent_id AS parentId
|
|
|
|
FROM exam_specialty
|
2025-06-25 16:22:40 +08:00
|
|
|
|
|
|
|
</select>
|
|
|
|
<select id="selectAllIdToParent" resultType="pc.exam.pp.module.exam.service.monitor.vo.IdParentPair">
|
2025-08-07 15:12:44 +08:00
|
|
|
SELECT sp_id AS spId, parent_id AS parentId
|
|
|
|
FROM exam_specialty
|
|
|
|
WHERE deleted = '0'
|
|
|
|
and status = '0'
|
|
|
|
and tenant_id = #{loginTenantId}
|
2025-06-25 16:22:40 +08:00
|
|
|
</select>
|
2025-06-10 17:16:34 +08:00
|
|
|
|
2025-04-21 15:33:19 +08:00
|
|
|
|
|
|
|
<update id="deleteExamSpecialtyBySpId" parameterType="Long">
|
|
|
|
update exam_specialty
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
deleted = 1
|
|
|
|
</trim>
|
2025-08-07 15:12:44 +08:00
|
|
|
where sp_id = #{spId}
|
2025-04-21 15:33:19 +08:00
|
|
|
</update>
|
|
|
|
|
|
|
|
<update id="deleteExamSpecialtyBySpIds" parameterType="String">
|
|
|
|
update exam_specialty
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
deleted = 1
|
|
|
|
</trim>
|
2025-08-07 15:12:44 +08:00
|
|
|
where sp_id in
|
2025-04-21 15:33:19 +08:00
|
|
|
<foreach item="spId" collection="array" open="(" separator="," close=")">
|
|
|
|
#{spId}
|
|
|
|
</foreach>
|
|
|
|
</update>
|
|
|
|
|
|
|
|
</mapper>
|