| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?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.dz.mapper.DzSchoolMapper">
- <resultMap type="DzSchool" id="DzSchoolResult">
- <result property="id" column="id" />
- <result property="name" column="name" />
- <result property="deptId" column="dept_id" />
- <result property="location" column="location" />
- <result property="remark" column="remark" />
- <result property="pro" column="pro" />
- <result property="city" column="city" />
- <result property="area" column="area" />
- <result property="status" column="status" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <association property="dept" javaType="SysDept" resultMap="deptResult" />
- </resultMap>
- <resultMap id="deptResult" type="SysDept">
- <id property="deptId" column="dept_id" />
- <result property="parentId" column="parent_id" />
- <result property="deptName" column="dept_name" />
- <result property="ancestors" column="ancestors" />
- <result property="orderNum" column="order_num" />
- <result property="leader" column="leader" />
- <result property="status" column="dept_status" />
- </resultMap>
- <sql id="selectDzSchoolVo">
- select t1.id, t1.name, t1.dept_id, t1.location, t1.remark, t1.pro, t1.city, t1.area, t1.status, t1.create_time, t1.update_time,
- d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status
- from dz_school t1
- left join sys_dept d on t1.dept_id = d.dept_id
- </sql>
- <select id="selectDzSchoolList" parameterType="DzSchool" resultMap="DzSchoolResult">
- <include refid="selectDzSchoolVo"/>
- <where>
- <if test="name != null and name != ''"> and t1.name like concat('%', #{name}, '%')</if>
- <if test="deptId != null "> and t1.dept_id = #{deptId}</if>
- <if test="location != null and location != ''"> and t1.location = #{location}</if>
- <if test="pro != null "> and t1.pro = #{pro}</if>
- <if test="city != null "> and t1.city = #{city}</if>
- <if test="area != null "> and t1.area = #{area}</if>
- <if test="status != null "> and t1.status = #{status}</if>
- </where>
- </select>
- <select id="selectDzSchoolById" parameterType="Long" resultMap="DzSchoolResult">
- <include refid="selectDzSchoolVo"/>
- where t1.id = #{id}
- </select>
- <insert id="insertDzSchool" parameterType="DzSchool" useGeneratedKeys="true" keyProperty="id">
- insert into dz_school
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="name != null">name,</if>
- <if test="deptId != null">dept_id,</if>
- <if test="location != null">location,</if>
- <if test="remark != null">remark,</if>
- <if test="pro != null">pro,</if>
- <if test="city != null">city,</if>
- <if test="area != null">area,</if>
- <if test="status != null">status,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="name != null">#{name},</if>
- <if test="deptId != null">#{deptId},</if>
- <if test="location != null">#{location},</if>
- <if test="remark != null">#{remark},</if>
- <if test="pro != null">#{pro},</if>
- <if test="city != null">#{city},</if>
- <if test="area != null">#{area},</if>
- <if test="status != null">#{status},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- </trim>
- </insert>
- <update id="updateDzSchool" parameterType="DzSchool">
- update dz_school
- <trim prefix="SET" suffixOverrides=",">
- <if test="name != null">name = #{name},</if>
- <if test="deptId != null">dept_id = #{deptId},</if>
- <if test="location != null">location = #{location},</if>
- <if test="remark != null">remark = #{remark},</if>
- <if test="pro != null">pro = #{pro},</if>
- <if test="city != null">city = #{city},</if>
- <if test="area != null">area = #{area},</if>
- <if test="status != null">status = #{status},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteDzSchoolById" parameterType="Long">
- delete from dz_school where id = #{id}
- </delete>
- <delete id="deleteDzSchoolByIds" parameterType="String">
- delete from dz_school where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|