12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?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.SyMajorSubjectMapper">
-
- <resultMap type="SyMajorSubject" id="SyMajorSubjectResult">
- <result property="id" column="id" />
- <result property="code" column="code" />
- <result property="parentCode" column="parent_code" />
- <result property="name" column="name" />
- <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" />
- </resultMap>
- <sql id="selectSyMajorSubjectVo">
- select id, code, parent_code, name, type, level, ancestors, child_count, grandchild_count from sy_major_subject
- </sql>
- <select id="selectSyMajorSubjectList" parameterType="SyMajorSubject" resultMap="SyMajorSubjectResult">
- <include refid="selectSyMajorSubjectVo"/>
- <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="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>
- </select>
-
- <select id="selectSyMajorSubjectById" parameterType="Long" resultMap="SyMajorSubjectResult">
- <include refid="selectSyMajorSubjectVo"/>
- where id = #{id}
- </select>
-
- <insert id="insertSyMajorSubject" parameterType="SyMajorSubject" useGeneratedKeys="true" keyProperty="id">
- insert into sy_major_subject
- <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="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="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="updateSyMajorSubject" parameterType="SyMajorSubject">
- update sy_major_subject
- <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="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="deleteSyMajorSubjectById" parameterType="Long">
- delete from sy_major_subject where id = #{id}
- </delete>
- <delete id="deleteSyMajorSubjectByIds" parameterType="String">
- delete from sy_major_subject where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|