123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <?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.SyMajorMapper">
- <resultMap type="SyMajor" id="SyMajorResult">
- <result property="id" column="id" />
- <result property="code" column="code" />
- <result property="parentCode" column="parent_code" />
- <result property="name" column="name" />
- <result property="examType" column="exam_type" />
- <result property="type" column="type" />
- <result property="level" column="level" />
- <result property="ancestors" column="ancestors" />
- <result property="childCount" column="child_count" />
- <result property="grandchildCount" column="grandchild_count" />
- <result property="learnYearArab" column="learn_year_arab" />
- </resultMap>
- <sql id="selectSyMajorVo">
- select id, code, parent_code, name, exam_type, type, level, ancestors, child_count, grandchild_count, learn_year_arab from sy_major
- </sql>
- <select id="selectSyMajorList" parameterType="SyMajor" resultMap="SyMajorResult">
- <include refid="selectSyMajorVo"/>
- <where>
- <if test="code != null and code != ''"> and code = #{code}</if>
- <if test="parentCode != null and parentCode != ''"> and parent_code = #{parentCode}</if>
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
- <if test="examType != null and examType != ''"> and exam_type = #{examType}</if>
- <if test="type != null and type != ''"> and type = #{type}</if>
- <if test="level != null "> and level <= #{level}</if>
- <if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
- <if test="childCount != null "> and child_count = #{childCount}</if>
- <if test="grandchildCount != null "> and grandchild_count = #{grandchildCount}</if>
- </where>
- order by code
- </select>
- <select id="selectSyMajorAndChildrenByCode" parameterType="SyMajor" resultMap="SyMajorResult">
- <include refid="selectSyMajorVo"/>
- <where>
- <if test="level != null"> and level > #{level}</if>
- <if test="examType != null"> and exam_type = #{examType}</if>
- <if test="code != null and code != ''">
- and ( code=#{code} or find_in_set(#{code}, ancestors) )
- </if>
- </where>
- </select>
- <select id="selectSyMajorById" parameterType="Long" resultMap="SyMajorResult">
- <include refid="selectSyMajorVo"/>
- where id = #{id}
- </select>
- <select id="selectSyMajorByLevel" resultMap="SyMajorResult">
- <include refid="selectSyMajorVo"/>
- where level = #{level} and exam_type = #{examType}
- </select>
- <select id="selectSyMajorByCode" resultMap="SyMajorResult">
- <include refid="selectSyMajorVo"/>
- where exam_type = #{examType} and code = #{code}
- </select>
- <insert id="insertSyMajor" parameterType="SyMajor" useGeneratedKeys="true" keyProperty="id">
- insert into sy_major
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="code != null">code,</if>
- <if test="parentCode != null">parent_code,</if>
- <if test="name != null">name,</if>
- <if test="examType != null">exam_type,</if>
- <if test="type != null">type,</if>
- <if test="level != null">level,</if>
- <if test="ancestors != null">ancestors,</if>
- <if test="childCount != null">child_count,</if>
- <if test="grandchildCount != null">grandchild_count,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="code != null">#{code},</if>
- <if test="parentCode != null">#{parentCode},</if>
- <if test="name != null">#{name},</if>
- <if test="examType != null">#{examType},</if>
- <if test="type != null">#{type},</if>
- <if test="level != null">#{level},</if>
- <if test="ancestors != null">#{ancestors},</if>
- <if test="childCount != null">#{childCount},</if>
- <if test="grandchildCount != null">#{grandchildCount},</if>
- </trim>
- </insert>
- <update id="updateSyMajor" parameterType="SyMajor">
- update sy_major
- <trim prefix="SET" suffixOverrides=",">
- <if test="code != null">code = #{code},</if>
- <if test="parentCode != null">parent_code = #{parentCode},</if>
- <if test="name != null">name = #{name},</if>
- <if test="examType != null">exam_type = #{examType},</if>
- <if test="type != null">type = #{type},</if>
- <if test="level != null">level = #{level},</if>
- <if test="ancestors != null">ancestors = #{ancestors},</if>
- <if test="childCount != null">child_count = #{childCount},</if>
- <if test="grandchildCount != null">grandchild_count = #{grandchildCount},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteSyMajorById" parameterType="Long">
- delete from sy_major where id = #{id}
- </delete>
- <delete id="deleteSyMajorByIds" parameterType="String">
- delete from sy_major where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|