<?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.hxhq.business.mapper.StudyFormPlanMapper">
    <select id="queryList" resultType="com.hxhq.business.dto.study.StudyFormPlanListDto">
        select t.id,t.bdbh,t.bdmc,t.create_time,t.user_mc,t.user_id,t.bdzt,t.bdzt,t.tjsj,tm.name as templateMc,tm.sn as templateSn
        FROM `t_study_form_plan` t
        join t_template tm on tm.id=t.template_id
        <if test="ew.sqlSegment != '' and ew.sqlSegment != null">
            <where>
                ${ew.sqlSegment}
            </where>
        </if>
    </select>

    <select id="queryInfo" resultType="com.hxhq.business.domain.StudyFormPlan">
        select t.*,tm.name as templateMc,tm.name_en as templateMcEn,tm.sn as templateSn,tm.show_sn as templateShowSn
                  ,ts.sn as studySn,ts.name as studyMc,tm.export_class as templateExportClass,tm.export_method as templateExportMethod
        FROM `t_study_form_plan` t
        join t_template tm on tm.id=t.template_id
        join t_study ts on ts.id=t.study_id
        where t.id=#{id}
    </select>

    <update id="updateBdnr" >
        update  t_study_form_plan set bdnr=#{bdnr}  where id=#{id};
    </update>

    <update id="updateSubmittedCodes" >
        update  t_study_form_plan set submitted_codes=#{submittedCodes}  where id=#{id};
    </update>

    <update id="updateBdnrZdxgjl" >
        update  t_study_form_plan set bdnr=#{bdnr},zdxgjl=#{zdxgjl}  where id=#{id};
    </update>

    <update id="updateFhyjjl" >
        update  t_study_form_plan set fhyjjl=#{fhyjjl}  where id=#{id};
    </update>

    <update id="updateZdgxjl" >
        update  t_study_form_plan set zdgxjl=#{zdgxjl}  where id=#{id};
    </update>

</mapper>