<?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.goldenwater.slaj.stan.mapper.BisStanScoreMapper">
    <resultMap type="com.goldenwater.slaj.stan.domain.BisStanScore" id="BisStanScoreResult">
        <result property="guid" column="guid"/>
        <result property="pGuid" column="p_guid"/>
        <result property="name" column="name"/>
        <result property="stanScore" column="stan_score"/>
        <result property="reseScore" column="rese_score"/>
        <result property="actScore" column="act_score"/>
        <result property="scorRate" column="scor_rate"/>
        <result property="stanStanGuid" column="stan_stan_guid"/>
        <result property="bisStanSelfEva" column="bis_stan_self_eva"/>
        <result property="stanReviGuid" column="stan_revi_guid"/>
        <result property="stanSelfEvaScoreGuid" column="stan_self_eva_score_guid"/>
        <result property="note" column="note"/>
        <result property="collTime" column="coll_time"/>
        <result property="updTime" column="upd_time"/>
        <result property="recPers" column="rec_pers"/>
    </resultMap>

    <sql id="selectBisStanScoreVo">
        select guid, p_guid, name, stan_score, rese_score, act_score,
               scor_rate, stan_stan_guid, bis_stan_self_eva, stan_revi_guid,
               stan_self_eva_score_guid, note, coll_time, upd_time, rec_pers
        from bis_stan_score
    </sql>

    <select id="selectBisStanScoreByGuid" parameterType="String" resultMap="BisStanScoreResult">
        <include refid="selectBisStanScoreVo"/> where guid = #{guid}
    </select>

    <select id="selectBisStanScoreList" parameterType="com.goldenwater.slaj.stan.domain.BisStanScore" resultMap="BisStanScoreResult">
        <include refid="selectBisStanScoreVo"/>
        <where>
            <if test="pGuid != null and pGuid != ''">and p_guid = #{pGuid}</if>
            <if test="stanReviGuid != null and stanReviGuid != ''">and stan_revi_guid = #{stanReviGuid}</if>
            <if test="name != null and name != ''">and name like '%' || #{name} || '%'</if>
        </where>
    </select>

    <insert id="insertBisStanScore" parameterType="com.goldenwater.slaj.stan.domain.BisStanScore">
        insert into bis_stan_score (
            guid, p_guid, name, stan_score, rese_score, act_score,
            scor_rate, stan_stan_guid, bis_stan_self_eva, stan_revi_guid,
            stan_self_eva_score_guid, note, coll_time, upd_time, rec_pers
        ) values (
            #{guid}, #{pGuid}, #{name}, #{stanScore}, #{reseScore}, #{actScore},
            #{scorRate}, #{stanStanGuid}, #{bisStanSelfEva}, #{stanReviGuid},
            #{stanSelfEvaScoreGuid}, #{note}, #{collTime}, #{updTime}, #{recPers}
        )
    </insert>

    <update id="updateBisStanScore" parameterType="com.goldenwater.slaj.stan.domain.BisStanScore">
        update bis_stan_score
        <set>
            <if test="pGuid != null">p_guid = #{pGuid},</if>
            <if test="name != null">name = #{name},</if>
            <if test="stanScore != null">stan_score = #{stanScore},</if>
            <if test="reseScore != null">rese_score = #{reseScore},</if>
            <if test="actScore != null">act_score = #{actScore},</if>
            <if test="scorRate != null">scor_rate = #{scorRate},</if>
            <if test="stanStanGuid != null">stan_stan_guid = #{stanStanGuid},</if>
            <if test="bisStanSelfEva != null">bis_stan_self_eva = #{bisStanSelfEva},</if>
            <if test="stanReviGuid != null">stan_revi_guid = #{stanReviGuid},</if>
            <if test="stanSelfEvaScoreGuid != null">stan_self_eva_score_guid = #{stanSelfEvaScoreGuid},</if>
            <if test="note != null">note = #{note},</if>
            <if test="updTime != null">upd_time = #{updTime},</if>
            <if test="recPers != null">rec_pers = #{recPers},</if>
        </set>
        where guid = #{guid}
    </update>

    <delete id="deleteBisStanScoreByGuid" parameterType="String">
        delete from bis_stan_score where guid = #{guid}
    </delete>

    <delete id="deleteBisStanScoreByGuids" parameterType="String">
        delete from bis_stan_score where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
