|
|
|
|
@ -18,6 +18,7 @@ import com.biutag.mapper.system.DeptMapper;
|
|
|
|
|
import com.biutag.util.ListUtils; |
|
|
|
|
import com.biutag.util.StringUtils; |
|
|
|
|
import com.biutag.util.TimeUtils; |
|
|
|
|
import com.biutag.util.ToolUtils; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
@ -157,18 +158,41 @@ class DeptServiceImpl implements IDeptService {
|
|
|
|
|
|
|
|
|
|
Assert.isNull(Dept, "顶级部门只允许有一个"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Dept pDept = deptMapper.selectOne( |
|
|
|
|
new QueryWrapper<Dept>() |
|
|
|
|
.select("id,pid,name,level,path_trace") |
|
|
|
|
.eq("id", createValidate.getPid()) |
|
|
|
|
.eq("is_delete", 0) |
|
|
|
|
.last("limit 1")); |
|
|
|
|
Assert.notNull(pDept, "上级部门不存在"); |
|
|
|
|
Dept model = new Dept(); |
|
|
|
|
model.setPid(createValidate.getPid()); |
|
|
|
|
model.setName(createValidate.getName()); |
|
|
|
|
//model.setDuty(createValidate.getDuty());
|
|
|
|
|
model.setLevel(pDept.getLevel()+1); |
|
|
|
|
String uuid=ToolUtils.makeUUID(); |
|
|
|
|
model.setUuid(uuid); |
|
|
|
|
model.setMobile(createValidate.getMobile()); |
|
|
|
|
model.setCategory(createValidate.getCategory()); |
|
|
|
|
model.setSort(createValidate.getSort()); |
|
|
|
|
model.setIsStop(createValidate.getIsStop()); |
|
|
|
|
model.setCreateTime(System.currentTimeMillis() / 1000); |
|
|
|
|
model.setUpdateTime(System.currentTimeMillis() / 1000); |
|
|
|
|
if(model.getLevel()>=2){ |
|
|
|
|
model.setFullName(pDept.getName()+createValidate.getName()); |
|
|
|
|
}else { |
|
|
|
|
model.setFullName(createValidate.getName()); |
|
|
|
|
} |
|
|
|
|
deptMapper.insert(model); |
|
|
|
|
Dept insertDept = deptMapper.selectOne( |
|
|
|
|
new QueryWrapper<Dept>() |
|
|
|
|
.select(Dept.class, info -> |
|
|
|
|
!info.getColumn().equals("is_delete") && |
|
|
|
|
!info.getColumn().equals("delete_time")) |
|
|
|
|
.eq("uuid",uuid) |
|
|
|
|
.eq("is_delete", 0) |
|
|
|
|
.last("limit 1")); |
|
|
|
|
insertDept.setPathTrace(pDept.getPathTrace()+","+insertDept.getId()); |
|
|
|
|
deptMapper.updateById(insertDept); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -189,9 +213,22 @@ class DeptServiceImpl implements IDeptService {
|
|
|
|
|
.last("limit 1")); |
|
|
|
|
|
|
|
|
|
Assert.notNull(model, "部门不存在"); |
|
|
|
|
Dept pDept = deptMapper.selectOne( |
|
|
|
|
new QueryWrapper<Dept>() |
|
|
|
|
.select("id,pid,name,level,path_trace") |
|
|
|
|
.eq("id", updateValidate.getPid()) |
|
|
|
|
.eq("is_delete", 0) |
|
|
|
|
.last("limit 1")); |
|
|
|
|
Assert.notNull(pDept, "上级部门不存在"); |
|
|
|
|
Assert.isFalse((model.getPid().equals(0) && updateValidate.getPid()>0), "顶级部门不能修改上级"); |
|
|
|
|
Assert.isFalse(updateValidate.getId().equals(updateValidate.getPid()), "上级部门不能是自己"); |
|
|
|
|
|
|
|
|
|
model.setLevel(pDept.getLevel()+1); |
|
|
|
|
if(model.getLevel()>=2){ |
|
|
|
|
model.setFullName(pDept.getName()+updateValidate.getName()); |
|
|
|
|
}else { |
|
|
|
|
model.setFullName(updateValidate.getName()); |
|
|
|
|
} |
|
|
|
|
model.setPathTrace(pDept.getPathTrace()+","+updateValidate.getId()); |
|
|
|
|
model.setPid(updateValidate.getPid()); |
|
|
|
|
model.setName(updateValidate.getName()); |
|
|
|
|
model.setCategory(updateValidate.getCategory()); |
|
|
|
|
@ -231,7 +268,7 @@ class DeptServiceImpl implements IDeptService {
|
|
|
|
|
|
|
|
|
|
PoliceUser PoliceUser = policeUserMapper.selectOne(new QueryWrapper<PoliceUser>() |
|
|
|
|
.select("id,nickname") |
|
|
|
|
.eq("dept_id", id) |
|
|
|
|
.eq("dept_ids", id) |
|
|
|
|
.eq("is_delete", 0) |
|
|
|
|
.last("limit 1")); |
|
|
|
|
|
|
|
|
|
|