<?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.jeeplus.test.knowledge.mapper.KnowledgeShareTypeMapper">

	<select id="findList" resultType="com.jeeplus.test.knowledge.service.dto.KnowledgeShareTypeDto">
		SELECT
			a.id,
			b.`name` AS create_by,
			a.create_date,
			a.update_by,
			a.update_date,
			a.del_flag,
			a.klgs_key,
			a.klgs_type,
			a.klgs_sort
		FROM
			knowledge_share_type a
			LEFT JOIN sys_user b ON a.create_by = b.id
		WHERE
			a.del_flag = 0
			<if test="type != null and type != ''">
				AND a.klgs_type LIKE CONCAT ('%', #{type}, '%')
			</if>
		ORDER BY
			a.klgs_sort
	</select>

	<select id="checkList" resultType="com.jeeplus.test.knowledge.domain.KnowledgeShareType">
		SELECT
			id,
			create_by,
			create_date,
			update_by,
			update_date,
			del_flag,
			klgs_key,
			klgs_type,
			klgs_sort
		FROM
			knowledge_share_type
		WHERE
			del_flag =0
			AND klgs_key = #{type.klgsKey}
			AND klgs_type = #{type.klgsType}
			<if test="type.id != null and type.id != ''">
				AND id != #{type.id}
			</if>
	</select>

</mapper>
