1. 补全后端的其余模块
2. 新增用户管理多部门的逻辑
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package cn.iocoder.yudao.framework.business.core.db;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
|
||||
/**
|
||||
* @author chenbowen
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class BusinessBaseDO extends TenantBaseDO {
|
||||
|
||||
/** 公司编号 */
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long companyId;
|
||||
/** 公司名称 */
|
||||
@TableField(fill = FieldFill.INSERT, jdbcType = JdbcType.VARCHAR)
|
||||
private String companyName;
|
||||
/** 部门编号 */
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long deptId;
|
||||
/** 部门名称 */
|
||||
@TableField(fill = FieldFill.INSERT, jdbcType = JdbcType.VARCHAR)
|
||||
private String deptName;
|
||||
/** 任务编号 */
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.VARCHAR)
|
||||
private Long taskId;
|
||||
/** 岗位编号 */
|
||||
@TableField(fill = FieldFill.INSERT, jdbcType = JdbcType.VARCHAR)
|
||||
private Long postId;
|
||||
|
||||
/**
|
||||
* 清除 creator、createTime、updateTime、updater 等字段,避免前端直接传递这些字段,导致被更新
|
||||
*/
|
||||
@Override
|
||||
public void clean() {
|
||||
super.clean();
|
||||
this.companyId = null;
|
||||
this.companyName = null;
|
||||
this.deptId = null;
|
||||
this.deptName = null;
|
||||
this.taskId = null;
|
||||
this.postId = null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.framework.business.core.util;
|
||||
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 用户与部门一对多改动,此处统一处理用户与部门关系
|
||||
* @author chenbowen
|
||||
*/
|
||||
public class DeptUtil {
|
||||
/**
|
||||
* 从用户信息中获取唯一 deptId (现阶段取第一个,后续如有特殊规则统一调整此处即可)
|
||||
*/
|
||||
public static Long getDeptId(AdminUserRespDTO adminUserRespDTO) {
|
||||
List<Long> deptIds = Optional.ofNullable(adminUserRespDTO.getDeptIds()).orElse(new ArrayList<>());
|
||||
return deptIds.stream().findFirst().orElse(0L);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user