146 lines
5.1 KiB
XML
146 lines
5.1 KiB
XML
<?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.xiang.xservice.auth.service.repository.mapper.XDeptMapper">
|
|
|
|
<resultMap id="BaseResultMap" type="com.xiang.xservice.auth.service.entity.XDept" >
|
|
<result column="name" property="name" />
|
|
<result column="parent_id" property="parentId" />
|
|
<result column="tree_path" property="treePath" />
|
|
<result column="sort_no" property="sortNo" />
|
|
<result column="created_time" property="createdTime" />
|
|
<result column="create_by" property="createBy" />
|
|
<result column="updated_time" property="updatedTime" />
|
|
<result column="update_by" property="updateBy" />
|
|
<result column="del_flag" property="delFlag" />
|
|
</resultMap>
|
|
|
|
<sql id="Base_Column_List">
|
|
name,
|
|
parent_id,
|
|
tree_path,
|
|
sort_no,
|
|
created_time,
|
|
create_by,
|
|
updated_time,
|
|
update_by,
|
|
del_flag
|
|
</sql>
|
|
|
|
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.xiang.xservice.auth.service.entity.XUserDept">
|
|
INSERT INTO x_dept
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="null != name and '' != name">
|
|
name,
|
|
</if>
|
|
<if test="null != parentId ">
|
|
parent_id,
|
|
</if>
|
|
<if test="null != treePath and '' != treePath">
|
|
tree_path,
|
|
</if>
|
|
<if test="null != sortNo ">
|
|
sort_no,
|
|
</if>
|
|
<if test="null != createdTime ">
|
|
created_time,
|
|
</if>
|
|
<if test="null != createBy and '' != createBy">
|
|
create_by,
|
|
</if>
|
|
<if test="null != updatedTime ">
|
|
updated_time,
|
|
</if>
|
|
<if test="null != updateBy and '' != updateBy">
|
|
update_by,
|
|
</if>
|
|
<if test="null != delFlag ">
|
|
del_flag
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="null != name and '' != name">
|
|
#{name},
|
|
</if>
|
|
<if test="null != parentId ">
|
|
#{parentId},
|
|
</if>
|
|
<if test="null != treePath and '' != treePath">
|
|
#{treePath},
|
|
</if>
|
|
<if test="null != sortNo ">
|
|
#{sortNo},
|
|
</if>
|
|
<if test="null != createdTime ">
|
|
#{createdTime},
|
|
</if>
|
|
<if test="null != createBy and '' != createBy">
|
|
#{createBy},
|
|
</if>
|
|
<if test="null != updatedTime ">
|
|
#{updatedTime},
|
|
</if>
|
|
<if test="null != updateBy and '' != updateBy">
|
|
#{updateBy},
|
|
</if>
|
|
<if test="null != delFlag ">
|
|
#{delFlag}
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="delBatch" >
|
|
update x_dept
|
|
SET del_flag = 1, updated_time = now(), update_by = #{updateBy}
|
|
WHERE id IN
|
|
<foreach item="item" collection="ids" separator="," open="(" close=")">
|
|
#{item}
|
|
</foreach>
|
|
</update>
|
|
|
|
<update id="update" parameterType="com.xiang.xservice.auth.service.entity.XUserDept">
|
|
UPDATE x_dept
|
|
<set>
|
|
<if test="null != name and '' != name">name = #{name},</if>
|
|
<if test="null != parentId ">parent_id = #{parentId},</if>
|
|
<if test="null != treePath and '' != treePath">tree_path = #{treePath},</if>
|
|
<if test="null != sortNo ">sort_no = #{sortNo},</if>
|
|
<if test="null != createdTime ">created_time = #{createdTime},</if>
|
|
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
|
|
<if test="null != updatedTime ">updated_time = #{updatedTime},</if>
|
|
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
|
|
<if test="null != delFlag ">del_flag = #{delFlag}</if>
|
|
</set>
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
<select id="getDeptList" resultMap="BaseResultMap">
|
|
select <include refid="Base_Column_List"/>
|
|
from x_dept
|
|
<trim prefix="AND">
|
|
<where>
|
|
del_flag = 0
|
|
<if test="name != null and name != ''">AND name = #{name}</if>
|
|
</where>
|
|
</trim>
|
|
</select>
|
|
<select id="getDeptById" resultMap="BaseResultMap">
|
|
select <include refid="Base_Column_List"/>
|
|
from x_dept
|
|
where id = #{id}
|
|
</select>
|
|
<select id="getDeptByIds" resultMap="BaseResultMap">
|
|
select <include refid="Base_Column_List"/>
|
|
from x_dept
|
|
where id in
|
|
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
|
#{id}
|
|
</foreach>
|
|
</select>
|
|
<select id="getDeptByparentId" resultMap="BaseResultMap">
|
|
select <include refid="Base_Column_List"/>
|
|
from x_dept
|
|
where parent_id = #{parentId}
|
|
</select>
|
|
|
|
</mapper> |