<?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.TDictMajorCommonMapper">
    <resultMap type="com.goldenwater.slaj.hazard.domain.TDictMajorCommon" id="TDictMajorCommonResult">
        <result property="guid" column="guid"/>
        <result property="type" column="type"/>
        <result property="project" column="project"/>
        <result property="major" column="major"/>
        <result property="reason" column="reason"/>
        <result property="aftermath" column="aftermath"/>
        <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"/>
        <result property="riskGrad" column="risk_grad"/>
        <result property="engType" column="eng_type"/>
        <result property="version" column="version"/>
        <result property="accident" column="accident"/>
    </resultMap>
    <sql id="selectTDictMajorCommonVo">
        select guid, type, project, major, reason, aftermath, risk_method, l, e, s_or_c, r_or_d, risk_grad, eng_type, version, accident
        from t_dict_major_common
    </sql>
    <select id="selectTDictMajorCommonByGuid" parameterType="String" resultMap="TDictMajorCommonResult">
        <include refid="selectTDictMajorCommonVo"/>
        where guid = #{guid}
    </select>
    <select id="selectTDictMajorCommonList" parameterType="com.goldenwater.slaj.hazard.domain.TDictMajorCommon" resultMap="TDictMajorCommonResult">
        <include refid="selectTDictMajorCommonVo"/>
        <where>
            <if test="type != null and type != ''">AND type like '%' || #{type} || '%'</if>
            <if test="project != null and project != ''">AND project like '%' || #{project} || '%'</if>
            <if test="major != null and major != ''">AND major like '%' || #{major} || '%'</if>
            <if test="reason != null and reason != ''">AND reason = #{reason}</if>
            <if test="aftermath != null and aftermath != ''">AND aftermath = #{aftermath}</if>
            <if test="riskMethod != null and riskMethod != ''">AND risk_method = #{riskMethod}</if>
            <if test="l != null and l != ''">AND l = #{l}</if>
            <if test="e != null and e != ''">AND e = #{e}</if>
            <if test="sOrC != null and sOrC != ''">AND s_or_c = #{sOrC}</if>
            <if test="rOrD != null and rOrD != ''">AND r_or_d = #{rOrD}</if>
            <if test="riskGrad != null and riskGrad != ''">AND risk_grad = #{riskGrad}</if>
            <if test="engType != null and engType != ''">AND eng_type = #{engType}</if>
            <if test="version != null and version != ''">AND version = #{version}</if>
        </where>
    </select>
    <insert id="insertTDictMajorCommon" parameterType="com.goldenwater.slaj.hazard.domain.TDictMajorCommon">
        insert into t_dict_major_common (
            guid,
            type,
            project,
            major,
            reason,
            aftermath,
            risk_method,
            l,
            e,
            s_or_c,
            r_or_d,
            risk_grad,
            eng_type,
            version,
            accident
        ) values (
            #{guid},
            #{type},
            #{project},
            #{major},
            #{reason},
            #{aftermath},
            #{riskMethod},
            #{l},
            #{e},
            #{sOrC},
            #{rOrD},
            #{riskGrad},
            #{engType},
            #{version},
            #{accident}
        )
    </insert>
    <update id="updateTDictMajorCommon" parameterType="com.goldenwater.slaj.hazard.domain.TDictMajorCommon">
        update t_dict_major_common
        <set>
            <if test="type != null">type = #{type},</if>
            <if test="project != null">project = #{project},</if>
            <if test="major != null">major = #{major},</if>
            <if test="reason != null">reason = #{reason},</if>
            <if test="aftermath != null">aftermath = #{aftermath},</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>
            <if test="riskGrad != null">risk_grad = #{riskGrad},</if>
            <if test="engType != null">eng_type = #{engType},</if>
            <if test="version != null">version = #{version},</if>
            <if test="accident != null">accident = #{accident},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteTDictMajorCommonByGuid" parameterType="String">
        delete from t_dict_major_common where guid = #{guid}
    </delete>
    <delete id="deleteTDictMajorCommonByGuids" parameterType="String">
        delete from t_dict_major_common where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
