Browse Source

fix: 修复部门行政规划不能修改问题

master_tdsql
hxh 9 months ago
parent
commit
7999eea7aa
  1. 74
      shuili-admin/src/main/java/com/kms/web/controller/system/SysDeptController.java
  2. 37
      shuili-admin/src/main/java/com/kms/web/controller/system/SysXzqhController.java
  3. 364
      shuili-system/src/main/resources/mapper/system/SysDeptMapper.xml

74
shuili-admin/src/main/java/com/kms/web/controller/system/SysDeptController.java

@ -11,6 +11,7 @@ import com.shuili.common.core.domain.entity.SysDept;
import com.shuili.common.enums.BusinessType;
import com.shuili.common.utils.FastDfsUtil;
import com.shuili.common.utils.StringUtils;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@ -27,8 +28,7 @@ import java.util.List;
*/
@RestController
@RequestMapping("/system/dept")
public class SysDeptController extends BaseController
{
public class SysDeptController extends BaseController {
@Autowired
private SysDeptService deptService;
@ -41,8 +41,7 @@ public class SysDeptController extends BaseController
@SaCheckLogin
@GetMapping("/list")
@SaCheckPermission(value = "system:dept:list")
public AjaxResult list(SysDept dept)
{
public AjaxResult list(SysDept dept) {
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(depts);
}
@ -53,16 +52,13 @@ public class SysDeptController extends BaseController
@SaCheckLogin
@GetMapping("/list/exclude/{deptId}")
@SaCheckPermission(value = "system:dept:list")
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) String deptId)
{
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) String deptId) {
List<SysDept> depts = deptService.selectDeptList(new SysDept());
Iterator<SysDept> it = depts.iterator();
while (it.hasNext())
{
while (it.hasNext()) {
SysDept d = (SysDept) it.next();
if (d.getId().equals(deptId)
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
{
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")) {
it.remove();
}
}
@ -75,10 +71,9 @@ public class SysDeptController extends BaseController
@SaCheckLogin
@GetMapping(value = "/{deptId}")
@SaCheckPermission(value = "system:dept:query")
public AjaxResult getInfo(@PathVariable String deptId)
{
SysDept selectDeptById = deptService.get(deptId);
return AjaxResult.success(selectDeptById);
public AjaxResult getInfo(@PathVariable String deptId) {
SysDept selectDeptById = deptService.get(deptId);
return AjaxResult.success(selectDeptById);
}
/**
@ -86,15 +81,14 @@ public class SysDeptController extends BaseController
*/
@SaCheckLogin
@PostMapping("/uploadLogo")
public AjaxResult uploadLogo(@RequestParam("avatarfile") MultipartFile file)
{
public AjaxResult uploadLogo(@RequestParam("avatarfile") MultipartFile file) {
try {
String uploadFile = fastUtil.uploadFile(file);
// String uploadFile = "group1/M00/05/27/wKgBFGCvaeiAPWu5AADSPy2Q2g0276.jpg";
AjaxResult ajax = AjaxResult.success();
ajax.put("logoUrl", uploadFile);
return ajax;
} catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error("上传图片异常,请联系管理员");
}
@ -104,8 +98,7 @@ public class SysDeptController extends BaseController
* 获取部门下拉树列表
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(SysDept dept)
{
public AjaxResult treeselect(SysDept dept) {
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
}
@ -114,8 +107,7 @@ public class SysDeptController extends BaseController
* 加载对应角色部门列表树
*/
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") String roleId)
{
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") String roleId) {
List<SysDept> depts = deptService.selectDeptList(new SysDept());
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
@ -130,40 +122,33 @@ public class SysDeptController extends BaseController
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@SaCheckPermission(value = "system:dept:add")
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDept dept)
{
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
{
public AjaxResult add(@Validated @RequestBody SysDept dept) {
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
dept.setParentId("100");
int i = deptService.insertDept(dept);
return toAjax(i>0);
return toAjax(i > 0);
}
/**
* 修改部门
* 修改部门
*/
@SaCheckLogin
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@SaCheckPermission(value = "system:dept:edit")
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDept dept)
{
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
{
@ApiOperation("部门修改")
public AjaxResult edit(@Validated @RequestBody SysDept dept) {
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
else if (dept.getParentId().equals(dept.getId()))
{
} else if (dept.getParentId().equals(dept.getId())) {
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
}
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
&& deptService.selectNormalChildrenDeptById(dept.getId()) > 0)
{
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
&& deptService.selectNormalChildrenDeptById(dept.getId()) > 0) {
return AjaxResult.error("该部门包含未停用的子部门!");
}
return toAjax(deptService.updateDept(dept)>0);
return toAjax(deptService.updateDept(dept) > 0);
}
/**
@ -173,17 +158,14 @@ public class SysDeptController extends BaseController
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@SaCheckPermission(value = "system:dept:remove")
@DeleteMapping("/{deptId}")
public AjaxResult remove(@PathVariable String deptId)
{
if (deptService.hasChildByDeptId(deptId))
{
public AjaxResult remove(@PathVariable String deptId) {
if (deptService.hasChildByDeptId(deptId)) {
return AjaxResult.error("存在下级部门,不允许删除");
}
if (deptService.checkDeptExistUser(deptId))
{
if (deptService.checkDeptExistUser(deptId)) {
return AjaxResult.error("部门存在用户,不允许删除");
}
return toAjax(deptService.deleteDeptById(deptId)>0);
return toAjax(deptService.deleteDeptById(deptId) > 0);
}

37
shuili-admin/src/main/java/com/kms/web/controller/system/SysXzqhController.java

@ -25,8 +25,6 @@ import java.util.Arrays;
import java.util.List;
/**
* 行政区划Controller
*
@ -36,8 +34,7 @@ import java.util.List;
@RestController
@RequestMapping("/xzqh/xzqh")
@Api(tags = "行政区划")
public class SysXzqhController extends BaseController
{
public class SysXzqhController extends BaseController {
@Autowired
private SysXzqhService sysXzqhService;
@ -63,10 +60,9 @@ public class SysXzqhController extends BaseController
}
@GetMapping("/common")
public AjaxResult common(){
@ApiOperation("通用行政区划")
public AjaxResult common() {
SysUser user = UserUtils.getUser();
String deptId = user.getDeptId();
SysDept sysDept = sysDeptService.getById(deptId);
@ -76,19 +72,20 @@ public class SysXzqhController extends BaseController
/*if (userName.equals("admin")) {
List<SysXzqh> list = sysXzqhService.list();
return AjaxResult.success(list);
}else */if (xzqh.getLayer()==1) {
}else */
if (xzqh.getLayer() == 1) {
String substring = xzqh.getXzqhdm().substring(0, 2);
QueryWrapper<SysXzqh> queryWrapper = new QueryWrapper<>();
queryWrapper.likeRight("XZQHDM", substring);
List<SysXzqh> list = sysXzqhService.list(queryWrapper);
return AjaxResult.success(list);
} else if (xzqh.getLayer()==2) {
} else if (xzqh.getLayer() == 2) {
String substring = xzqh.getXzqhdm().substring(0, 4);
QueryWrapper<SysXzqh> queryWrapper = new QueryWrapper<>();
queryWrapper.likeRight("XZQHDM", substring);
List<SysXzqh> list = sysXzqhService.list(queryWrapper);
return AjaxResult.success(list);
}else {
} else {
return AjaxResult.success(xzqh);
}
}
@ -98,8 +95,7 @@ public class SysXzqhController extends BaseController
*/
@PostMapping("/list")
@ApiOperation("行政区划列表")
public IPage list(@RequestBody SearchParam<SysXzqh> sp)
{
public IPage list(@RequestBody SearchParam<SysXzqh> sp) {
return sysXzqhService.selectPage(sp);
}
@ -109,8 +105,7 @@ public class SysXzqhController extends BaseController
@Log(title = "行政区划导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ApiOperation("行政区划导出")
public AjaxResult export(@RequestBody SysXzqh sysXzqh)
{
public AjaxResult export(@RequestBody SysXzqh sysXzqh) {
List<SysXzqh> list = sysXzqhService.listByIds(sysXzqh.getIds());
ExcelUtil<SysXzqh> util = new ExcelUtil<>(SysXzqh.class);
return util.exportExcel(list, "xzqh");
@ -121,8 +116,7 @@ public class SysXzqhController extends BaseController
*/
@ApiOperation(" 行政区划详情")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
public AjaxResult getInfo(@PathVariable("id") String id) {
return AjaxResult.success(sysXzqhService.getById(id));
}
@ -132,8 +126,7 @@ public class SysXzqhController extends BaseController
@Log(title = "行政区划新增", businessType = BusinessType.INSERT)
@PostMapping
@ApiOperation("行政区划新增")
public AjaxResult add(@RequestBody SysXzqh sysXzqh)
{
public AjaxResult add(@RequestBody SysXzqh sysXzqh) {
BaseEntityUtils.preInsert(sysXzqh);
return toAjax(sysXzqhService.save(sysXzqh));
}
@ -144,8 +137,7 @@ public class SysXzqhController extends BaseController
@ApiOperation("行政区划修改")
@Log(title = "行政区划修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysXzqh sysXzqh)
{
public AjaxResult edit(@RequestBody SysXzqh sysXzqh) {
return toAjax(sysXzqhService.updateById(sysXzqh));
}
@ -154,9 +146,8 @@ public class SysXzqhController extends BaseController
*/
@ApiOperation("行政区划删除")
@Log(title = "行政区划删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(sysXzqhService.removeByIds(Arrays.asList(ids)));
}
}

364
shuili-system/src/main/resources/mapper/system/SysDeptMapper.xml

@ -1,41 +1,41 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.kms.system.mapper.SysDeptMapper">
<resultMap type="com.shuili.common.core.domain.entity.SysDept" id="SysDeptResult">
<id property="id" column="id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="status" column="status" />
<result property="tag" column="tag" />
<result property="delFlag" column="del_flag" />
<result property="parentName" column="parent_name" />
<result property="createUid" column="create_uid" />
<result property="createTime" column="create_time" />
<result property="updateUid" column="update_uid" />
<result property="updateTime" column="update_time" />
<result property="name" column="name" />
<result property="pcLogo" column="pc_logo" />
<result property="pcBackground" column="pc_background" />
<result property="adminName" column="admin_name" />
<result property="adminLogo" column="admin_logo" />
<result property="isDownload" column="is_download" />
<result property="isComment" column="is_comment" />
<result property="ipStart" column="ip_start" />
<result property="ipEnd" column="ip_end" />
<result property="dataType" column="data_type" />
<result property="beginDate" column="begin_date" />
<result property="endDate" column="end_date" />
</resultMap>
<sql id="selectDeptVo">
<resultMap type="com.shuili.common.core.domain.entity.SysDept" id="SysDeptResult">
<id property="id" column="id"/>
<result property="parentId" column="parent_id"/>
<result property="ancestors" column="ancestors"/>
<result property="deptName" column="dept_name"/>
<result property="orderNum" column="order_num"/>
<result property="leader" column="leader"/>
<result property="phone" column="phone"/>
<result property="email" column="email"/>
<result property="status" column="status"/>
<result property="tag" column="tag"/>
<result property="delFlag" column="del_flag"/>
<result property="parentName" column="parent_name"/>
<result property="createUid" column="create_uid"/>
<result property="createTime" column="create_time"/>
<result property="updateUid" column="update_uid"/>
<result property="updateTime" column="update_time"/>
<result property="name" column="name"/>
<result property="pcLogo" column="pc_logo"/>
<result property="pcBackground" column="pc_background"/>
<result property="adminName" column="admin_name"/>
<result property="adminLogo" column="admin_logo"/>
<result property="isDownload" column="is_download"/>
<result property="isComment" column="is_comment"/>
<result property="ipStart" column="ip_start"/>
<result property="ipEnd" column="ip_end"/>
<result property="dataType" column="data_type"/>
<result property="beginDate" column="begin_date"/>
<result property="endDate" column="end_date"/>
</resultMap>
<sql id="selectDeptVo">
select d.id,d.ip_start,d.ip_end,d.is_download,d.is_comment, d.parent_id, d.ancestors,
d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,d.tag,
d.del_flag, d.create_uid, d.create_time, d.name, d.pc_logo, d.pc_background,
@ -43,171 +43,173 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from sys_dept d
</sql>
<select id="selectDeptList" parameterType="com.shuili.common.core.domain.entity.SysDept" resultMap="SysDeptResult">
<select id="selectDeptList" parameterType="com.shuili.common.core.domain.entity.SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0'
<if test="parentId != null and parentId != ''">
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="searchValue != null and searchValue != ''">
AND dept_name =#{searchValue}
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="searchValue != null and searchValue != ''">
AND dept_name =#{searchValue}
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
</select>
<select id="selectDeptListByRoleId" parameterType="String" resultType="Integer">
select d.id, d.parent_id
from sys_dept d
left join sys_role_dept rd on d.id = rd.dept_id
select d.id, d.parent_id
from sys_dept d
left join sys_role_dept rd on d.id = rd.dept_id
where rd.role_id = #{roleId}
and d.id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.id = rd.dept_id and rd.role_id = #{roleId})
order by d.parent_id, d.order_num
</select>
and d.id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.id = rd.dept_id and
rd.role_id = #{roleId})
order by d.parent_id, d.order_num
</select>
<select id="selectDeptById" parameterType="String" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where id = #{id}
</select>
<include refid="selectDeptVo"/>
where id = #{id}
</select>
<select id="checkDeptExistUser" parameterType="String" resultType="int">
select count(1) from sys_user where id = #{id} and del_flag = '0'
</select>
select count(1) from sys_user where id = #{id} and del_flag = '0'
</select>
<select id="hasChildByDeptId" parameterType="String" resultType="int">
select count(1) from sys_dept
where del_flag = '0' and parent_id = #{id} limit 1
</select>
<select id="hasChildByDeptId" parameterType="String" resultType="int">
select count(1) from sys_dept
where del_flag = '0' and parent_id = #{id} limit 1
</select>
<select id="selectChildrenDeptById" parameterType="String" resultMap="SysDeptResult">
select * from sys_dept where find_in_set(#{id}, ancestors)
</select>
<select id="selectChildrenDeptById" parameterType="String" resultMap="SysDeptResult">
select * from sys_dept where find_in_set(#{id}, ancestors)
</select>
<select id="selectNormalChildrenDeptById" parameterType="String" resultType="int">
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{id}, ancestors)
</select>
<select id="selectNormalChildrenDeptById" parameterType="String" resultType="int">
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{id}, ancestors)
</select>
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} limit 1
</select>
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} limit 1
</select>
<insert id="insertDept" parameterType="com.shuili.common.core.domain.entity.SysDept">
insert into sys_dept(
<if test="id != null and id != ''">id,</if>
<if test="dataType != null and id != ''">data_type,</if>
<if test="beginDate != null and id != ''">begin_date,</if>
<if test="endDate != null and id != ''">end_date,</if>
<if test="ipEnd != null and ipEnd != ''">ip_end,</if>
<if test="ipStart != null and ipStart != ''">ip_start,</if>
<if test="isComment != null and isComment != ''">is_comment,</if>
<if test="isDownload != null and isDownload != ''">is_download,</if>
<if test="parentId != null and parentId != ''">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null and orderNum != ''">order_num,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="tag != null">tag,</if>
<if test="createUid != null and createUid != ''">create_uid,</if>
<if test="name != null and name != ''">name,</if>
<if test="pcLogo != null and pcLogo != ''">pc_logo,</if>
<if test="pcBackground != null and pcBackground != ''">pc_background,</if>
<if test="adminName != null and adminName != ''">admin_name,</if>
<if test="adminLogo != null and adminLogo != ''">admin_logo,</if>
<if test="xzqhId != null and adminLogo != ''">xzqh_id,</if>
create_time
)values(
<if test="id != null and id != ''">#{id},</if>
<if test="dataType != null and id != ''">#{dataType},</if>
<if test="beginDate != null and id != ''">#{beginDate},</if>
<if test="endDate != null and id != ''">#{endDate},</if>
<if test="ipEnd != null and ipEnd != ''">#{ipEnd},</if>
<if test="ipStart != null and ipStart != ''">#{ipStart},</if>
<if test="isComment != null and isComment != ''">#{isComment},</if>
<if test="isDownload != null and isDownload != ''">#{isDownload},</if>
<if test="parentId != null and parentId != ''">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="tag != null">#{tag},</if>
<if test="createUid != null and createUid != ''">#{createUid},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="pcLogo != null and pcLogo != ''">#{pcLogo},</if>
<if test="pcBackground != null and pcBackground != ''">#{pcBackground},</if>
<if test="adminName != null and adminName != ''">#{adminName},</if>
<if test="adminLogo != null and adminLogo != ''">#{adminLogo},</if>
<if test="xzqhId != null and adminLogo != ''">#{xzqhId},</if>
sysdate()
)
</insert>
<update id="updateDept" parameterType="com.shuili.common.core.domain.entity.SysDept">
update sys_dept
<set>
<if test="parentId != null and parentId != ''">parent_id = #{parentId},</if>
data_type = #{dataType},begin_date = #{beginDate},end_date = #{endDate},
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="isComment != null and isComment != ''">is_comment = #{isComment},</if>
<if test="isDownload != null and isDownload != ''">is_download = #{isDownload},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="tag != null and tag != ''">tag = #{tag},</if>
<if test="updateUid != null and updateUid != ''">update_uid = #{updateUid},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="pcLogo != null and pcLogo != ''">pc_logo = #{pcLogo},</if>
<if test="pcBackground != null and pcBackground != ''">pc_background = #{pcBackground},</if>
<if test="adminName != null and adminName != ''">admin_name = #{adminName},</if>
<if test="adminLogo != null and adminLogo != ''">admin_logo = #{adminLogo},</if>
<if test="ipEnd != null and ipEnd != ''">ip_end = #{ipEnd},</if>
<if test="ipStart != null and ipStart != ''">ip_start = #{ipStart},</if>
update_time = sysdate()
</set>
where id = #{id}
</update>
<update id="updateDeptChildren" parameterType="java.util.List">
update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index"
separator=" " open="case id" close="end">
when #{item.id} then #{item.ancestors}
</foreach>
where id in
<foreach collection="depts" item="item" index="index"
separator="," open="(" close=")">
#{item.id}
</foreach>
</update>
<update id="updateDeptStatus" parameterType="com.shuili.common.core.domain.entity.SysDept">
update sys_dept a
<set>
<if test="status != null and status != ''">a.status = #{status},</if>
<if test="updateUid != null and updateUid != ''">a.update_uid = #{updateUid},</if>
a.update_time = sysdate()
insert into sys_dept(
<if test="id != null and id != ''">id,</if>
<if test="dataType != null and id != ''">data_type,</if>
<if test="beginDate != null and id != ''">begin_date,</if>
<if test="endDate != null and id != ''">end_date,</if>
<if test="ipEnd != null and ipEnd != ''">ip_end,</if>
<if test="ipStart != null and ipStart != ''">ip_start,</if>
<if test="isComment != null and isComment != ''">is_comment,</if>
<if test="isDownload != null and isDownload != ''">is_download,</if>
<if test="parentId != null and parentId != ''">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null and orderNum != ''">order_num,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="tag != null">tag,</if>
<if test="createUid != null and createUid != ''">create_uid,</if>
<if test="name != null and name != ''">name,</if>
<if test="pcLogo != null and pcLogo != ''">pc_logo,</if>
<if test="pcBackground != null and pcBackground != ''">pc_background,</if>
<if test="adminName != null and adminName != ''">admin_name,</if>
<if test="adminLogo != null and adminLogo != ''">admin_logo,</if>
<if test="xzqhId != null and adminLogo != ''">xzqh_id,</if>
create_time
)values(
<if test="id != null and id != ''">#{id},</if>
<if test="dataType != null and id != ''">#{dataType},</if>
<if test="beginDate != null and id != ''">#{beginDate},</if>
<if test="endDate != null and id != ''">#{endDate},</if>
<if test="ipEnd != null and ipEnd != ''">#{ipEnd},</if>
<if test="ipStart != null and ipStart != ''">#{ipStart},</if>
<if test="isComment != null and isComment != ''">#{isComment},</if>
<if test="isDownload != null and isDownload != ''">#{isDownload},</if>
<if test="parentId != null and parentId != ''">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="tag != null">#{tag},</if>
<if test="createUid != null and createUid != ''">#{createUid},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="pcLogo != null and pcLogo != ''">#{pcLogo},</if>
<if test="pcBackground != null and pcBackground != ''">#{pcBackground},</if>
<if test="adminName != null and adminName != ''">#{adminName},</if>
<if test="adminLogo != null and adminLogo != ''">#{adminLogo},</if>
<if test="xzqhId != null and adminLogo != ''">#{xzqhId},</if>
sysdate()
)
</insert>
<update id="updateDept" parameterType="com.shuili.common.core.domain.entity.SysDept">
update sys_dept
<set>
<if test="parentId != null and parentId != ''">parent_id = #{parentId},</if>
data_type = #{dataType},begin_date = #{beginDate},end_date = #{endDate},
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="isComment != null and isComment != ''">is_comment = #{isComment},</if>
<if test="xzqhId != null and xzqhId != ''">xzqh_id = #{xzqhId},</if>
<if test="isDownload != null and isDownload != ''">is_download = #{isDownload},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="tag != null and tag != ''">tag = #{tag},</if>
<if test="updateUid != null and updateUid != ''">update_uid = #{updateUid},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="pcLogo != null and pcLogo != ''">pc_logo = #{pcLogo},</if>
<if test="pcBackground != null and pcBackground != ''">pc_background = #{pcBackground},</if>
<if test="adminName != null and adminName != ''">admin_name = #{adminName},</if>
<if test="adminLogo != null and adminLogo != ''">admin_logo = #{adminLogo},</if>
<if test="ipEnd != null and ipEnd != ''">ip_end = #{ipEnd},</if>
<if test="ipStart != null and ipStart != ''">ip_start = #{ipStart},</if>
update_time = sysdate()
</set>
where id = #{id}
</update>
<update id="updateDeptChildren" parameterType="java.util.List">
update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index"
separator=" " open="case id" close="end">
when #{item.id} then #{item.ancestors}
</foreach>
where id in
<foreach collection="depts" item="item" index="index"
separator="," open="(" close=")">
#{item.id}
</foreach>
</update>
<update id="updateDeptStatus" parameterType="com.shuili.common.core.domain.entity.SysDept">
update sys_dept a
<set>
<if test="status != null and status != ''">a.status = #{status},</if>
<if test="updateUid != null and updateUid != ''">a.update_uid = #{updateUid},</if>
a.update_time = sysdate()
</set>
where FIND_IN_SET(a.id,#{ancestors})
</update>
where FIND_IN_SET(a.id,#{ancestors})
</update>
<delete id="deleteDeptById" parameterType="String">
delete from sys_dept where id = #{id}
</delete>
<delete id="deleteDeptById" parameterType="String">
delete from sys_dept where id = #{id}
</delete>
</mapper>

Loading…
Cancel
Save