<?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.tofly.feesapi.yhgl.mapper.YyZjzhMapper">

    <select id="get" resultType="com.tofly.feesapi.yhgl.entity.vo.YyZjzhView">
        SELECT
            b.*,
            nvl(a.yfje,0) yfje,
            nvl(a.kjje,0) kjje,
            nvl(a.syje,0) syje,
            nvl(a.nbsyje,0) nbsyje
        FROM
            yy_zjzh a
        RIGHT JOIN
            yh_khjbxx b ON a.yhbh = b.yhbh
        WHERE
            b.yhbh=#{yhbh}
    </select>

    <update id="ycch">
        UPDATE
            YY_ZJZH
        SET
            YFJE = ( YFJE - #{sszje} ),
            SYJE = ( syje - #{sszje} ),
            NBSYJE = ( nbsyje - #{sszje} )
        WHERE
            YHBH = #{yhbh}
    </update>

    <update id="kfch">
        UPDATE
            YY_ZJZH
        SET
            KJJE = ( KJJE - #{kjje} ),
            SYJE = ( SYJE + #{kjje} ),
            NBSYJE = ( NBSYJE + #{kjje} )
        WHERE
            YHBH = #{yhbh}
    </update>

</mapper>
