<?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.station.mapper.MjDeptMapper">
|
|
<resultMap type="MjDept" id="MjDeptResult">
|
<result property="id" column="id" />
|
<result property="deptName" column="dept_name" />
|
<result property="deptParentId" column="dept_parent_id" />
|
<result property="organizationId" column="organization_id" />
|
<result property="organizationName" column="organization_name" />
|
<result property="createTime" column="create_time" />
|
<result property="updateTime" column="update_time" />
|
<result property="createBy" column="create_by" />
|
<result property="updateBy" column="update_by" />
|
<result property="delFlag" column="del_flag" />
|
<result property="sort" column="sort" />
|
</resultMap>
|
|
<sql id="selectMjDeptVo">
|
select id, dept_name, dept_parent_id, organization_id, organization_name, create_time, update_time, create_by, update_by, del_flag, sort from mj_dept
|
</sql>
|
|
<select id="selectMjDeptList" parameterType="MjDept" resultMap="MjDeptResult">
|
<include refid="selectMjDeptVo"/>
|
<where>
|
<if test="deptName != null and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
|
<if test="deptParentId != null and deptParentId != ''"> and dept_parent_id = #{deptParentId}</if>
|
<if test="organizationId != null and organizationId != ''"> and organization_id = #{organizationId}</if>
|
<if test="organizationName != null and organizationName != ''"> and organization_name like concat('%', #{organizationName}, '%')</if>
|
<if test="sort != null "> and sort = #{sort}</if>
|
</where>
|
order by create_time asc
|
</select>
|
|
<select id="selectMjDeptByIdorName" parameterType="String" resultMap="MjDeptResult">
|
<include refid="selectMjDeptVo"/>
|
<where>
|
<if test="id != null and id != ''">and id=#{id}</if>
|
<if test="deptName != null and deptName != ''"> or dept_name =#{deptName}</if>
|
</where>
|
</select>
|
<select id="checkDeptNameUnique" resultType="com.ruoyi.station.domain.MjDept">
|
<include refid="selectMjDeptVo"/>
|
where dept_name=#{deptName} and dept_parent_id = #{parentId}
|
</select>
|
|
<insert id="insertMjDept" parameterType="MjDept">
|
insert into mj_dept
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">id,</if>
|
<if test="deptName != null">dept_name,</if>
|
<if test="deptParentId != null">dept_parent_id,</if>
|
<if test="organizationId != null">organization_id,</if>
|
<if test="organizationName != null">organization_name,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
<if test="createBy != null">create_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
<if test="delFlag != null">del_flag,</if>
|
<if test="sort != null">sort,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id},</if>
|
<if test="deptName != null">#{deptName},</if>
|
<if test="deptParentId != null">#{deptParentId},</if>
|
<if test="organizationId != null">#{organizationId},</if>
|
<if test="organizationName != null">#{organizationName},</if>
|
<if test="createTime != null">#{createTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
<if test="createBy != null">#{createBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
<if test="delFlag != null">#{delFlag},</if>
|
<if test="sort != null">#{sort},</if>
|
</trim>
|
</insert>
|
|
<update id="updateMjDept" parameterType="MjDept">
|
update mj_dept
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="deptName != null">dept_name = #{deptName},</if>
|
<if test="deptParentId != null">dept_parent_id = #{deptParentId},</if>
|
<if test="organizationId != null">organization_id = #{organizationId},</if>
|
<if test="organizationName != null">organization_name = #{organizationName},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
<if test="sort != null">sort = #{sort},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteMjDeptById" parameterType="String">
|
delete from mj_dept where id = #{id}
|
</delete>
|
|
<delete id="deleteMjDeptByIds" parameterType="String">
|
delete from mj_dept where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
<select id="selectMjDeptListByDeptParentId" parameterType="String" resultType="com.ruoyi.station.model.DeptUsersModel">
|
select id id, dept_name title from mj_dept
|
<where>
|
del_flag = 0
|
<if test="deptParentId != null and deptParentId != ''"> and dept_parent_id = #{deptParentId}</if>
|
</where>
|
</select>
|
|
</mapper>
|