Files
pengchen-exam-java/exam-module-exam/exam-module-exam-biz/src/main/resources/mapper/knowledge/ExamKnowledgePointsMapper.xml

59 lines
2.6 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="pc.exam.pp.module.exam.dal.mysql.ExamKnowledgePointsMapper">
<resultMap type="ExamKnowledgePoints" id="KnowledgePointsResult">
<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" />
</resultMap>
<sql id="selectKnowledgePointsVo">
select sp_id, parent_id, ancestors, sp_name, order_num, status, creator, create_time, updater, update_time, tree_num, tenant_id from exam_knowledge_points
</sql>
<select id="selectKnowledgePointsList" parameterType="ExamKnowledgePoints" resultMap="KnowledgePointsResult">
<include refid="selectKnowledgePointsVo"/>
<where>
<if test="knowledgePoints.parentId != null "> and parent_id = #{knowledgePoints.parentId}</if>
<if test="knowledgePoints.ancestors != null and knowledgePoints.ancestors != ''"> and ancestors = #{knowledgePoints.ancestors}</if>
<if test="knowledgePoints.spName != null and knowledgePoints.spName != ''"> and sp_name like concat('%', #{knowledgePoints.spName}, '%')</if>
<if test="knowledgePoints.orderNum != null "> and order_num = #{knowledgePoints.orderNum}</if>
<if test="knowledgePoints.status != null and knowledgePoints.status != ''"> and status = #{knowledgePoints.status}</if>
and deleted = 0
</where>
</select>
<select id="selectKnowledgePointsBySpId" parameterType="Long" resultMap="KnowledgePointsResult">
<include refid="selectKnowledgePointsVo"/>
where sp_id = #{spId}
</select>
<update id="deleteKnowledgePointsBySpId" parameterType="Long">
update exam_knowledge_points
<trim prefix="SET" suffixOverrides=",">
deleted = 1
</trim>
where sp_id = #{spId}
</update>
<update id="deleteKnowledgePointsBySpIds" parameterType="String">
-- delete from knowledge_points
update exam_knowledge_points
<trim prefix="SET" suffixOverrides=",">
deleted = 1
</trim>
where sp_id in
<foreach item="spId" collection="array" open="(" separator="," close=")">
#{spId}
</foreach>
</update>
</mapper>