<?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.KnowledgePointMapper">
|
<resultMap id="BaseResultMap" type="com.mindskip.xzs.domain.KnowledgePoint">
|
<id column="id" jdbcType="INTEGER" property="id" />
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
<result column="level" jdbcType="INTEGER" property="level" />
|
<result column="subject_id" jdbcType="INTEGER" property="subjectId" />
|
<result column="item_order" jdbcType="INTEGER" property="itemOrder" />
|
<result column="deleted" jdbcType="BIT" property="deleted" />
|
<result column="parent_id" jdbcType="INTEGER" property="parentId" />
|
</resultMap>
|
<sql id="Base_Column_List">
|
id, name, level, subject_id, item_order, deleted, parent_id
|
</sql>
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
from t_knowledge_point
|
where id = #{id,jdbcType=INTEGER}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
delete from t_knowledge_point
|
where id = #{id,jdbcType=INTEGER}
|
</delete>
|
<insert id="insert" parameterType="com.mindskip.xzs.domain.KnowledgePoint" useGeneratedKeys="true" keyProperty="id" >
|
insert into t_knowledge_point (id, name, level,
|
subject_id, item_order, deleted,
|
parent_id)
|
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{level,jdbcType=INTEGER},
|
#{subjectId,jdbcType=INTEGER}, #{itemOrder,jdbcType=INTEGER}, #{deleted,jdbcType=BIT},
|
#{parentId,jdbcType=INTEGER})
|
</insert>
|
<insert id="insertSelective" parameterType="com.mindskip.xzs.domain.KnowledgePoint" useGeneratedKeys="true" keyProperty="id" >
|
insert into t_knowledge_point
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">
|
id,
|
</if>
|
<if test="name != null">
|
name,
|
</if>
|
<if test="level != null">
|
level,
|
</if>
|
<if test="subjectId != null">
|
subject_id,
|
</if>
|
<if test="itemOrder != null">
|
item_order,
|
</if>
|
<if test="deleted != null">
|
deleted,
|
</if>
|
<if test="parentId != null">
|
parent_id,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="id != null">
|
#{id,jdbcType=INTEGER},
|
</if>
|
<if test="name != null">
|
#{name,jdbcType=VARCHAR},
|
</if>
|
<if test="level != null">
|
#{level,jdbcType=INTEGER},
|
</if>
|
<if test="subjectId != null">
|
#{subjectId,jdbcType=INTEGER},
|
</if>
|
<if test="itemOrder != null">
|
#{itemOrder,jdbcType=INTEGER},
|
</if>
|
<if test="deleted != null">
|
#{deleted,jdbcType=BIT},
|
</if>
|
<if test="parentId != null">
|
#{parentId,jdbcType=INTEGER},
|
</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKeySelective" parameterType="com.mindskip.xzs.domain.KnowledgePoint">
|
update t_knowledge_point
|
<set>
|
<if test="name != null">
|
name = #{name,jdbcType=VARCHAR},
|
</if>
|
<if test="level != null">
|
level = #{level,jdbcType=INTEGER},
|
</if>
|
<if test="subjectId != null">
|
subject_id = #{subjectId,jdbcType=INTEGER},
|
</if>
|
<if test="itemOrder != null">
|
item_order = #{itemOrder,jdbcType=INTEGER},
|
</if>
|
<if test="deleted != null">
|
deleted = #{deleted,jdbcType=BIT},
|
</if>
|
<if test="parentId != null">
|
parent_id = #{parentId,jdbcType=INTEGER},
|
</if>
|
</set>
|
where id = #{id,jdbcType=INTEGER}
|
</update>
|
<update id="updateByPrimaryKey" parameterType="com.mindskip.xzs.domain.KnowledgePoint">
|
update t_knowledge_point
|
set name = #{name,jdbcType=VARCHAR},
|
level = #{level,jdbcType=INTEGER},
|
subject_id = #{subjectId,jdbcType=INTEGER},
|
item_order = #{itemOrder,jdbcType=INTEGER},
|
deleted = #{deleted,jdbcType=BIT},
|
parent_id = #{parentId,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
</update>
|
|
|
<select id="getKnowledgePointBySubjectId" resultMap="BaseResultMap" >
|
SELECT
|
<include refid="Base_Column_List"/>
|
FROM t_knowledge_point
|
where deleted=0 and parent_id is null and subject_id = #{id}
|
</select>
|
|
|
|
<select id="getKnowledgePointByParentId" resultMap="BaseResultMap" >
|
SELECT
|
<include refid="Base_Column_List"/>
|
FROM t_knowledge_point
|
where deleted=0 and parent_id = #{id}
|
</select>
|
|
|
<select id="page" resultType="com.mindskip.xzs.domain.other.KnowledgePointPage" parameterType="com.mindskip.xzs.viewmodel.admin.knowledge.KnowledgePageRequestVM">
|
select level ,subject_id as subjectId,count(*) as count from t_knowledge_point
|
where parent_id is null and deleted=0
|
<if test="level != null">
|
and level = #{level}
|
</if>
|
GROUP BY level ,subject_id
|
</select>
|
|
|
<select id="getKnowledgePoint" resultMap="BaseResultMap" >
|
SELECT
|
<include refid="Base_Column_List"/>
|
FROM t_knowledge_point
|
where deleted=0 and name = #{name}
|
and subject_id = #{subjectId} and level = #{levelId}
|
limit 1
|
</select>
|
|
</mapper>
|