|
|
@@ -23,11 +23,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="companyId" column="company_id" />
|
|
|
<result property="companyName" column="companyName" />
|
|
|
<result property="maxDuration" column="max_duration" />
|
|
|
+ <result property="companyLogo" column="company_logo" />
|
|
|
+ <result property="companyFullName" column="company_full_name" />
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectDeptVo">
|
|
|
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
|
|
|
- d.del_flag, d.create_by, d.create_time,d.company_id,d.company_name,d.max_duration,sd.dept_name companyName
|
|
|
+ d.del_flag, d.create_by, d.create_time,d.company_id,d.company_name,d.max_duration,sd.dept_name companyName,
|
|
|
+ d.company_logo ,d.company_full_name
|
|
|
from sys_dept d left join sys_dept sd on d.company_id = sd.dept_id
|
|
|
</sql>
|
|
|
|
|
|
@@ -74,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
|
|
|
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.max_duration,
|
|
|
- d.company_id,(select dept_name from sys_dept where dept_id = d.company_id) companyName,
|
|
|
+ d.company_id,(select dept_name from sys_dept where dept_id = d.company_id) companyName,d.company_logo,d.company_full_name,
|
|
|
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
|
|
|
from sys_dept d
|
|
|
where d.dept_id = #{deptId}
|
|
|
@@ -105,8 +108,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<include refid="selectDeptVo"/>
|
|
|
where d.parent_id = 100
|
|
|
</select>
|
|
|
+ <select id="selectByDepName" resultMap="SysDeptResult">
|
|
|
+ <include refid="selectDeptVo"/>
|
|
|
+ where d.dept_name =#{deptName}
|
|
|
+ <if test="companyId !=null and companyId != 0">
|
|
|
+ AND (d.dept_id = #{companyId} OR d.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{companyId}, ancestors) ))
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
|
|
|
- <insert id="insertDept" parameterType="SysDept">
|
|
|
+ <insert id="insertDept" parameterType="SysDept">
|
|
|
insert into sys_dept(
|
|
|
<if test="deptId != null and deptId != 0">dept_id,</if>
|
|
|
<if test="parentId != null and parentId != 0">parent_id,</if>
|
|
|
@@ -121,6 +131,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="maxDuration != null ">max_duration,</if>
|
|
|
<if test="companyId != null ">company_id,</if>
|
|
|
<if test="companyName != null ">company_name,</if>
|
|
|
+ <if test="companyLogo != null ">company_logo,</if>
|
|
|
+ <if test="companyFullName != null ">company_full_name,</if>
|
|
|
create_time
|
|
|
)values(
|
|
|
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
|
|
@@ -136,6 +148,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="maxDuration != null ">#{maxDuration},</if>
|
|
|
<if test="companyId != null ">#{companyId},</if>
|
|
|
<if test="companyName != null ">#{companyName},</if>
|
|
|
+ <if test="companyLogo != null ">#{companyLogo},</if>
|
|
|
+ <if test="companyFullName != null ">#{companyFullName},</if>
|
|
|
sysdate()
|
|
|
)
|
|
|
</insert>
|
|
|
@@ -155,6 +169,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="maxDuration != null ">max_duration = #{maxDuration},</if>
|
|
|
<if test="companyId != null ">company_id = #{companyId},</if>
|
|
|
<if test="companyName != null ">company_name = #{companyName},</if>
|
|
|
+ <if test="companyLogo != null ">company_logo = #{companyLogo},</if>
|
|
|
+ <if test="companyFullName != null ">company_full_name = #{companyFullName},</if>
|
|
|
update_time = sysdate()
|
|
|
</set>
|
|
|
where dept_id = #{deptId}
|