<?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.dgtly.sync.mapper.MetaNipponOrgRelationMapper">

    <resultMap type="MetaNipponOrgRelation" id="MetaNipponOrgRelationResult">
        <result property="objid"    column="objid"    />
        <result property="short"    column="short"    />
        <result property="stext"    column="stext"    />
        <result property="sobid"    column="sobid"    />
        <result property="lineId"    column="line_id"    />
        <result property="packageId"    column="package_id"    />
    </resultMap>

    <sql id="selectMetaNipponOrgRelationVo">
        select objid, short, stext, sobid, line_id, package_id from meta_nippon_org_relation
    </sql>

    <select id="selectMetaNipponOrgRelationList" parameterType="MetaNipponOrgRelation" resultMap="MetaNipponOrgRelationResult">
        <include refid="selectMetaNipponOrgRelationVo"/>
        <where>
            <if test="objid != null "> and objid = #{objid}</if>
            <if test="short != null  and short != ''"> and short = #{short}</if>
            <if test="stext != null  and stext != ''"> and stext = #{stext}</if>
            <if test="sobid != null  and sobid != ''"> and sobid = #{sobid}</if>
            <if test="lineId != null  and lineId != ''"> and line_id = #{lineId}</if>
            <if test="packageId != null  and packageId != ''"> and package_id = #{packageId}</if>
        </where>
    </select>

    <select id="selectMetaNipponOrgRelationById" parameterType="Long" resultMap="MetaNipponOrgRelationResult">
        <include refid="selectMetaNipponOrgRelationVo"/>
        where objid = #{objid}
    </select>

    <insert id="insertMetaNipponOrgRelation" parameterType="MetaNipponOrgRelation">
        insert into meta_nippon_org_relation
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="objid != null ">objid,</if>
            <if test="short != null  and short != ''">short,</if>
            <if test="stext != null  and stext != ''">stext,</if>
            <if test="sobid != null  and sobid != ''">sobid,</if>
            <if test="lineId != null  and lineId != ''">line_id,</if>
            <if test="packageId != null  and packageId != ''">package_id,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="objid != null ">#{objid},</if>
            <if test="short != null  and short != ''">#{short},</if>
            <if test="stext != null  and stext != ''">#{stext},</if>
            <if test="sobid != null  and sobid != ''">#{sobid},</if>
            <if test="lineId != null  and lineId != ''">#{lineId},</if>
            <if test="packageId != null  and packageId != ''">#{packageId},</if>
        </trim>
    </insert>

    <update id="updateMetaNipponOrgRelation" parameterType="MetaNipponOrgRelation">
        update meta_nippon_org_relation
        <trim prefix="SET" suffixOverrides=",">
            <if test="short != null  and short != ''">short = #{short},</if>
            <if test="stext != null  and stext != ''">stext = #{stext},</if>
            <if test="sobid != null  and sobid != ''">sobid = #{sobid},</if>
            <if test="lineId != null  and lineId != ''">line_id = #{lineId},</if>
            <if test="packageId != null  and packageId != ''">package_id = #{packageId},</if>
        </trim>
        where objid = #{objid}
    </update>

    <delete id="deleteMetaNipponOrgRelationById" parameterType="Long">
        delete from meta_nippon_org_relation where objid = #{objid}
    </delete>

    <delete id="deleteMetaNipponOrgRelationByIds" parameterType="String">
        delete from meta_nippon_org_relation where objid in
        <foreach item="objid" collection="array" open="(" separator="," close=")">
            #{objid}
        </foreach>
    </delete>

</mapper>