<?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.assess.proofread.mapper.ProofreadDetailMapper">

	<select id="findByInfoId" resultType="com.jeeplus.assess.proofread.domain.ProofreadDetail">
		SELECT
			a.id,
			a.create_by_id,
			a.create_time,
			a.update_by_id,
			a.update_time,
			a.del_flag,
			a.info_id,
			a.type_id,
			b.`name` AS type_name,
			ifnull(a.review_comments,"") as "reviewComments",
			ifnull(a.reply_comments,"") as "replyComments",
			ifnull(a.is_apply,"") as "isApply",
			b.sort
		FROM proofread_type b
		LEFT JOIN proofread_detail a ON a.type_id = b.id
		AND a.del_flag = 0
		AND a.info_id = #{id}
		ORDER BY b.sort
	</select>

	<select id="findList" resultType="com.jeeplus.assess.proofread.domain.ProofreadDetail">
		SELECT
			id AS type_id,
			create_by_id,
			create_time,
			update_by_id,
			update_time,
			del_flag,
			parent_id,
			parent_ids,
			`level`,
			`name` AS type_name,
			sort
		FROM
			proofread_type
		WHERE
			del_flag = 0
			AND `type` = #{type}
		ORDER BY sort
	</select>

</mapper>
