1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?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.system.mapper.StuDepartmentMapper">
- <resultMap type="StuDepartment" id="StuDepartmentResult">
- <result property="id" column="id" />
- <result property="collegeId" column="college_id" />
- <result property="collegeName" column="college_name" />
- <result property="departmentName" column="department_name" />
- <result property="remark" column="remark" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- </resultMap>
- <sql id="selectStuDepartmentVo">
- select d.id, d.college_id,co.college_name, d.department_name, d.remark, d.create_by, d.create_time, d.update_by, d.update_time from stu_department d
- </sql>
- <select id="selectStuDepartmentList" parameterType="StuDepartment" resultMap="StuDepartmentResult">
- <include refid="selectStuDepartmentVo"/>
- LEFT JOIN stu_college co ON d.college_id = co.id
- <where>
- <if test="collegeId != null "> and college_id = #{collegeId}</if>
- <if test="departmentName != null and departmentName != ''"> and department_name like concat('%', #{departmentName}, '%')</if>
- <if test="delStatus != null "> and d.del_status = #{delStatus}</if>
- </where>
- order by update_time desc
- </select>
- <select id="selectStuDepartmentById" parameterType="Long" resultMap="StuDepartmentResult">
- <include refid="selectStuDepartmentVo"/>
- LEFT JOIN stu_college co ON d.college_id = co.id
- where d.id = #{id}
- </select>
- <insert id="insertStuDepartment" parameterType="StuDepartment" useGeneratedKeys="true" keyProperty="id">
- insert into stu_department
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="collegeId != null">college_id,</if>
- <if test="departmentName != null">department_name,</if>
- <if test="delStatus != null">del_status,</if>
- <if test="remark != null">remark,</if>
- <if test="createBy != null">create_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="updateTime != null">update_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="collegeId != null">#{collegeId},</if>
- <if test="departmentName != null">#{departmentName},</if>
- <if test="delStatus != null">#{delStatus},</if>
- <if test="remark != null">#{remark},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- </trim>
- </insert>
- <update id="updateStuDepartment" parameterType="StuDepartment">
- update stu_department
- <trim prefix="SET" suffixOverrides=",">
- <if test="collegeId != null">college_id = #{collegeId},</if>
- <if test="departmentName != null">department_name = #{departmentName},</if>
- <if test="delStatus != null">del_status = #{delStatus},</if>
- <if test="remark != null">remark = #{remark},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteStuDepartmentById" parameterType="Long">
- delete from stu_department where id = #{id}
- </delete>
- <delete id="deleteStuDepartmentByIds" parameterType="String">
- delete from stu_department where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <!-- 查询科系列表 -->
- <select id="queryList" parameterType="Long" resultType="Map">
- SELECT id,department_name AS departmentName FROM stu_department where del_status=0 AND college_id=#{collegeId}
- </select>
- </mapper>
|