<?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.hidd.mapper.ObjEngMapper">
    <resultMap type="com.goldenwater.slaj.hidd.domain.ObjEng" id="ObjEngResult">
        <result property="guid" column="guid"/>
        <result property="engCode" column="eng_code"/>
        <result property="engName" column="eng_name"/>
        <result property="engType" column="eng_type"/>
        <result property="fromDate" column="from_date"/>
        <result property="toDate" column="to_date"/>
        <result property="pubGuid" column="pub_guid"/>
        <result property="orgJurd" column="org_jurd"/>
        <result property="orgRest" column="org_rest"/>
        <result property="oldCode" column="old_code"/>
        <result property="manageMode" column="manage_mode"/>
    </resultMap>
    <sql id="selectObjEngVo">
        select guid, eng_code, eng_name, eng_type, from_date, to_date, pub_guid, org_jurd,
               org_rest, old_code, manage_mode
        from obj_eng
    </sql>
    <select id="selectObjEngByGuid" parameterType="String" resultMap="ObjEngResult">
        <include refid="selectObjEngVo"/>
        where guid = #{guid}
    </select>
    <select id="selectObjEngList" parameterType="com.goldenwater.slaj.hidd.domain.ObjEng" resultMap="ObjEngResult">
        <include refid="selectObjEngVo"/>
        <where>
            <if test="engName != null and engName != ''">AND eng_name like '%' || #{engName} || '%'</if>
            <if test="engType != null and engType != ''">AND eng_type = #{engType}</if>
        </where>
    </select>
    <insert id="insertObjEng" parameterType="com.goldenwater.slaj.hidd.domain.ObjEng">
        insert into obj_eng (guid, eng_code, eng_name, eng_type, from_date, to_date, pub_guid, org_jurd, org_rest, old_code, manage_mode)
        values (#{guid}, #{engCode}, #{engName}, #{engType}, #{fromDate}, #{toDate}, #{pubGuid}, #{orgJurd}, #{orgRest}, #{oldCode}, #{manageMode})
    </insert>
    <update id="updateObjEng" parameterType="com.goldenwater.slaj.hidd.domain.ObjEng">
        update obj_eng
        <set>
            <if test="engCode != null">eng_code = #{engCode},</if>
            <if test="engName != null">eng_name = #{engName},</if>
            <if test="engType != null">eng_type = #{engType},</if>
            <if test="fromDate != null">from_date = #{fromDate},</if>
            <if test="toDate != null">to_date = #{toDate},</if>
            <if test="pubGuid != null">pub_guid = #{pubGuid},</if>
            <if test="orgJurd != null">org_jurd = #{orgJurd},</if>
            <if test="orgRest != null">org_rest = #{orgRest},</if>
            <if test="oldCode != null">old_code = #{oldCode},</if>
            <if test="manageMode != null">manage_mode = #{manageMode},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteObjEngByGuid" parameterType="String">
        delete from obj_eng where guid = #{guid}
    </delete>
    <delete id="deleteObjEngByGuids" parameterType="String">
        delete from obj_eng where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
