<?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.hazard.mapper.TDictMajorEdMapper">
    <resultMap type="com.goldenwater.slaj.hazard.domain.TDictMajorEd" id="TDictMajorEdResult">
        <result property="guid" column="guid"/>
        <result property="majorType" column="major_type"/>
        <result property="project" column="project"/>
        <result property="majorCon" column="major_con"/>
        <result property="accident" column="accident"/>
        <result property="version" column="version"/>
        <result property="incentive" column="incentive"/>
        <result property="riskMethod" column="risk_method"/>
        <result property="l" column="l"/>
        <result property="e" column="e"/>
        <result property="sOrC" column="s_or_c"/>
        <result property="rOrD" column="r_or_d"/>
    </resultMap>
    <sql id="selectTDictMajorEdVo">
        select guid, major_type, project, major_con, accident, version, incentive, risk_method, l, e, s_or_c, r_or_d
        from t_dict_major_ed
    </sql>
    <select id="selectTDictMajorEdByGuid" parameterType="String" resultMap="TDictMajorEdResult">
        <include refid="selectTDictMajorEdVo"/>
        where guid = #{guid}
    </select>
    <select id="selectTDictMajorEdList" parameterType="com.goldenwater.slaj.hazard.domain.TDictMajorEd" resultMap="TDictMajorEdResult">
        <include refid="selectTDictMajorEdVo"/>
        <where>
            <if test="majorType != null and majorType != ''">AND major_type like '%' || #{majorType} || '%'</if>
            <if test="project != null and project != ''">AND project like '%' || #{project} || '%'</if>
            <if test="majorCon != null and majorCon != ''">AND major_con like '%' || #{majorCon} || '%'</if>
            <if test="accident != null and accident != ''">AND accident = #{accident}</if>
            <if test="version != null and version != ''">AND version = #{version}</if>
            <if test="incentive != null and incentive != ''">AND incentive = #{incentive}</if>
        </where>
    </select>
    <insert id="insertTDictMajorEd" parameterType="com.goldenwater.slaj.hazard.domain.TDictMajorEd">
        insert into t_dict_major_ed (
            guid,
            major_type,
            project,
            major_con,
            accident,
            version,
            incentive,
            risk_method,
            l,
            e,
            s_or_c,
            r_or_d
        ) values (
            #{guid},
            #{majorType},
            #{project},
            #{majorCon},
            #{accident},
            #{version},
            #{incentive},
            #{riskMethod},
            #{l},
            #{e},
            #{sOrC},
            #{rOrD}
        )
    </insert>
    <update id="updateTDictMajorEd" parameterType="com.goldenwater.slaj.hazard.domain.TDictMajorEd">
        update t_dict_major_ed
        <set>
            <if test="majorType != null">major_type = #{majorType},</if>
            <if test="project != null">project = #{project},</if>
            <if test="majorCon != null">major_con = #{majorCon},</if>
            <if test="accident != null">accident = #{accident},</if>
            <if test="version != null">version = #{version},</if>
            <if test="incentive != null">incentive = #{incentive},</if>
            <if test="riskMethod != null">risk_method = #{riskMethod},</if>
            <if test="l != null">l = #{l},</if>
            <if test="e != null">e = #{e},</if>
            <if test="sOrC != null">s_or_c = #{sOrC},</if>
            <if test="rOrD != null">r_or_d = #{rOrD},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteTDictMajorEdByGuid" parameterType="String">
        delete from t_dict_major_ed where guid = #{guid}
    </delete>
    <delete id="deleteTDictMajorEdByGuids" parameterType="String">
        delete from t_dict_major_ed where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
