<?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.rlzysc.entity.VRsRlzyZwwzglMapper">
    <insert id="insertZwXx" useGeneratedKeys="false">
        begin
        <foreach collection="list" index="index" item="vrsrlzyzwwzglpo">
            insert into v_rs_rlzy_zwwzgl
            (rs_rlzy_zwwzgl_lsh, rs_rlzy_zwgl_lsh, hsh, lsh, zwzt, zwwzmc)
            values
            (
            #{vrsrlzyzwwzglpo.rsrlzyzwwzgllsh},
            #{vrsrlzyzwwzglpo.rsrlzyzwgllsh},
            #{vrsrlzyzwwzglpo.hsh},
            #{vrsrlzyzwwzglpo.lsh},
            #{vrsrlzyzwwzglpo.zwzt},
            #{vrsrlzyzwwzglpo.zwwzmc}
            );
        </foreach>
        end;
    </insert>

    <update id="updateZwXx" useGeneratedKeys="false">
        begin
        <foreach collection="list" index="index" item="vrsrlzyzwwzglpo">
            update v_rs_rlzy_zwwzgl
            <set>
                <trim suffixOverrides=",">
                    <if test="vrsrlzyzwwzglpo.hsh!=null and vrsrlzyzwwzglpo.hsh!=''">
                        hsh=#{vrsrlzyzwwzglpo.hsh},
                    </if>
                    <if test="vrsrlzyzwwzglpo.lsh!=null and vrsrlzyzwwzglpo.lsh!=''">
                        lsh=#{vrsrlzyzwwzglpo.lsh},
                    </if>
                    <if test="vrsrlzyzwwzglpo.zwzt!=null and vrsrlzyzwwzglpo.zwzt!=''">
                        zwzt=#{vrsrlzyzwwzglpo.zwzt},
                    </if>
                    <if test="vrsrlzyzwwzglpo.zwwzmc!=null and vrsrlzyzwwzglpo.zwwzmc!=''">
                        zwwzmc=#{vrsrlzyzwwzglpo.zwwzmc},
                    </if>
                </trim>
            </set>
            where rs_rlzy_zwwzgl_lsh = #{vrsrlzyzwwzglpo.rsrlzyzwwzgllsh};
        </foreach>
        end;
    </update>

    <select id="getZwList" parameterType="HashMap" resultType="HashMap">
        select rs_rlzy_zwwzgl_lsh as "rsrlzyzwwzgllsh",
        hsh as "hsh",
        lsh as "lsh",
        zwzt as "zwzt",
        zwwzmc as "zwwzmc"
        from v_rs_rlzy_zwwzgl where rs_rlzy_zwgl_lsh = #{map.rsrlzyzwgllsh}
        and hsh = #{map.hsh} order by to_number(lsh)
    </select>

    <select id="getDixtinctHshList" parameterType="String" resultType="String">
        select distinct hsh from v_rs_rlzy_zwwzgl where rs_rlzy_zwgl_lsh = #{rsrlzyzwgllsh} order by to_number(hsh)
    </select>

</mapper>
