<?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="org.jeecg.modules.stm.baosong.mapper.BaosongTaskReviewMapper">

    <select id="queryTaskReview" resultType="java.util.Map">
        SELECT
            A.id AS taskid,
            B.id AS tplid,
            A.name AS taskName,
            A.tp,
            B.nm AS tplName,
            B.code,
            B.xmlfile_path AS xmlfilePath
        FROM baosong_task A
                 INNER JOIN baosong_tpl B ON A.tp = B.tp
        ORDER BY A.id, B.code
    </select>

    <select id="queryTaskRecordForXml" resultType="org.jeecg.modules.stm.baosong.entity.TaskRecordVo">
        SELECT B.content,B.taskid,A.id as itemid,B.rind, A.tplid,A.code,A.pcode,A.title
        FROM  baosong_tpl_item A
        LEFT  JOIN baosong_task_record B ON A.id=B.itemid AND B.taskid=#{query.taskid}

        <where>
            <if test="query.tplid != null">
                AND A.tplid = #{query.tplid}
            </if>
        </where>
        ORDER BY A.id,A.pcode,A.code

    </select>

</mapper>