<?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.ruoyi.ie.mapper.AEnrollSkillMapper">
    
    <resultMap type="AEnrollSkill" id="AEnrollSkillResult">
        <result property="id"    column="id"    />
        <result property="year"    column="year"    />
        <result property="universityId"    column="universityId"    />
        <result property="universityName"    column="universityName"    />
        <result property="majorGroup"    column="majorGroup"    />
        <result property="majorName"    column="majorName"    />
        <result property="majorDirection"    column="majorDirection"    />
        <result property="scoreTotal"    column="scoreTotal"    />
        <result property="itemGroup"    column="itemGroup"    />
        <result property="examineeType"    column="examineeType"    />
        <result property="itemType"    column="itemType"    />
        <result property="itemName"    column="itemName"    />
        <result property="valueType"    column="valueType"    />
        <result property="value"    column="value"    />
        <result property="correctType"    column="correctType"    />
        <result property="correctValue"    column="correctValue"    />
        <result property="comment"    column="comment"    />
    </resultMap>

    <sql id="selectAEnrollSkillVo">
        select id, year, universityId, universityName, majorGroup, majorName, majorDirection, scoreTotal, itemGroup, examineeType, itemType, itemName, valueType, value, correctType, correctValue, comment from a_enroll_skill
    </sql>

    <select id="selectAEnrollSkillList" parameterType="AEnrollSkill" resultMap="AEnrollSkillResult">
        <include refid="selectAEnrollSkillVo"/>
        <where>  
            <if test="year != null "> and year = #{year}</if>
            <if test="universityId != null "> and universityId = #{universityId}</if>
            <if test="universityName != null  and universityName != ''"> and universityName like concat('%', #{universityName}, '%')</if>
            <if test="majorGroup != null  and majorGroup != ''"> and majorGroup = #{majorGroup}</if>
            <if test="majorName != null  and majorName != ''"> and majorName like concat('%', #{majorName}, '%')</if>
            <if test="majorDirection != null  and majorDirection != ''"> and majorDirection = #{majorDirection}</if>
            <if test="scoreTotal != null "> and scoreTotal = #{scoreTotal}</if>
            <if test="itemGroup != null  and itemGroup != ''"> and itemGroup = #{itemGroup}</if>
            <if test="examineeType != null  and examineeType != ''"> and examineeType = #{examineeType}</if>
            <if test="itemType != null  and itemType != ''"> and itemType = #{itemType}</if>
            <if test="itemName != null  and itemName != ''"> and itemName like concat('%', #{itemName}, '%')</if>
            <if test="valueType != null  and valueType != ''"> and valueType = #{valueType}</if>
            <if test="value != null  and value != ''"> and value = #{value}</if>
            <if test="correctType != null "> and correctType = #{correctType}</if>
            <if test="correctValue != null  and correctValue != ''"> and correctValue = #{correctValue}</if>
            <if test="comment != null  and comment != ''"> and comment = #{comment}</if>
        </where>
    </select>
    
    <select id="selectAEnrollSkillById" parameterType="Long" resultMap="AEnrollSkillResult">
        <include refid="selectAEnrollSkillVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertAEnrollSkill" parameterType="AEnrollSkill" useGeneratedKeys="true" keyProperty="id">
        insert into a_enroll_skill
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="year != null">year,</if>
            <if test="universityId != null">universityId,</if>
            <if test="universityName != null">universityName,</if>
            <if test="majorGroup != null">majorGroup,</if>
            <if test="majorName != null">majorName,</if>
            <if test="majorDirection != null">majorDirection,</if>
            <if test="scoreTotal != null">scoreTotal,</if>
            <if test="itemGroup != null">itemGroup,</if>
            <if test="examineeType != null">examineeType,</if>
            <if test="itemType != null">itemType,</if>
            <if test="itemName != null">itemName,</if>
            <if test="valueType != null">valueType,</if>
            <if test="value != null">value,</if>
            <if test="correctType != null">correctType,</if>
            <if test="correctValue != null">correctValue,</if>
            <if test="comment != null">comment,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="year != null">#{year},</if>
            <if test="universityId != null">#{universityId},</if>
            <if test="universityName != null">#{universityName},</if>
            <if test="majorGroup != null">#{majorGroup},</if>
            <if test="majorName != null">#{majorName},</if>
            <if test="majorDirection != null">#{majorDirection},</if>
            <if test="scoreTotal != null">#{scoreTotal},</if>
            <if test="itemGroup != null">#{itemGroup},</if>
            <if test="examineeType != null">#{examineeType},</if>
            <if test="itemType != null">#{itemType},</if>
            <if test="itemName != null">#{itemName},</if>
            <if test="valueType != null">#{valueType},</if>
            <if test="value != null">#{value},</if>
            <if test="correctType != null">#{correctType},</if>
            <if test="correctValue != null">#{correctValue},</if>
            <if test="comment != null">#{comment},</if>
         </trim>
    </insert>

    <update id="updateAEnrollSkill" parameterType="AEnrollSkill">
        update a_enroll_skill
        <trim prefix="SET" suffixOverrides=",">
            <if test="year != null">year = #{year},</if>
            <if test="universityId != null">universityId = #{universityId},</if>
            <if test="universityName != null">universityName = #{universityName},</if>
            <if test="majorGroup != null">majorGroup = #{majorGroup},</if>
            <if test="majorName != null">majorName = #{majorName},</if>
            <if test="majorDirection != null">majorDirection = #{majorDirection},</if>
            <if test="scoreTotal != null">scoreTotal = #{scoreTotal},</if>
            <if test="itemGroup != null">itemGroup = #{itemGroup},</if>
            <if test="examineeType != null">examineeType = #{examineeType},</if>
            <if test="itemType != null">itemType = #{itemType},</if>
            <if test="itemName != null">itemName = #{itemName},</if>
            <if test="valueType != null">valueType = #{valueType},</if>
            <if test="value != null">value = #{value},</if>
            <if test="correctType != null">correctType = #{correctType},</if>
            <if test="correctValue != null">correctValue = #{correctValue},</if>
            <if test="comment != null">comment = #{comment},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteAEnrollSkillById" parameterType="Long">
        delete from a_enroll_skill where id = #{id}
    </delete>

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