You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
know_sub/know_sub_model/src/main/resources/mapper/KnowledgeMapper.xml

52 lines
2.4 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="com.supervision.knowsub.mapper.KnowledgeMapper">
<resultMap id="BaseResultMap" type="com.supervision.knowsub.model.Knowledge">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="title" column="title" jdbcType="VARCHAR"/>
<result property="contentId" column="content_id" jdbcType="VARCHAR"/>
<result property="baseId" column="base_id" jdbcType="VARCHAR"/>
<result property="publishDept" column="publish_dept_id" jdbcType="VARCHAR"/>
<result property="knowledgeFrom" column="knowledge_from" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="submittedDeptId" column="submitted_dept" jdbcType="VARCHAR"/>
<result property="draftBelongUserId" column="draft_belong_user_id" jdbcType="VARCHAR"/>
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id
,title,content_id,
base_id,publish_dept,knowledge_from,
status,submitted_dept_id,create_user_id,
create_time,update_user_id,update_time
</sql>
<select id="queryKnowledgePage" resultType="com.supervision.knowsub.model.Knowledge">
select
<include refid="Base_Column_List"/>
from ks_knowledge
<where>
-- 如果是null,则是全部,这时查询归属于自己的草稿,和其他非草稿的所有的
<if test="status == null">
and ( draft_belong_user_id = #{userId} or status != 1)
</if>
<if test="status != null">
and ( status = #{status} )
</if>
<if test="title != null and title != ''">
and title like concat('%',#{title},'%')
</if>
<if test="publishDeptName != null and publishDeptName != ''">
and publish_dept_id like concat('%',#{publishDeptName},'%')
</if>
</where>
order by create
</select>
</mapper>