<?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.sy.mapper.SyMajorOverviewMapper">

    <resultMap type="SyMajorOverview" id="SyMajorOverviewResult">
        <result property="id"    column="id"    />
        <result property="code"    column="code"    />
        <result property="name"    column="name"    />
        <result property="childCount"    column="child_count"    />
        <result property="degree"    column="degree"    />
        <result property="eduLevel"    column="edu_level"    />
        <result property="eduObjective"    column="edu_objective"    />
        <result property="eduRequirement"    column="edu_requirement"    />
        <result property="employmentHeat"    column="employment_heat"    />
        <result property="famousScholar"    column="famous_scholar"    />
        <result property="femaleRatio"    column="female_ratio"    />
        <result property="femaleRatioText"    column="female_ratio_text"    />
        <result property="hits"    column="hits"    />
        <result property="internshipDesc"    column="internship_desc"    />
        <result property="introduction"    column="introduction"    />
        <result property="jobDirection"    column="job_direction"    />
        <result property="jobText"    column="job_text"    />
        <result property="learnYear"    column="learn_year"    />
        <result property="learnYearArab"    column="learn_year_arab"    />
        <result property="learnYearZh"    column="learn_year_zh"    />
        <result property="level"    column="level"    />
        <result property="lkRatio"    column="lk_ratio"    />
        <result property="lkRatiotext"    column="lk_ratiotext"    />
        <result property="loreAndAbility"    column="lore_and_ability"    />
        <result property="mainCourse"    column="main_course"    />
        <result property="maleRatio"    column="male_ratio"    />
        <result property="maleRatioText"    column="male_ratio_text"    />
        <result property="openCollegeCount"    column="open_college_count"    />
        <result property="salary"    column="salary"    />
        <result property="studyDirection"    column="study_direction"    />
        <result property="subjectRequirement"    column="subject_requirement"    />
        <result property="summary"    column="summary"    />
        <result property="wkRatio"    column="wk_ratio"    />
        <result property="wkRatioText"    column="wk_ratio_text"    />
        <result property="zhuanToBenOrient"    column="zhuan_to_ben_orient"    />
        <result property="middleName"    column="middle_name"    />
        <result property="bigName"    column="big_name"    />
        <result property="qualification"    column="qualification"    />
        <result property="zhongzhiMajors"    column="zhongzhiMajors"    />
        <result property="benMajors"    column="benMajors"    />
        <result property="relationMajors"    column="relationMajors"    />
    </resultMap>

    <sql id="selectSyMajorOverviewVo">
        select id, code, name, child_count, degree, edu_level, edu_objective, edu_requirement, employment_heat,
               famous_scholar, female_ratio, female_ratio_text, hits, internship_desc, introduction, job_direction,
               job_text, learn_year, learn_year_arab, learn_year_zh, level, lk_ratio, lk_ratiotext, lore_and_ability,
               main_course, male_ratio, male_ratio_text, open_college_count, salary, study_direction, subject_requirement,
               summary, wk_ratio, wk_ratio_text, zhuan_to_ben_orient, middle_name, big_name,
               qualification,zhongzhiMajors,benMajors,relationMajors from sy_major_overview
    </sql>

    <select id="selectSyMajorOverviewList" parameterType="SyMajorOverview" resultMap="SyMajorOverviewResult">
        <include refid="selectSyMajorOverviewVo"/>
        <where>
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="childCount != null "> and child_count = #{childCount}</if>
            <if test="degree != null  and degree != ''"> and degree = #{degree}</if>
            <if test="eduLevel != null  and eduLevel != ''"> and edu_level = #{eduLevel}</if>
            <if test="eduObjective != null  and eduObjective != ''"> and edu_objective = #{eduObjective}</if>
            <if test="eduRequirement != null  and eduRequirement != ''"> and edu_requirement = #{eduRequirement}</if>
            <if test="employmentHeat != null "> and employment_heat = #{employmentHeat}</if>
            <if test="famousScholar != null  and famousScholar != ''"> and famous_scholar = #{famousScholar}</if>
            <if test="femaleRatio != null "> and female_ratio = #{femaleRatio}</if>
            <if test="femaleRatioText != null  and femaleRatioText != ''"> and female_ratio_text = #{femaleRatioText}</if>
            <if test="hits != null "> and hits = #{hits}</if>
            <if test="internshipDesc != null  and internshipDesc != ''"> and internship_desc = #{internshipDesc}</if>
            <if test="introduction != null  and introduction != ''"> and introduction = #{introduction}</if>
            <if test="jobDirection != null  and jobDirection != ''"> and job_direction = #{jobDirection}</if>
            <if test="jobText != null  and jobText != ''"> and job_text = #{jobText}</if>
            <if test="learnYear != null  and learnYear != ''"> and learn_year = #{learnYear}</if>
            <if test="learnYearArab != null  and learnYearArab != ''"> and learn_year_arab = #{learnYearArab}</if>
            <if test="learnYearZh != null  and learnYearZh != ''"> and learn_year_zh = #{learnYearZh}</if>
            <if test="level != null "> and level = #{level}</if>
            <if test="lkRatio != null "> and lk_ratio = #{lkRatio}</if>
            <if test="lkRatiotext != null  and lkRatiotext != ''"> and lk_ratiotext = #{lkRatiotext}</if>
            <if test="loreAndAbility != null  and loreAndAbility != ''"> and lore_and_ability = #{loreAndAbility}</if>
            <if test="mainCourse != null  and mainCourse != ''"> and main_course = #{mainCourse}</if>
            <if test="maleRatio != null "> and male_ratio = #{maleRatio}</if>
            <if test="maleRatioText != null  and maleRatioText != ''"> and male_ratio_text = #{maleRatioText}</if>
            <if test="openCollegeCount != null "> and open_college_count = #{openCollegeCount}</if>
            <if test="salary != null  and salary != ''"> and salary = #{salary}</if>
            <if test="studyDirection != null  and studyDirection != ''"> and study_direction = #{studyDirection}</if>
            <if test="subjectRequirement != null  and subjectRequirement != ''"> and subject_requirement = #{subjectRequirement}</if>
            <if test="summary != null  and summary != ''"> and summary = #{summary}</if>
            <if test="wkRatio != null "> and wk_ratio = #{wkRatio}</if>
            <if test="wkRatioText != null  and wkRatioText != ''"> and wk_ratio_text = #{wkRatioText}</if>
            <if test="zhuanToBenOrient != null  and zhuanToBenOrient != ''"> and zhuan_to_ben_orient = #{zhuanToBenOrient}</if>
            <if test="middleName != null  and middleName != ''"> and middle_name like concat('%', #{middleName}, '%')</if>
            <if test="bigName != null  and bigName != ''"> and big_name like concat('%', #{bigName}, '%')</if>
        </where>
    </select>

    <select id="selectSyMajorOverviewById" parameterType="Long" resultMap="SyMajorOverviewResult">
        <include refid="selectSyMajorOverviewVo"/>
        where id = #{id}
    </select>
    <select id="selectSyMajorOverviewByCode" resultMap="SyMajorOverviewResult">
        <include refid="selectSyMajorOverviewVo"/>
        where exam_type = #{examType} and code = #{code}
    </select>

    <select id="selectSyMajorOverviewByCodes" resultMap="SyMajorOverviewResult">
        <include refid="selectSyMajorOverviewVo"/>
        where exam_type = #{examType} and code in
        <foreach collection="list" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>

    <insert id="insertSyMajorOverview" parameterType="SyMajorOverview" useGeneratedKeys="true" keyProperty="id">
        insert into sy_major_overview
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="code != null">code,</if>
            <if test="name != null">name,</if>
            <if test="childCount != null">child_count,</if>
            <if test="degree != null">degree,</if>
            <if test="eduLevel != null">edu_level,</if>
            <if test="eduObjective != null">edu_objective,</if>
            <if test="eduRequirement != null">edu_requirement,</if>
            <if test="employmentHeat != null">employment_heat,</if>
            <if test="famousScholar != null">famous_scholar,</if>
            <if test="femaleRatio != null">female_ratio,</if>
            <if test="femaleRatioText != null">female_ratio_text,</if>
            <if test="hits != null">hits,</if>
            <if test="internshipDesc != null">internship_desc,</if>
            <if test="introduction != null">introduction,</if>
            <if test="jobDirection != null">job_direction,</if>
            <if test="jobText != null">job_text,</if>
            <if test="learnYear != null">learn_year,</if>
            <if test="learnYearArab != null">learn_year_arab,</if>
            <if test="learnYearZh != null">learn_year_zh,</if>
            <if test="level != null">level,</if>
            <if test="lkRatio != null">lk_ratio,</if>
            <if test="lkRatiotext != null">lk_ratiotext,</if>
            <if test="loreAndAbility != null">lore_and_ability,</if>
            <if test="mainCourse != null">main_course,</if>
            <if test="maleRatio != null">male_ratio,</if>
            <if test="maleRatioText != null">male_ratio_text,</if>
            <if test="openCollegeCount != null">open_college_count,</if>
            <if test="salary != null">salary,</if>
            <if test="studyDirection != null">study_direction,</if>
            <if test="subjectRequirement != null">subject_requirement,</if>
            <if test="summary != null">summary,</if>
            <if test="wkRatio != null">wk_ratio,</if>
            <if test="wkRatioText != null">wk_ratio_text,</if>
            <if test="zhuanToBenOrient != null">zhuan_to_ben_orient,</if>
            <if test="middleName != null">middle_name,</if>
            <if test="bigName != null">big_name,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="code != null">#{code},</if>
            <if test="name != null">#{name},</if>
            <if test="childCount != null">#{childCount},</if>
            <if test="degree != null">#{degree},</if>
            <if test="eduLevel != null">#{eduLevel},</if>
            <if test="eduObjective != null">#{eduObjective},</if>
            <if test="eduRequirement != null">#{eduRequirement},</if>
            <if test="employmentHeat != null">#{employmentHeat},</if>
            <if test="famousScholar != null">#{famousScholar},</if>
            <if test="femaleRatio != null">#{femaleRatio},</if>
            <if test="femaleRatioText != null">#{femaleRatioText},</if>
            <if test="hits != null">#{hits},</if>
            <if test="internshipDesc != null">#{internshipDesc},</if>
            <if test="introduction != null">#{introduction},</if>
            <if test="jobDirection != null">#{jobDirection},</if>
            <if test="jobText != null">#{jobText},</if>
            <if test="learnYear != null">#{learnYear},</if>
            <if test="learnYearArab != null">#{learnYearArab},</if>
            <if test="learnYearZh != null">#{learnYearZh},</if>
            <if test="level != null">#{level},</if>
            <if test="lkRatio != null">#{lkRatio},</if>
            <if test="lkRatiotext != null">#{lkRatiotext},</if>
            <if test="loreAndAbility != null">#{loreAndAbility},</if>
            <if test="mainCourse != null">#{mainCourse},</if>
            <if test="maleRatio != null">#{maleRatio},</if>
            <if test="maleRatioText != null">#{maleRatioText},</if>
            <if test="openCollegeCount != null">#{openCollegeCount},</if>
            <if test="salary != null">#{salary},</if>
            <if test="studyDirection != null">#{studyDirection},</if>
            <if test="subjectRequirement != null">#{subjectRequirement},</if>
            <if test="summary != null">#{summary},</if>
            <if test="wkRatio != null">#{wkRatio},</if>
            <if test="wkRatioText != null">#{wkRatioText},</if>
            <if test="zhuanToBenOrient != null">#{zhuanToBenOrient},</if>
            <if test="middleName != null">#{middleName},</if>
            <if test="bigName != null">#{bigName},</if>
         </trim>
    </insert>

    <update id="updateSyMajorOverview" parameterType="SyMajorOverview">
        update sy_major_overview
        <trim prefix="SET" suffixOverrides=",">
            <if test="code != null">code = #{code},</if>
            <if test="name != null">name = #{name},</if>
            <if test="childCount != null">child_count = #{childCount},</if>
            <if test="degree != null">degree = #{degree},</if>
            <if test="eduLevel != null">edu_level = #{eduLevel},</if>
            <if test="eduObjective != null">edu_objective = #{eduObjective},</if>
            <if test="eduRequirement != null">edu_requirement = #{eduRequirement},</if>
            <if test="employmentHeat != null">employment_heat = #{employmentHeat},</if>
            <if test="famousScholar != null">famous_scholar = #{famousScholar},</if>
            <if test="femaleRatio != null">female_ratio = #{femaleRatio},</if>
            <if test="femaleRatioText != null">female_ratio_text = #{femaleRatioText},</if>
            <if test="hits != null">hits = #{hits},</if>
            <if test="internshipDesc != null">internship_desc = #{internshipDesc},</if>
            <if test="introduction != null">introduction = #{introduction},</if>
            <if test="jobDirection != null">job_direction = #{jobDirection},</if>
            <if test="jobText != null">job_text = #{jobText},</if>
            <if test="learnYear != null">learn_year = #{learnYear},</if>
            <if test="learnYearArab != null">learn_year_arab = #{learnYearArab},</if>
            <if test="learnYearZh != null">learn_year_zh = #{learnYearZh},</if>
            <if test="level != null">level = #{level},</if>
            <if test="lkRatio != null">lk_ratio = #{lkRatio},</if>
            <if test="lkRatiotext != null">lk_ratiotext = #{lkRatiotext},</if>
            <if test="loreAndAbility != null">lore_and_ability = #{loreAndAbility},</if>
            <if test="mainCourse != null">main_course = #{mainCourse},</if>
            <if test="maleRatio != null">male_ratio = #{maleRatio},</if>
            <if test="maleRatioText != null">male_ratio_text = #{maleRatioText},</if>
            <if test="openCollegeCount != null">open_college_count = #{openCollegeCount},</if>
            <if test="salary != null">salary = #{salary},</if>
            <if test="studyDirection != null">study_direction = #{studyDirection},</if>
            <if test="subjectRequirement != null">subject_requirement = #{subjectRequirement},</if>
            <if test="summary != null">summary = #{summary},</if>
            <if test="wkRatio != null">wk_ratio = #{wkRatio},</if>
            <if test="wkRatioText != null">wk_ratio_text = #{wkRatioText},</if>
            <if test="zhuanToBenOrient != null">zhuan_to_ben_orient = #{zhuanToBenOrient},</if>
            <if test="middleName != null">middle_name = #{middleName},</if>
            <if test="bigName != null">big_name = #{bigName},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSyMajorOverviewById" parameterType="Long">
        delete from sy_major_overview where id = #{id}
    </delete>

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