<?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.RelSinsGroupToWiunMapper">
    <resultMap type="com.goldenwater.slaj.sins.domain.RelSinsGroupToWiun" id="RelSinsGroupToWiunResult">
        <result property="guid" column="guid"/>
        <result property="groupGuid" column="group_guid"/>
        <result property="objGuid" column="obj_guid"/>
        <result property="fromDate" column="from_date"/>
        <result property="toDate" column="to_date"/>
        <result property="stat" column="stat"/>
        <result property="sinsType" column="sins_type"/>
    </resultMap>

    <sql id="selectRelSinsGroupToWiunVo">
        select guid, group_guid, obj_guid, from_date, to_date, stat, sins_type from rel_sins_group_wiun
    </sql>

    <select id="selectRelSinsGroupToWiunByGuid" parameterType="String" resultMap="RelSinsGroupToWiunResult">
        <include refid="selectRelSinsGroupToWiunVo"/> where guid = #{guid}
    </select>

    <select id="selectRelSinsGroupToWiunList" parameterType="com.goldenwater.slaj.sins.domain.RelSinsGroupToWiun" resultMap="RelSinsGroupToWiunResult">
        <include refid="selectRelSinsGroupToWiunVo"/>
        <where>
            <if test="groupGuid != null and groupGuid != ''">
                and group_guid = #{groupGuid}
            </if>
            <if test="objGuid != null and objGuid != ''">
                and obj_guid = #{objGuid}
            </if>
            <if test="sinsType != null and sinsType != ''">
                and sins_type = #{sinsType}
            </if>
        </where>
    </select>

    <insert id="insertRelSinsGroupToWiun" parameterType="com.goldenwater.slaj.sins.domain.RelSinsGroupToWiun">
        insert into rel_sins_group_wiun (guid, group_guid, obj_guid, from_date, to_date, stat, sins_type)
        values (#{guid}, #{groupGuid}, #{objGuid}, #{fromDate}, #{toDate}, #{stat}, #{sinsType})
    </insert>

    <update id="updateRelSinsGroupToWiun" parameterType="com.goldenwater.slaj.sins.domain.RelSinsGroupToWiun">
        update rel_sins_group_wiun
        <set>
            <if test="groupGuid != null and groupGuid != ''">group_guid = #{groupGuid},</if>
            <if test="objGuid != null and objGuid != ''">obj_guid = #{objGuid},</if>
            <if test="fromDate != null">from_date = #{fromDate},</if>
            <if test="toDate != null">to_date = #{toDate},</if>
            <if test="stat != null and stat != ''">stat = #{stat},</if>
            <if test="sinsType != null and sinsType != ''">sins_type = #{sinsType},</if>
        </set>
        where guid = #{guid}
    </update>

    <delete id="deleteRelSinsGroupToWiunByGuid" parameterType="String">
        delete from rel_sins_group_wiun where guid = #{guid}
    </delete>

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