新增用户时保存所属公司,方便租赁推送查询用户信息

This commit is contained in:
15856 2024-10-28 15:08:38 +08:00
parent 84f1113c21
commit e718a2e1b4
2 changed files with 6 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import com.bonus.sgzb.system.mapper.SysDeptMapper;
import com.bonus.sgzb.system.mapper.SysRoleMapper;
import com.bonus.sgzb.system.mapper.SysUserMapper;
import com.bonus.sgzb.system.service.ISysDeptService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -30,6 +31,7 @@ import java.util.stream.Collectors;
*
* @author ruoyi
*/
@Slf4j
@Service
public class SysDeptServiceImpl implements ISysDeptService {
@Resource
@ -231,6 +233,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
*/
@Override
public int insertDept(SysDept dept) {
log.info("insertDept========{}", dept);
SysDept info = deptMapper.selectDeptById(dept.getParentId());
// 如果父节点不为正常状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {

View File

@ -282,6 +282,9 @@ public class SysUserServiceImpl implements ISysUserService {
}*/
// 新增用户信息
Long deptId = user.getDeptId();
SysDept sysDept = deptMapper.selectDeptById(deptId);
user.setCompanyId(sysDept.getCompanyId());
int rows = userMapper.insertUser(user);
// 新增用户岗位关联
insertUserPost(user);