<?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.sins.mapper.BisSinsReportMapper">
    <resultMap type="com.goldenwater.slaj.sins.domain.BisSinsReport" id="BisSinsReportResult">
        <result property="guid" column="guid"/>
        <result property="reportName" column="report_name"/>
        <result property="shtFilename" column="sht_filename"/>
        <result property="shtUrl" column="sht_url"/>
        <result property="rpxFilename" column="rpx_filename"/>
        <result property="rpxUrl" column="rpx_url"/>
        <result property="objsinsguid" column="objsinsguid"/>
        <result property="note" column="note"/>
        <result property="collTime" column="coll_time"/>
        <result property="updTime" column="upd_time"/>
        <result property="recPers" column="rec_pers"/>
        <result property="reportCode" column="report_code"/>
    </resultMap>

    <sql id="selectBisSinsReportVo">
        select guid, report_name, sht_filename, sht_url, rpx_filename, rpx_url, objsinsguid, note, coll_time, upd_time, rec_pers, report_code from bis_sins_report
    </sql>

    <select id="selectBisSinsReportByGuid" parameterType="String" resultMap="BisSinsReportResult">
        <include refid="selectBisSinsReportVo"/> where guid = #{guid}
    </select>

    <select id="selectBisSinsReportList" parameterType="com.goldenwater.slaj.sins.domain.BisSinsReport" resultMap="BisSinsReportResult">
        <include refid="selectBisSinsReportVo"/>
        <where>
            <if test="reportName != null and reportName != ''">
                and report_name like '%' || #{reportName} || '%'
            </if>
            <if test="objsinsguid != null and objsinsguid != ''">
                and objsinsguid = #{objsinsguid}
            </if>
            <if test="reportCode != null and reportCode != ''">
                and report_code = #{reportCode}
            </if>
        </where>
    </select>

    <insert id="insertBisSinsReport" parameterType="com.goldenwater.slaj.sins.domain.BisSinsReport">
        insert into bis_sins_report (guid, report_name, sht_filename, sht_url, rpx_filename, rpx_url, objsinsguid, note, coll_time, upd_time, rec_pers, report_code)
        values (#{guid}, #{reportName}, #{shtFilename}, #{shtUrl}, #{rpxFilename}, #{rpxUrl}, #{objsinsguid}, #{note}, #{collTime}, #{updTime}, #{recPers}, #{reportCode})
    </insert>

    <update id="updateBisSinsReport" parameterType="com.goldenwater.slaj.sins.domain.BisSinsReport">
        update bis_sins_report
        <set>
            <if test="reportName != null and reportName != ''">report_name = #{reportName},</if>
            <if test="shtFilename != null and shtFilename != ''">sht_filename = #{shtFilename},</if>
            <if test="shtUrl != null and shtUrl != ''">sht_url = #{shtUrl},</if>
            <if test="rpxFilename != null and rpxFilename != ''">rpx_filename = #{rpxFilename},</if>
            <if test="rpxUrl != null and rpxUrl != ''">rpx_url = #{rpxUrl},</if>
            <if test="objsinsguid != null and objsinsguid != ''">objsinsguid = #{objsinsguid},</if>
            <if test="note != null and note != ''">note = #{note},</if>
            <if test="collTime != null">coll_time = #{collTime},</if>
            <if test="updTime != null">upd_time = #{updTime},</if>
            <if test="recPers != null and recPers != ''">rec_pers = #{recPers},</if>
            <if test="reportCode != null and reportCode != ''">report_code = #{reportCode},</if>
        </set>
        where guid = #{guid}
    </update>

    <delete id="deleteBisSinsReportByGuid" parameterType="String">
        delete from bis_sins_report where guid = #{guid}
    </delete>

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