<?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.zjrs.zwnw.zj.entity.GccrcQfMapper">

    <select id="getMaxLsh" parameterType="com.zjrs.zwnw.zj.dto.GccrcInfoDTO" resultType="java.lang.String">
        SELECT LPAD(MAX(SUBSTR(rckhm,3)+1), 8 , '0') FROM RS_ZJ_GCCRC_qf
        WHERE SUBSTR(rckhm,6,1)=#{ dto.rcklx }
    </select>
    <select id="getDzkxx" parameterType="com.zjrs.zwnw.zj.dto.GccrcQfQueryDTO"
            resultType="com.zjrs.zwnw.zj.dto.GccrcQfInfoDTO">
        SELECT t1.rs_zj_gccrc_lsh rsZjGccrcLsh,t1.rs_zj_gccrc_qf_lsh rsZjGccrcQfLsh,t1.AAC161 gj,t1.AAC147 zjhm,t1.AAC003 xm,t1.rcklx,
               t1.AAC161 gj,t1.dwmc gzdw,t1.yxrq,t1.tyccid,t1.rckhm FROM RS_ZJ_GCCRC_qf t1
        where t1.rs_zj_gccrc_qf_lsh=#{ dto.rsZjGccrcQfLsh }
    </select>
    <select id="getDzkqfList" parameterType="com.zjrs.zwnw.zj.dto.GccrcQueryByIdPageDTO" resultType="com.zjrs.zwnw.zj.dto.GccrcQfListDTO">
        SELECT rs_zj_gccrc_lsh rsZjGccrcLsh,rs_zj_gccrc_qf_lsh rsZjGccrcQfLsh,qfsj,
               nvl((select user_name from v_rs_sy_org_area where user_id =t.qfr),t.qfr) qfr
        FROM rs_zj_gccrc_qf t WHERE t.rs_zj_gccrc_lsh=#{ dto.rsZjGccrcLsh }
        ORDER BY qfsj desc
    </select>
</mapper>
