针对智慧工地对公司框架进行优化

This commit is contained in:
15856 2025-01-03 19:04:56 +08:00
parent c1e6fbbec7
commit 3245fe6c12
6 changed files with 53 additions and 4 deletions

View File

@ -122,9 +122,16 @@ public class SysDept extends BaseEntity {
*角色id
*/
private Long roleId;
/**
* 用户信息
*/
private SysUser sysUser;
/**
*
* @param city
*/
private String keyWord;
public void setCity(String city) {
this.city = city;

View File

@ -136,7 +136,7 @@ public class SysDeptController extends BaseController
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) {
return error("该部门包含未停用的子部门!");
}else if (StringUtils.isNotNull(dept.getSysUser()) &&!userService.checkUserNameUnique(dept.getSysUser())) {
}else if (StringUtils.isNotNull(dept.getSysUser()) && !userService.checkUserNameUnique(dept.getSysUser())) {
throw new ServiceException("修改部门'" + dept.getSysUser().getUserName() + "'失败,登录账号已存在");
} else if (StringUtils.isNotEmpty(dept.getSysUser().getPhonenumber()) && !userService.checkPhoneUnique(dept.getSysUser())) {
throw new ServiceException("修改部门'" + dept.getSysUser().getUserName() + "'失败,手机号码已存在");
@ -186,4 +186,22 @@ public class SysDeptController extends BaseController
}
return getDataTableError(deptList);
}
/**
* 公司注销
* @param dept
* @return
*/
@PostMapping("/deptLogout")
@SysLog(title = "运营人员获取公司列表", businessType = OperaType.UPDATE,logType = 0,module = "系统管理->部门管理")
public AjaxResult deptLogout(@Validated @RequestBody SysDept dept) {
try{
log.info("公司信息{}",dept.getDeptId());
return toAjax(deptService.deptLogout(dept.getDeptId()));
}catch (Exception e){
log.error(e.toString(),e);
}
return error("系统异常");
}
}

View File

@ -139,4 +139,11 @@ public interface SysDeptMapper
* @return
*/
SysUser selectDeptAndUserById(Long deptId);
/**
* 公司注销
* @param deptId
* @return
*/
int deptLogout(Long deptId);
}

View File

@ -137,4 +137,11 @@ public interface ISysDeptService
* @return
*/
List<SysDept> getDeptList(SysDept dept);
/**
* 公司注销
* @param deptId
* @return
*/
int deptLogout(Long deptId);
}

View File

@ -426,7 +426,7 @@ public class SysDeptServiceImpl implements ISysDeptService
updateParentDeptStatusNormal(dept);
}
//判断是否是修改公司信息并判断是否关联用户信息
if (systemConfig.isCreateUserAndRole() && dept.getDeptId()==0L){
if (systemConfig.isCreateUserAndRole() && dept.getParentId()==0L){
updateUserAndRole(dept);
}
@ -505,6 +505,10 @@ public class SysDeptServiceImpl implements ISysDeptService
return deptMapper.getDeptList(dept);
}
@Override
public int deptLogout(Long deptId) {
return deptMapper.deptLogout(deptId);
}
/**

View File

@ -146,7 +146,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
</select>
<select id="getDeptList" resultType="com.bonus.system.api.domain.SysDept">
select * from sys_dept where parent_id='0'
select * from sys_dept sd where parent_id='0'
<if test="keyWord != null and keyWord != ''">
and sd.dept_name like concat('%', #{keyWord}, '%')
</if>
</select>
<select id="selectDeptAndUserById" resultType="com.bonus.system.api.domain.SysUser">
select su.nick_name as nickName,su.user_name as userName,su.password as password,su.phonenumber as phonenumber,
@ -242,6 +245,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{deptId}
</foreach>
</update>
<update id="deptLogout">
update sys_dept set status = '2' where dept_id = #{deptId}
</update>
<delete id="deleteDeptById" parameterType="Long">
update sys_dept set del_flag = '2' where dept_id = #{deptId}