提交代码
parent
38419e4369
commit
286e8abc0a
|
@ -0,0 +1,32 @@
|
||||||
|
package com.yanzhu.system.api;
|
||||||
|
|
||||||
|
import com.yanzhu.common.core.constant.SecurityConstants;
|
||||||
|
import com.yanzhu.common.core.constant.ServiceNameConstants;
|
||||||
|
import com.yanzhu.common.core.domain.R;
|
||||||
|
import com.yanzhu.system.api.domain.SysDept;
|
||||||
|
import com.yanzhu.system.api.factory.RemoteUserFallbackFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestHeader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门服务
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@FeignClient(contextId = "remoteDeptService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
|
||||||
|
public interface RemoteDeptService
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过部门主键查询部门信息
|
||||||
|
*
|
||||||
|
* @param deptId 部门主键
|
||||||
|
* @param source 请求来源
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/dept/info/{deptId}")
|
||||||
|
public R<SysDept> getDeptInfo(@PathVariable("deptId") Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.yanzhu.system.api;
|
||||||
|
|
||||||
|
import com.yanzhu.common.core.constant.SecurityConstants;
|
||||||
|
import com.yanzhu.common.core.constant.ServiceNameConstants;
|
||||||
|
import com.yanzhu.common.core.domain.R;
|
||||||
|
import com.yanzhu.system.api.factory.RemoteFileFallbackFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestHeader;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目服务
|
||||||
|
*
|
||||||
|
* @author JiangYuQi
|
||||||
|
*/
|
||||||
|
@FeignClient(contextId = "remoteProService", value = ServiceNameConstants.MANAGE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
|
||||||
|
public interface RemoteProService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 项目详情
|
||||||
|
*
|
||||||
|
* @param id 项目主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/proProjectInfo/info/{id}")
|
||||||
|
public R<Map<String,Object>> info(@PathVariable("id") Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户入场项目信息
|
||||||
|
*
|
||||||
|
* @param userId 用户主键
|
||||||
|
* @param source 请求来源
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/proProjectInfoUsers/projects/{userId}")
|
||||||
|
public R<List<Map<String, Object>>> getProjects(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
}
|
|
@ -34,6 +34,17 @@ public interface RemoteUserService
|
||||||
@GetMapping("/user/info/{username}")
|
@GetMapping("/user/info/{username}")
|
||||||
public R<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public R<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户名查询用户信息
|
||||||
|
*
|
||||||
|
* @param username 用户名
|
||||||
|
* @param deptId 公司主键
|
||||||
|
* @param source 请求来源
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/user/infoAndDept/{username}/{deptId}")
|
||||||
|
public R<LoginUser> getUserInfo(@PathVariable("username") String username,@PathVariable("deptId") Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户主键查询用户信息
|
* 通过用户主键查询用户信息
|
||||||
*
|
*
|
||||||
|
@ -54,14 +65,4 @@ public interface RemoteUserService
|
||||||
@PostMapping("/user/register")
|
@PostMapping("/user/register")
|
||||||
public R<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public R<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前用户入场项目信息
|
|
||||||
*
|
|
||||||
* @param userId 用户主键
|
|
||||||
* @param source 请求来源
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@GetMapping("/user/projects/{userId}")
|
|
||||||
public R<List<Map<String, Object>>> getProjects(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.yanzhu.system.api.domain;
|
package com.yanzhu.system.api.domain;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
@ -24,6 +25,12 @@ public class SysRole extends BaseEntity
|
||||||
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
|
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
|
/** 公司ID */
|
||||||
|
private Long comId;
|
||||||
|
|
||||||
|
/** 项目ID */
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
/** 角色名称 */
|
/** 角色名称 */
|
||||||
@Excel(name = "角色名称")
|
@Excel(name = "角色名称")
|
||||||
private String roleName;
|
private String roleName;
|
||||||
|
@ -95,11 +102,22 @@ public class SysRole extends BaseEntity
|
||||||
return isAdmin(this.roleId);
|
return isAdmin(this.roleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean isAdmin(Long roleId)
|
public static boolean isAdmin(Long roleId)
|
||||||
{
|
{
|
||||||
return roleId != null && 1L == roleId;
|
return roleId != null && 1L == roleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isGsAdmin(String roleKey)
|
||||||
|
{
|
||||||
|
return Objects.equals(roleKey,"gsAdmin");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isGsAdmin(List<String> roleKeys)
|
||||||
|
{
|
||||||
|
return roleKeys.contains("gsAdmin");
|
||||||
|
}
|
||||||
|
|
||||||
@NotBlank(message = "角色名称不能为空")
|
@NotBlank(message = "角色名称不能为空")
|
||||||
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
|
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
|
||||||
public String getRoleName()
|
public String getRoleName()
|
||||||
|
@ -241,10 +259,28 @@ public class SysRole extends BaseEntity
|
||||||
this.roleDeptList = roleDeptList;
|
this.roleDeptList = roleDeptList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getComId() {
|
||||||
|
return comId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComId(Long comId) {
|
||||||
|
this.comId = comId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getProjectId() {
|
||||||
|
return projectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProjectId(Long projectId) {
|
||||||
|
this.projectId = projectId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("roleId", getRoleId())
|
.append("roleId", getRoleId())
|
||||||
|
.append("comId", getComId())
|
||||||
|
.append("projectId", getProjectId())
|
||||||
.append("roleName", getRoleName())
|
.append("roleName", getRoleName())
|
||||||
.append("roleKey", getRoleKey())
|
.append("roleKey", getRoleKey())
|
||||||
.append("roleSort", getRoleSort())
|
.append("roleSort", getRoleSort())
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.yanzhu.system.api.factory;
|
||||||
|
|
||||||
|
import com.yanzhu.common.core.domain.R;
|
||||||
|
import com.yanzhu.system.api.RemoteDeptService;
|
||||||
|
import com.yanzhu.system.api.domain.SysDept;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门服务降级处理
|
||||||
|
*
|
||||||
|
* @author JiangYuQi
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class RemoteDeptFallbackFactory implements FallbackFactory<RemoteDeptService> {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(RemoteDeptFallbackFactory.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RemoteDeptService create(Throwable throwable) {
|
||||||
|
log.error("部门服务调用失败:{}", throwable.getMessage());
|
||||||
|
return new RemoteDeptService() {
|
||||||
|
@Override
|
||||||
|
public R<SysDept> getDeptInfo(Long deptId, String source) {
|
||||||
|
return R.fail("获取部门失败:" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,9 +10,9 @@ import org.springframework.stereotype.Component;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户服务降级处理
|
* 管理服务降级处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author JiangYuQi
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class RemoteFlowFallbackFactory implements FallbackFactory<RemoteFlowService>
|
public class RemoteFlowFallbackFactory implements FallbackFactory<RemoteFlowService>
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.yanzhu.system.api.factory;
|
||||||
|
|
||||||
|
import com.yanzhu.common.core.domain.R;
|
||||||
|
import com.yanzhu.system.api.RemoteProService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件服务降级处理
|
||||||
|
*
|
||||||
|
* @author JiangYuQi
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class RemoteProFallbackFactory implements FallbackFactory<RemoteProService>
|
||||||
|
{
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(RemoteProFallbackFactory.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RemoteProService create(Throwable throwable)
|
||||||
|
{
|
||||||
|
log.error("项目服务调用失败:{}", throwable.getMessage());
|
||||||
|
return new RemoteProService()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public R<Map<String,Object>> info(Long id, String source)
|
||||||
|
{
|
||||||
|
return R.fail("查询项目失败:" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<List<Map<String, Object>>> getProjects(Long userId, String source)
|
||||||
|
{
|
||||||
|
return R.fail("获取用户项目信息失败:" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
|
||||||
/**
|
/**
|
||||||
* 角色服务降级处理
|
* 角色服务降级处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author JiangYuQi
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class RemoteRoleFallbackFactory implements FallbackFactory<RemoteRoleService> {
|
public class RemoteRoleFallbackFactory implements FallbackFactory<RemoteRoleService> {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import java.util.Map;
|
||||||
/**
|
/**
|
||||||
* 用户服务降级处理
|
* 用户服务降级处理
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author JiangYuQi
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserService>
|
public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserService>
|
||||||
|
@ -34,6 +34,12 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||||
return R.fail("获取用户失败:" + throwable.getMessage());
|
return R.fail("获取用户失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<LoginUser> getUserInfo(String username, Long deptId, String source)
|
||||||
|
{
|
||||||
|
return R.fail("获取用户失败:" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<SysUser> getSysUserInfo(Long userId, String source)
|
public R<SysUser> getSysUserInfo(Long userId, String source)
|
||||||
{
|
{
|
||||||
|
@ -45,12 +51,6 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||||
{
|
{
|
||||||
return R.fail("注册用户失败:" + throwable.getMessage());
|
return R.fail("注册用户失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public R<List<Map<String, Object>>> getProjects(Long userId, String source)
|
|
||||||
{
|
|
||||||
return R.fail("获取用户项目信息失败:" + throwable.getMessage());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,12 @@ public class LoginUser implements Serializable
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目单位信息
|
* 项目信息
|
||||||
|
*/
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目公司信息
|
||||||
*/
|
*/
|
||||||
private Long projectDeptId;
|
private Long projectDeptId;
|
||||||
|
|
||||||
|
@ -174,6 +179,14 @@ public class LoginUser implements Serializable
|
||||||
this.projectDeptId = projectDeptId;
|
this.projectDeptId = projectDeptId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getProjectName() {
|
||||||
|
return projectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProjectName(String projectName) {
|
||||||
|
this.projectName = projectName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 无参构造方法
|
* 无参构造方法
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,3 +3,5 @@ com.yanzhu.system.api.factory.RemoteLogFallbackFactory
|
||||||
com.yanzhu.system.api.factory.RemoteFileFallbackFactory
|
com.yanzhu.system.api.factory.RemoteFileFallbackFactory
|
||||||
com.yanzhu.system.api.factory.RemoteFlowFallbackFactory
|
com.yanzhu.system.api.factory.RemoteFlowFallbackFactory
|
||||||
com.yanzhu.system.api.factory.RemoteRoleFallbackFactory
|
com.yanzhu.system.api.factory.RemoteRoleFallbackFactory
|
||||||
|
com.yanzhu.system.api.factory.RemoteProFallbackFactory
|
||||||
|
com.yanzhu.system.api.factory.RemoteDeptFallbackFactory
|
|
@ -1,21 +1,26 @@
|
||||||
package com.yanzhu.auth.controller;
|
package com.yanzhu.auth.controller;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.yanzhu.auth.form.LoginBody;
|
import com.yanzhu.auth.form.LoginBody;
|
||||||
import com.yanzhu.auth.form.RegisterBody;
|
import com.yanzhu.auth.form.RegisterBody;
|
||||||
import com.yanzhu.auth.service.SysLoginService;
|
import com.yanzhu.auth.service.SysLoginService;
|
||||||
|
import com.yanzhu.common.core.constant.SecurityConstants;
|
||||||
import com.yanzhu.common.core.domain.R;
|
import com.yanzhu.common.core.domain.R;
|
||||||
|
import com.yanzhu.common.core.text.Convert;
|
||||||
import com.yanzhu.common.core.utils.JwtUtils;
|
import com.yanzhu.common.core.utils.JwtUtils;
|
||||||
import com.yanzhu.common.core.utils.StringUtils;
|
import com.yanzhu.common.core.utils.StringUtils;
|
||||||
import com.yanzhu.common.security.auth.AuthUtil;
|
import com.yanzhu.common.security.auth.AuthUtil;
|
||||||
import com.yanzhu.common.security.service.TokenService;
|
import com.yanzhu.common.security.service.TokenService;
|
||||||
import com.yanzhu.common.security.utils.SecurityUtils;
|
import com.yanzhu.common.security.utils.SecurityUtils;
|
||||||
|
import com.yanzhu.system.api.RemoteProService;
|
||||||
|
import com.yanzhu.system.api.RemoteUserService;
|
||||||
|
import com.yanzhu.system.api.domain.SysUser;
|
||||||
import com.yanzhu.system.api.model.LoginUser;
|
import com.yanzhu.system.api.model.LoginUser;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* token 控制
|
* token 控制
|
||||||
|
@ -31,6 +36,12 @@ public class TokenController
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysLoginService sysLoginService;
|
private SysLoginService sysLoginService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RemoteProService remoteProService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
@PostMapping("login")
|
@PostMapping("login")
|
||||||
public R<?> login(@RequestBody LoginBody form)
|
public R<?> login(@RequestBody LoginBody form)
|
||||||
{
|
{
|
||||||
|
@ -40,6 +51,53 @@ public class TokenController
|
||||||
return R.ok(tokenService.createToken(userInfo));
|
return R.ok(tokenService.createToken(userInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切换项目登录
|
||||||
|
* @param proId 切换项目登录
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/switchProject/{proId}")
|
||||||
|
public R<?> switchProject(@PathVariable("proId") Long proId,HttpServletRequest request)
|
||||||
|
{
|
||||||
|
if(SecurityUtils.isAdmin(SecurityUtils.getUserId()) || SecurityUtils.isGSAdmin()){
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||||
|
if (StringUtils.isNotNull(loginUser))
|
||||||
|
{
|
||||||
|
R<Map<String, Object>> dataResult = remoteProService.info(proId,SecurityConstants.INNER);
|
||||||
|
Map<String, Object> proData = dataResult.getData();
|
||||||
|
SysUser user = loginUser.getSysUser();
|
||||||
|
user.setActiveComId(Convert.toLong(proData.get("comId")));
|
||||||
|
user.setActiveProjectId(Convert.toLong(proData.get("id")));
|
||||||
|
user.setActiveProjectName(Convert.toStr(proData.get("projectName")));
|
||||||
|
loginUser.setProjectId(Convert.toLong(proData.get("id")));
|
||||||
|
loginUser.setProjectName(Convert.toStr(proData.get("projectName")));
|
||||||
|
loginUser.setProjectDeptId(Convert.toLong(proData.get("comId")));
|
||||||
|
// 刷新令牌有效期
|
||||||
|
tokenService.refreshToken(loginUser);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// 查询用户信息
|
||||||
|
R<LoginUser> userResult = remoteUserService.getUserInfo(SecurityUtils.getUsername(), proId, SecurityConstants.INNER);
|
||||||
|
LoginUser userInfo = userResult.getData();
|
||||||
|
SysUser user = userResult.getData().getSysUser();
|
||||||
|
// 补充用户项目信息
|
||||||
|
if(Objects.nonNull(user.getActiveComId())){
|
||||||
|
userInfo.setProjectDeptId(user.getActiveComId());
|
||||||
|
}
|
||||||
|
if(Objects.nonNull(user.getActiveProjectId())){
|
||||||
|
userInfo.setProjectId(user.getActiveProjectId());
|
||||||
|
}
|
||||||
|
if(Objects.nonNull(user.getActiveProjectName())){
|
||||||
|
userInfo.setProjectName(user.getActiveProjectName());
|
||||||
|
}
|
||||||
|
// 刷新令牌有效期
|
||||||
|
tokenService.refreshToken(userInfo);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
return R.fail();
|
||||||
|
}
|
||||||
|
|
||||||
@DeleteMapping("logout")
|
@DeleteMapping("logout")
|
||||||
public R<?> logout(HttpServletRequest request)
|
public R<?> logout(HttpServletRequest request)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,6 +20,7 @@ import com.yanzhu.system.api.model.LoginUser;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录校验方法
|
* 登录校验方法
|
||||||
|
@ -102,12 +103,15 @@ public class SysLoginService
|
||||||
passwordService.validate(user, password);
|
passwordService.validate(user, password);
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
|
||||||
|
|
||||||
// 用户项目信息
|
// 补充用户项目信息
|
||||||
R<List<Map<String, Object>>> projectResult = remoteUserService.getProjects(userInfo.getSysUser().getUserId(), SecurityConstants.INNER);
|
if(Objects.nonNull(user.getActiveComId())){
|
||||||
if(StringUtils.isNotNull(projectResult) && StringUtils.isNotEmpty(projectResult.getData())){
|
userInfo.setProjectDeptId(user.getActiveComId());
|
||||||
List<Map<String, Object>> list = projectResult.getData();
|
}
|
||||||
userInfo.setProjectId(Convert.toLong(list.get(0).get("project_id")));
|
if(Objects.nonNull(user.getActiveProjectId())){
|
||||||
userInfo.setProjectDeptId(Convert.toLong(list.get(0).get("dept_id")));
|
userInfo.setProjectId(user.getActiveProjectId());
|
||||||
|
}
|
||||||
|
if(Objects.nonNull(user.getActiveProjectName())){
|
||||||
|
userInfo.setProjectName(user.getActiveProjectName());
|
||||||
}
|
}
|
||||||
return userInfo;
|
return userInfo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,14 +41,17 @@ public class BaseEntity implements Serializable
|
||||||
/** 选中页签 */
|
/** 选中页签 */
|
||||||
private String activeTags;
|
private String activeTags;
|
||||||
|
|
||||||
/** 选中页签 */
|
/** 选中公司 */
|
||||||
private String activeComId;
|
private Long activeComId;
|
||||||
|
|
||||||
|
/** 选中项目 */
|
||||||
|
private Long activeProjectId;
|
||||||
|
|
||||||
|
/** 选中项目 */
|
||||||
|
private String activeProjectName;
|
||||||
|
|
||||||
/** 选中页签 */
|
/** 选中页签 */
|
||||||
private String activeProjectId;
|
private Long currentUserId;
|
||||||
|
|
||||||
/** 所属单位 */
|
|
||||||
private Long activeDeptId;
|
|
||||||
|
|
||||||
/** 请求参数 */
|
/** 请求参数 */
|
||||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
|
@ -136,27 +139,35 @@ public class BaseEntity implements Serializable
|
||||||
this.activeTags = activeTags;
|
this.activeTags = activeTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getActiveComId() {
|
public Long getActiveComId() {
|
||||||
return activeComId;
|
return activeComId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActiveComId(String activeComId) {
|
public void setActiveComId(Long activeComId) {
|
||||||
this.activeComId = activeComId;
|
this.activeComId = activeComId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getActiveProjectId() {
|
public Long getActiveProjectId() {
|
||||||
return activeProjectId;
|
return activeProjectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActiveProjectId(String activeProjectId) {
|
public void setActiveProjectId(Long activeProjectId) {
|
||||||
this.activeProjectId = activeProjectId;
|
this.activeProjectId = activeProjectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getActiveDeptId() {
|
public Long getCurrentUserId() {
|
||||||
return activeDeptId;
|
return currentUserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActiveDeptId(Long activeDeptId) {
|
public void setCurrentUserId(Long currentUserId) {
|
||||||
this.activeDeptId = activeDeptId;
|
this.currentUserId = currentUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getActiveProjectName() {
|
||||||
|
return activeProjectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActiveProjectName(String activeProjectName) {
|
||||||
|
this.activeProjectName = activeProjectName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,140 @@
|
||||||
|
package com.yanzhu.manage.domain;
|
||||||
|
|
||||||
|
import com.yanzhu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
public class ProDept extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 部门ID */
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/** 公司编号 */
|
||||||
|
private Long comId;
|
||||||
|
|
||||||
|
/** 父部门ID */
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/** 祖级列表 */
|
||||||
|
private String ancestors;
|
||||||
|
|
||||||
|
/** 部门名称 */
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
/** 部门简称 */
|
||||||
|
private String deptShortName;
|
||||||
|
|
||||||
|
/** 部门简称 */
|
||||||
|
private String deptCode;
|
||||||
|
|
||||||
|
/** 部门详情 */
|
||||||
|
private String deptType;
|
||||||
|
|
||||||
|
/** 部门详情 */
|
||||||
|
private String deptInfos;
|
||||||
|
|
||||||
|
/** 显示顺序 */
|
||||||
|
private Integer orderNum;
|
||||||
|
|
||||||
|
/** 负责人 */
|
||||||
|
private String leader;
|
||||||
|
|
||||||
|
/** 联系电话 */
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
public Long getDeptId() {
|
||||||
|
return deptId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeptId(Long deptId) {
|
||||||
|
this.deptId = deptId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getComId() {
|
||||||
|
return comId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComId(Long comId) {
|
||||||
|
this.comId = comId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getParentId() {
|
||||||
|
return parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentId(Long parentId) {
|
||||||
|
this.parentId = parentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAncestors() {
|
||||||
|
return ancestors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAncestors(String ancestors) {
|
||||||
|
this.ancestors = ancestors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeptName() {
|
||||||
|
return deptName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeptName(String deptName) {
|
||||||
|
this.deptName = deptName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeptShortName() {
|
||||||
|
return deptShortName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeptShortName(String deptShortName) {
|
||||||
|
this.deptShortName = deptShortName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeptCode() {
|
||||||
|
return deptCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeptCode(String deptCode) {
|
||||||
|
this.deptCode = deptCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeptType() {
|
||||||
|
return deptType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeptType(String deptType) {
|
||||||
|
this.deptType = deptType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeptInfos() {
|
||||||
|
return deptInfos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeptInfos(String deptInfos) {
|
||||||
|
this.deptInfos = deptInfos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOrderNum() {
|
||||||
|
return orderNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderNum(Integer orderNum) {
|
||||||
|
this.orderNum = orderNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLeader() {
|
||||||
|
return leader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLeader(String leader) {
|
||||||
|
this.leader = leader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,16 +21,12 @@ public class ProProjectInfo extends BaseEntity
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 所属单位 */
|
/** 所属单位 */
|
||||||
@Excel(name = "所属单位")
|
@Excel(name = "公司主键")
|
||||||
private Long deptId;
|
private Long comId;
|
||||||
|
|
||||||
/** 单位名称 */
|
/** 单位名称 */
|
||||||
@Excel(name = "单位名称")
|
@Excel(name = "公司名称")
|
||||||
private String deptName;
|
private String comName;
|
||||||
|
|
||||||
/** 部门主键 */
|
|
||||||
@Excel(name = "部门主键")
|
|
||||||
private Long visDeptId;
|
|
||||||
|
|
||||||
/** 显示部门 */
|
/** 显示部门 */
|
||||||
@Excel(name = "显示部门")
|
@Excel(name = "显示部门")
|
||||||
|
@ -168,24 +164,23 @@ public class ProProjectInfo extends BaseEntity
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
public void setDeptId(Long deptId)
|
|
||||||
{
|
public Long getComId() {
|
||||||
this.deptId = deptId;
|
return comId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getDeptId()
|
public void setComId(Long comId) {
|
||||||
{
|
this.comId = comId;
|
||||||
return deptId;
|
|
||||||
}
|
|
||||||
public void setVisDeptId(Long visDeptId)
|
|
||||||
{
|
|
||||||
this.visDeptId = visDeptId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getVisDeptId()
|
public String getComName() {
|
||||||
{
|
return comName;
|
||||||
return visDeptId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setComName(String comName) {
|
||||||
|
this.comName = comName;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDisDeptId(Long disDeptId)
|
public void setDisDeptId(Long disDeptId)
|
||||||
{
|
{
|
||||||
this.disDeptId = disDeptId;
|
this.disDeptId = disDeptId;
|
||||||
|
@ -458,14 +453,6 @@ public class ProProjectInfo extends BaseEntity
|
||||||
return isDel;
|
return isDel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDeptName() {
|
|
||||||
return deptName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeptName(String deptName) {
|
|
||||||
this.deptName = deptName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProjectLevel() {
|
public String getProjectLevel() {
|
||||||
return projectLevel;
|
return projectLevel;
|
||||||
}
|
}
|
||||||
|
@ -494,8 +481,7 @@ public class ProProjectInfo extends BaseEntity
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("id", getId())
|
.append("id", getId())
|
||||||
.append("deptId", getDeptId())
|
.append("comId", getComId())
|
||||||
.append("visDeptId", getVisDeptId())
|
|
||||||
.append("disDeptId", getDisDeptId())
|
.append("disDeptId", getDisDeptId())
|
||||||
.append("projectName", getProjectName())
|
.append("projectName", getProjectName())
|
||||||
.append("projectCode", getProjectCode())
|
.append("projectCode", getProjectCode())
|
||||||
|
|
|
@ -18,13 +18,13 @@ public class ProProjectInfoUsers extends BaseEntity
|
||||||
/** 主键 */
|
/** 主键 */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 单位主键 */
|
/** 公司主键 */
|
||||||
@Excel(name = "单位主键")
|
@Excel(name = "公司主键")
|
||||||
private Long deptId;
|
private Long comId;
|
||||||
|
|
||||||
/** 单位名称 */
|
/** 公司名称 */
|
||||||
@Excel(name = "单位名称")
|
@Excel(name = "公司名称")
|
||||||
private String deptName;
|
private String comName;
|
||||||
|
|
||||||
/** 项目主键 */
|
/** 项目主键 */
|
||||||
@Excel(name = "项目主键")
|
@Excel(name = "项目主键")
|
||||||
|
@ -54,6 +54,10 @@ public class ProProjectInfoUsers extends BaseEntity
|
||||||
@Excel(name = "进场状态")
|
@Excel(name = "进场状态")
|
||||||
private String useStatus;
|
private String useStatus;
|
||||||
|
|
||||||
|
/** 项目排序 */
|
||||||
|
@Excel(name = "项目排序")
|
||||||
|
private Long sortBy;
|
||||||
|
|
||||||
/** 删除标识 */
|
/** 删除标识 */
|
||||||
@Excel(name = "删除标识")
|
@Excel(name = "删除标识")
|
||||||
private Long isDel;
|
private Long isDel;
|
||||||
|
@ -67,15 +71,15 @@ public class ProProjectInfoUsers extends BaseEntity
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
public void setDeptId(Long deptId)
|
|
||||||
{
|
public Long getComId() {
|
||||||
this.deptId = deptId;
|
return comId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getDeptId()
|
public void setComId(Long comId) {
|
||||||
{
|
this.comId = comId;
|
||||||
return deptId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProjectId(Long projectId)
|
public void setProjectId(Long projectId)
|
||||||
{
|
{
|
||||||
this.projectId = projectId;
|
this.projectId = projectId;
|
||||||
|
@ -140,12 +144,12 @@ public class ProProjectInfoUsers extends BaseEntity
|
||||||
return isDel;
|
return isDel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDeptName() {
|
public String getComName() {
|
||||||
return deptName;
|
return comName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeptName(String deptName) {
|
public void setComName(String comName) {
|
||||||
this.deptName = deptName;
|
this.comName = comName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProjectName() {
|
public String getProjectName() {
|
||||||
|
@ -156,11 +160,19 @@ public class ProProjectInfoUsers extends BaseEntity
|
||||||
this.projectName = projectName;
|
this.projectName = projectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getSortBy() {
|
||||||
|
return sortBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSortBy(Long sortBy) {
|
||||||
|
this.sortBy = sortBy;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("id", getId())
|
.append("id", getId())
|
||||||
.append("deptId", getDeptId())
|
.append("comId", getComId())
|
||||||
.append("projectId", getProjectId())
|
.append("projectId", getProjectId())
|
||||||
.append("userId", getUserId())
|
.append("userId", getUserId())
|
||||||
.append("userName", getUserName())
|
.append("userName", getUserName())
|
||||||
|
|
|
@ -15,14 +15,14 @@ public interface ProProjectInfoDeptsMapper
|
||||||
* 查询参建单位
|
* 查询参建单位
|
||||||
*
|
*
|
||||||
* @param id 参建单位主键
|
* @param id 参建单位主键
|
||||||
* @return 参建单位
|
* @return 建设单位
|
||||||
*/
|
*/
|
||||||
public ProProjectInfoDepts selectProProjectInfoDeptsById(Long id);
|
public ProProjectInfoDepts selectProProjectInfoDeptsById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询参建单位列表
|
* 查询参建单位列表
|
||||||
*
|
*
|
||||||
* @param proProjectInfoDepts 参建单位
|
* @param proProjectInfoDepts 建设单位
|
||||||
* @return 参建单位集合
|
* @return 参建单位集合
|
||||||
*/
|
*/
|
||||||
public List<ProProjectInfoDepts> selectProProjectInfoDeptsList(ProProjectInfoDepts proProjectInfoDepts);
|
public List<ProProjectInfoDepts> selectProProjectInfoDeptsList(ProProjectInfoDepts proProjectInfoDepts);
|
||||||
|
@ -30,7 +30,7 @@ public interface ProProjectInfoDeptsMapper
|
||||||
/**
|
/**
|
||||||
* 新增参建单位
|
* 新增参建单位
|
||||||
*
|
*
|
||||||
* @param proProjectInfoDepts 参建单位
|
* @param proProjectInfoDepts 建设单位
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertProProjectInfoDepts(ProProjectInfoDepts proProjectInfoDepts);
|
public int insertProProjectInfoDepts(ProProjectInfoDepts proProjectInfoDepts);
|
||||||
|
@ -38,7 +38,7 @@ public interface ProProjectInfoDeptsMapper
|
||||||
/**
|
/**
|
||||||
* 修改参建单位
|
* 修改参建单位
|
||||||
*
|
*
|
||||||
* @param proProjectInfoDepts 参建单位
|
* @param proProjectInfoDepts 建设单位
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateProProjectInfoDepts(ProProjectInfoDepts proProjectInfoDepts);
|
public int updateProProjectInfoDepts(ProProjectInfoDepts proProjectInfoDepts);
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.yanzhu.manage.mapper;
|
package com.yanzhu.manage.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.yanzhu.manage.domain.ProDept;
|
||||||
import com.yanzhu.manage.domain.ProProjectInfo;
|
import com.yanzhu.manage.domain.ProProjectInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,4 +60,11 @@ public interface ProProjectInfoMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteProProjectInfoByIds(Long[] ids);
|
public int deleteProProjectInfoByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在单位层级新增项目
|
||||||
|
* @param proDept
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int insertDept(ProDept proDept);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.yanzhu.manage.mapper;
|
package com.yanzhu.manage.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.yanzhu.manage.domain.ProProjectInfoUsers;
|
import com.yanzhu.manage.domain.ProProjectInfoUsers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,4 +60,20 @@ public interface ProProjectInfoUsersMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteProProjectInfoUsersByIds(Long[] ids);
|
public int deleteProProjectInfoUsersByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量取消项目人员的默认项目
|
||||||
|
*
|
||||||
|
* @param userId 用户主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int cancelDefaultSortByUserId(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户编号查询入场项目信息
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> selectProjectsByUserId(Long userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="selectProProjectInfoDeptsList" parameterType="ProProjectInfoDepts" resultMap="ProProjectInfoDeptsResult">
|
<select id="selectProProjectInfoDeptsList" parameterType="ProProjectInfoDepts" resultMap="ProProjectInfoDeptsResult">
|
||||||
<include refid="selectProProjectInfoDeptsVo"/>
|
<include refid="selectProProjectInfoDeptsVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
|
<if test="activeComId != null "> and sd.dept_id = #{activeComId}</if>
|
||||||
<if test="projectId != null "> and pd.project_id = #{projectId}</if>
|
<if test="projectId != null "> and pd.project_id = #{projectId}</if>
|
||||||
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
|
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
|
||||||
<if test="deptType != null and deptType != ''"> and pd.dept_type = #{deptType}</if>
|
<if test="deptType != null and deptType != ''"> and pd.dept_type = #{deptType}</if>
|
||||||
|
|
|
@ -6,9 +6,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<resultMap type="ProProjectInfo" id="ProProjectInfoResult">
|
<resultMap type="ProProjectInfo" id="ProProjectInfoResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="deptId" column="dept_id" />
|
<result property="comId" column="com_id" />
|
||||||
<result property="deptName" column="dept_name" />
|
<result property="comName" column="com_name" />
|
||||||
<result property="visDeptId" column="vis_dept_id" />
|
|
||||||
<result property="disDeptId" column="dis_dept_id" />
|
<result property="disDeptId" column="dis_dept_id" />
|
||||||
<result property="projectName" column="project_name" />
|
<result property="projectName" column="project_name" />
|
||||||
<result property="projectCode" column="project_code" />
|
<result property="projectCode" column="project_code" />
|
||||||
|
@ -48,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<association property="setting" column="ps_id" javaType="ProProjectInfoSetting" resultMap="ProProjectInfoSettingResult" />
|
<association property="setting" column="ps_id" javaType="ProProjectInfoSetting" resultMap="ProProjectInfoSettingResult" />
|
||||||
<collection property="projectDeptsList" javaType="java.util.List" resultMap="ProProjectInfoDeptsResult" />
|
<collection property="projectDeptsList" javaType="java.util.List" resultMap="ProProjectInfoDeptsResult" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="ProProjectInfoDeptsResult" type="ProProjectInfoDepts">
|
<resultMap id="ProProjectInfoDeptsResult" type="ProProjectInfoDepts">
|
||||||
<result property="id" column="pd_id" />
|
<result property="id" column="pd_id" />
|
||||||
<result property="projectId" column="id" />
|
<result property="projectId" column="id" />
|
||||||
|
@ -58,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="leader" column="pd_leader" />
|
<result property="leader" column="pd_leader" />
|
||||||
<result property="phone" column="pd_phone" />
|
<result property="phone" column="pd_phone" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="ProProjectInfoSettingResult" type="ProProjectInfoSetting">
|
<resultMap id="ProProjectInfoSettingResult" type="ProProjectInfoSetting">
|
||||||
<result property="id" column="ps_id" />
|
<result property="id" column="ps_id" />
|
||||||
<result property="projectId" column="id" />
|
<result property="projectId" column="id" />
|
||||||
|
@ -68,19 +69,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="orgVideo" column="ps_org_video" />
|
<result property="orgVideo" column="ps_org_video" />
|
||||||
<result property="orgPlane" column="ps_org_plane" />
|
<result property="orgPlane" column="ps_org_plane" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectProProjectInfoVo">
|
<sql id="selectProProjectInfoVo">
|
||||||
select pi.id, pi.dept_id, sd.dept_name, pi.vis_dept_id, pi.dis_dept_id, pi.project_name, pi.project_code, pi.simple_name, pi.project_type, pi.project_level, pi.project_regional, pi.project_address, pi.project_nature, pi.licence_number, pi.project_person, pi.project_person_phone, pi.longitude, pi.latitude, pi.project_time_limit, pi.total_investment, pi.floor_area, pi.total_output_value, pi.planned_completion_time, pi.scheduled_start_time, pi.actual_operating_time, pi.actual_completion_time, pi.contract_amount, pi.paid_amount, pi.on_account_amount, pi.project_schedule, pi.project_summarize, pi.project_qr_code, pi.project_status, pi.project_sort, pi.is_del, pi.create_by, pi.create_time, pi.update_by, pi.update_time, pi.remark
|
select pi.id, pi.com_id, sd.dept_name as com_name, pi.dis_dept_id, pi.project_name, pi.project_code, pi.simple_name, pi.project_type, pi.project_level, pi.project_regional, pi.project_address, pi.project_nature, pi.licence_number, pi.project_person, pi.project_person_phone, pi.longitude, pi.latitude, pi.project_time_limit, pi.total_investment, pi.floor_area, pi.total_output_value, pi.planned_completion_time, pi.scheduled_start_time, pi.actual_operating_time, pi.actual_completion_time, pi.contract_amount, pi.paid_amount, pi.on_account_amount, pi.project_schedule, pi.project_summarize, pi.project_qr_code, pi.project_status, pi.project_sort, pi.is_del, pi.create_by, pi.create_time, pi.update_by, pi.update_time, pi.remark
|
||||||
from pro_project_info pi
|
from pro_project_info pi
|
||||||
left join sys_dept sd on sd.dept_id = pi.dept_id
|
left join sys_dept sd on sd.dept_id = pi.com_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectProProjectInfoList" parameterType="ProProjectInfo" resultMap="ProProjectInfoResult">
|
<select id="selectProProjectInfoList" parameterType="ProProjectInfo" resultMap="ProProjectInfoResult">
|
||||||
<include refid="selectProProjectInfoVo"/>
|
<include refid="selectProProjectInfoVo"/>
|
||||||
|
<if test="currentUserId != null "> left join pro_project_info_users pu on pu.project_id = pi.id</if>
|
||||||
<where>
|
<where>
|
||||||
<if test="deptId != null "> and pi.dept_id = #{deptId}</if>
|
<if test="comId != null "> and pi.com_id = #{comId}</if>
|
||||||
<if test="visDeptId != null "> and pi.vis_dept_id = #{visDeptId}</if>
|
|
||||||
<if test="disDeptId != null "> and pi.dis_dept_id = #{disDeptId}</if>
|
<if test="disDeptId != null "> and pi.dis_dept_id = #{disDeptId}</if>
|
||||||
<if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
|
<if test="activeComId != null "> and pi.com_id = #{activeComId}</if>
|
||||||
|
<if test="currentUserId != null"> and pu.user_id = #{currentUserId} and pu.use_status='1' and pu.is_del=0</if>
|
||||||
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
|
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
|
||||||
<if test="projectCode != null and projectCode != ''"> and pi.project_code = #{projectCode}</if>
|
<if test="projectCode != null and projectCode != ''"> and pi.project_code = #{projectCode}</if>
|
||||||
<if test="simpleName != null and simpleName != ''"> and pi.simple_name like concat('%', #{simpleName}, '%')</if>
|
<if test="simpleName != null and simpleName != ''"> and pi.simple_name like concat('%', #{simpleName}, '%')</if>
|
||||||
|
@ -91,11 +94,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="projectStatus != null and projectStatus != ''"> and pi.project_status = #{projectStatus}</if>
|
<if test="projectStatus != null and projectStatus != ''"> and pi.project_status = #{projectStatus}</if>
|
||||||
<if test="isDel != null "> and pi.is_del = #{isDel}</if>
|
<if test="isDel != null "> and pi.is_del = #{isDel}</if>
|
||||||
</where>
|
</where>
|
||||||
order by pi.project_sort, pi.id desc
|
<if test="currentUserId == null "> order by pi.project_sort, pi.id desc</if>
|
||||||
|
<if test="currentUserId != null "> order by pu.sort_by, pi.id desc</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectProProjectInfoById" parameterType="Long" resultMap="ProProjectInfoResult">
|
<select id="selectProProjectInfoById" parameterType="Long" resultMap="ProProjectInfoResult">
|
||||||
select pi.id, pi.dept_id, sd.dept_name, pi.vis_dept_id, pi.dis_dept_id, pi.project_name,
|
select pi.id, pi.com_id, sd.dept_name as com_name, pi.dis_dept_id, pi.project_name,
|
||||||
pi.project_code, pi.simple_name, pi.project_type, pi.project_level, pi.project_regional, pi.project_address, pi.project_nature,
|
pi.project_code, pi.simple_name, pi.project_type, pi.project_level, pi.project_regional, pi.project_address, pi.project_nature,
|
||||||
pi.licence_number, pi.project_person, pi.project_person_phone, pi.longitude, pi.latitude, pi.project_time_limit, pi.total_investment,
|
pi.licence_number, pi.project_person, pi.project_person_phone, pi.longitude, pi.latitude, pi.project_time_limit, pi.total_investment,
|
||||||
pi.floor_area, pi.total_output_value, pi.planned_completion_time, pi.scheduled_start_time, pi.actual_operating_time, pi.actual_completion_time,
|
pi.floor_area, pi.total_output_value, pi.planned_completion_time, pi.scheduled_start_time, pi.actual_operating_time, pi.actual_completion_time,
|
||||||
|
@ -104,17 +108,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
pd.id pd_id,pd.dept_type pd_type,pd.dept_name pd_name,pd.dept_code pd_code,pd.leader pd_leader,pd.phone pd_phone,
|
pd.id pd_id,pd.dept_type pd_type,pd.dept_name pd_name,pd.dept_code pd_code,pd.leader pd_leader,pd.phone pd_phone,
|
||||||
ps.id ps_id,ps.org_name ps_org_name,ps.org_logo ps_org_logo,ps.org_image ps_org_image,ps.org_video ps_org_video,ps.org_plane ps_org_plane
|
ps.id ps_id,ps.org_name ps_org_name,ps.org_logo ps_org_logo,ps.org_image ps_org_image,ps.org_video ps_org_video,ps.org_plane ps_org_plane
|
||||||
from pro_project_info pi
|
from pro_project_info pi
|
||||||
left join sys_dept sd on sd.dept_id = pi.dept_id
|
left join sys_dept sd on sd.dept_id = pi.com_id
|
||||||
left join pro_project_info_depts pd on pi.id=pd.project_id
|
left join pro_project_info_depts pd on pi.id=pd.project_id
|
||||||
left join pro_project_info_setting ps on pi.id=ps.project_id
|
left join pro_project_info_setting ps on pi.id=ps.project_id
|
||||||
where pi.id = #{id}
|
where pi.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertProProjectInfo" parameterType="ProProjectInfo" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertProProjectInfo" parameterType="ProProjectInfo">
|
||||||
insert into pro_project_info
|
insert into pro_project_info
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="deptId != null">dept_id,</if>
|
<if test="id != null">id,</if>
|
||||||
<if test="visDeptId != null">vis_dept_id,</if>
|
<if test="comId != null">com_id,</if>
|
||||||
<if test="disDeptId != null">dis_dept_id,</if>
|
<if test="disDeptId != null">dis_dept_id,</if>
|
||||||
<if test="projectName != null">project_name,</if>
|
<if test="projectName != null">project_name,</if>
|
||||||
<if test="projectCode != null">project_code,</if>
|
<if test="projectCode != null">project_code,</if>
|
||||||
|
@ -153,8 +157,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="deptId != null">#{deptId},</if>
|
<if test="id != null">#{id},</if>
|
||||||
<if test="visDeptId != null">#{visDeptId},</if>
|
<if test="comId != null">#{comId},</if>
|
||||||
<if test="disDeptId != null">#{disDeptId},</if>
|
<if test="disDeptId != null">#{disDeptId},</if>
|
||||||
<if test="projectName != null">#{projectName},</if>
|
<if test="projectName != null">#{projectName},</if>
|
||||||
<if test="projectCode != null">#{projectCode},</if>
|
<if test="projectCode != null">#{projectCode},</if>
|
||||||
|
@ -197,8 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<update id="updateProProjectInfo" parameterType="ProProjectInfo">
|
<update id="updateProProjectInfo" parameterType="ProProjectInfo">
|
||||||
update pro_project_info
|
update pro_project_info
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
<if test="comId != null">com_id = #{comId},</if>
|
||||||
<if test="visDeptId != null">vis_dept_id = #{visDeptId},</if>
|
|
||||||
<if test="disDeptId != null">dis_dept_id = #{disDeptId},</if>
|
<if test="disDeptId != null">dis_dept_id = #{disDeptId},</if>
|
||||||
<if test="projectName != null">project_name = #{projectName},</if>
|
<if test="projectName != null">project_name = #{projectName},</if>
|
||||||
<if test="projectCode != null">project_code = #{projectCode},</if>
|
<if test="projectCode != null">project_code = #{projectCode},</if>
|
||||||
|
@ -250,4 +253,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<insert id="insertDept" parameterType="ProDept" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sys_dept(
|
||||||
|
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||||
|
<if test="ancestors != null and ancestors != ''">ancestors,</if>
|
||||||
|
<if test="deptName != null and deptName != ''">dept_name,</if>
|
||||||
|
<if test="deptShortName != null and deptName != ''">dept_short_name,</if>
|
||||||
|
<if test="deptCode != null and deptName != ''">dept_code,</if>
|
||||||
|
<if test="deptType != null and deptName != ''">dept_type,</if>
|
||||||
|
<if test="deptInfos != null and deptName != ''">dept_infos,</if>
|
||||||
|
<if test="orderNum != null">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="createBy != null and createBy != ''">create_by,</if>
|
||||||
|
create_time
|
||||||
|
)values(
|
||||||
|
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
||||||
|
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
|
||||||
|
<if test="deptName != null and deptName != ''">#{deptName},</if>
|
||||||
|
<if test="deptShortName != null and deptShortName != ''">#{deptShortName},</if>
|
||||||
|
<if test="deptCode != null and deptCode != ''">#{deptCode},</if>
|
||||||
|
<if test="deptType != null and deptType != ''">#{deptType},</if>
|
||||||
|
<if test="deptInfos != null and deptInfos != ''">#{deptInfos},</if>
|
||||||
|
<if test="orderNum != null">#{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="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
sysdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="selectProProjectInfoSettingList" parameterType="ProProjectInfoSetting" resultMap="ProProjectInfoSettingResult">
|
<select id="selectProProjectInfoSettingList" parameterType="ProProjectInfoSetting" resultMap="ProProjectInfoSettingResult">
|
||||||
<include refid="selectProProjectInfoSettingVo"/>
|
<include refid="selectProProjectInfoSettingVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
|
<if test="activeComId != null "> and sd.dept_id = #{activeComId}</if>
|
||||||
<if test="projectId != null "> and ps.project_id = #{projectId}</if>
|
<if test="projectId != null "> and ps.project_id = #{projectId}</if>
|
||||||
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
|
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
|
||||||
<if test="orgName != null and orgName != ''"> and ps.org_name like concat('%', #{orgName}, '%')</if>
|
<if test="orgName != null and orgName != ''"> and ps.org_name like concat('%', #{orgName}, '%')</if>
|
||||||
|
|
|
@ -6,14 +6,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<resultMap type="ProProjectInfoUsers" id="ProProjectInfoUsersResult">
|
<resultMap type="ProProjectInfoUsers" id="ProProjectInfoUsersResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="deptId" column="dept_id" />
|
<result property="comId" column="com_id" />
|
||||||
<result property="deptName" column="dept_name" />
|
<result property="comName" column="com_name" />
|
||||||
<result property="projectId" column="project_id" />
|
<result property="projectId" column="project_id" />
|
||||||
<result property="userId" column="user_id" />
|
<result property="userId" column="user_id" />
|
||||||
<result property="userName" column="user_name" />
|
<result property="userName" column="user_name" />
|
||||||
<result property="userCode" column="user_code" />
|
<result property="userCode" column="user_code" />
|
||||||
<result property="userPhone" column="user_phone" />
|
<result property="userPhone" column="user_phone" />
|
||||||
<result property="useStatus" column="use_status" />
|
<result property="useStatus" column="use_status" />
|
||||||
|
<result property="sortBy" column="sort_by" />
|
||||||
<result property="isDel" column="is_del" />
|
<result property="isDel" column="is_del" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
|
@ -23,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectProProjectInfoUsersVo">
|
<sql id="selectProProjectInfoUsersVo">
|
||||||
select pu.id, pu.dept_id, sd.dept_name, pu.project_id, pi.project_name, pu.user_id, pu.user_name, pu.user_code, pu.user_phone, pu.use_status, pu.is_del, pu.create_by, pu.create_time, pu.update_by, pu.update_time, pu.remark from pro_project_info_users pu
|
select pu.id, pu.com_id, sd.dept_name as com_name, pu.project_id, pi.project_name, pu.user_id, pu.user_name, pu.user_code, pu.user_phone, pu.use_status, pu.sort_by, pu.is_del, pu.create_by, pu.create_time, pu.update_by, pu.update_time, pu.remark from pro_project_info_users pu
|
||||||
left join pro_project_info pi on pi.id = pu.project_id
|
left join pro_project_info pi on pi.id = pu.project_id
|
||||||
left join sys_dept sd on sd.dept_id = pi.dept_id
|
left join sys_dept sd on sd.dept_id = pi.dept_id
|
||||||
</sql>
|
</sql>
|
||||||
|
@ -31,8 +32,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="selectProProjectInfoUsersList" parameterType="ProProjectInfoUsers" resultMap="ProProjectInfoUsersResult">
|
<select id="selectProProjectInfoUsersList" parameterType="ProProjectInfoUsers" resultMap="ProProjectInfoUsersResult">
|
||||||
<include refid="selectProProjectInfoUsersVo"/>
|
<include refid="selectProProjectInfoUsersVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="activeDeptId != null "> and sd.dept_id = #{activeDeptId}</if>
|
<if test="activeComId != null "> and sd.dept_id = #{activeComId}</if>
|
||||||
<if test="deptId != null "> and pu.dept_id = #{deptId}</if>
|
<if test="comId != null "> and pu.com_id = #{comId}</if>
|
||||||
<if test="projectId != null "> and pu.project_id = #{projectId}</if>
|
<if test="projectId != null "> and pu.project_id = #{projectId}</if>
|
||||||
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
|
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
|
||||||
<if test="userId != null "> and pu.user_id = #{userId}</if>
|
<if test="userId != null "> and pu.user_id = #{userId}</if>
|
||||||
|
@ -53,13 +54,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<insert id="insertProProjectInfoUsers" parameterType="ProProjectInfoUsers" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertProProjectInfoUsers" parameterType="ProProjectInfoUsers" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into pro_project_info_users
|
insert into pro_project_info_users
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="deptId != null">dept_id,</if>
|
<if test="comId != null">com_id,</if>
|
||||||
<if test="projectId != null">project_id,</if>
|
<if test="projectId != null">project_id,</if>
|
||||||
<if test="userId != null">user_id,</if>
|
<if test="userId != null">user_id,</if>
|
||||||
<if test="userName != null">user_name,</if>
|
<if test="userName != null">user_name,</if>
|
||||||
<if test="userCode != null">user_code,</if>
|
<if test="userCode != null">user_code,</if>
|
||||||
<if test="userPhone != null">user_phone,</if>
|
<if test="userPhone != null">user_phone,</if>
|
||||||
<if test="useStatus != null">use_status,</if>
|
<if test="useStatus != null">use_status,</if>
|
||||||
|
<if test="sortBy != null">sort_by,</if>
|
||||||
<if test="isDel != null">is_del,</if>
|
<if test="isDel != null">is_del,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
|
@ -68,13 +70,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="deptId != null">#{deptId},</if>
|
<if test="comId != null">#{comId},</if>
|
||||||
<if test="projectId != null">#{projectId},</if>
|
<if test="projectId != null">#{projectId},</if>
|
||||||
<if test="userId != null">#{userId},</if>
|
<if test="userId != null">#{userId},</if>
|
||||||
<if test="userName != null">#{userName},</if>
|
<if test="userName != null">#{userName},</if>
|
||||||
<if test="userCode != null">#{userCode},</if>
|
<if test="userCode != null">#{userCode},</if>
|
||||||
<if test="userPhone != null">#{userPhone},</if>
|
<if test="userPhone != null">#{userPhone},</if>
|
||||||
<if test="useStatus != null">#{useStatus},</if>
|
<if test="useStatus != null">#{useStatus},</if>
|
||||||
|
<if test="sortBy != null">#{sortBy},</if>
|
||||||
<if test="isDel != null">#{isDel},</if>
|
<if test="isDel != null">#{isDel},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
@ -87,13 +90,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<update id="updateProProjectInfoUsers" parameterType="ProProjectInfoUsers">
|
<update id="updateProProjectInfoUsers" parameterType="ProProjectInfoUsers">
|
||||||
update pro_project_info_users
|
update pro_project_info_users
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
<if test="comId != null">com_id = #{comId},</if>
|
||||||
<if test="projectId != null">project_id = #{projectId},</if>
|
<if test="projectId != null">project_id = #{projectId},</if>
|
||||||
<if test="userId != null">user_id = #{userId},</if>
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
<if test="userName != null">user_name = #{userName},</if>
|
<if test="userName != null">user_name = #{userName},</if>
|
||||||
<if test="userCode != null">user_code = #{userCode},</if>
|
<if test="userCode != null">user_code = #{userCode},</if>
|
||||||
<if test="userPhone != null">user_phone = #{userPhone},</if>
|
<if test="userPhone != null">user_phone = #{userPhone},</if>
|
||||||
<if test="useStatus != null">use_status = #{useStatus},</if>
|
<if test="useStatus != null">use_status = #{useStatus},</if>
|
||||||
|
<if test="sortBy != null">sort_by = #{sortBy},</if>
|
||||||
<if test="isDel != null">is_del = #{isDel},</if>
|
<if test="isDel != null">is_del = #{isDel},</if>
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
@ -104,14 +108,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteProProjectInfoUsersById" parameterType="Long">
|
<update id="deleteProProjectInfoUsersById" parameterType="Long">
|
||||||
delete from pro_project_info_users where id = #{id}
|
update pro_project_info_users set is_del=1 where id = #{id}
|
||||||
</delete>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteProProjectInfoUsersByIds" parameterType="String">
|
<update id="deleteProProjectInfoUsersByIds" parameterType="String">
|
||||||
delete from pro_project_info_users where id in
|
update pro_project_info_users set is_del=1 where id in
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</update>
|
||||||
|
|
||||||
|
<update id="cancelDefaultSortByUserId" parameterType="Long">
|
||||||
|
update pro_project_info_users set sort_by=100 where user_id = #{userId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--根据用户编号查询入场项目信息-->
|
||||||
|
<select id="selectProjectsByUserId" parameterType="Long" resultType="Map">
|
||||||
|
select pu.project_id as projectId, pi.project_name as projectName, pi.com_id as comId from pro_project_info_users pu
|
||||||
|
left join pro_project_info pi on pi.id = pu.project_id
|
||||||
|
where pu.user_id=#{userId} and pu.is_del=0 and pu.use_status=1 order by pu.sort_by asc
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -10,6 +10,8 @@ import com.yanzhu.common.core.utils.ServletUtils;
|
||||||
import com.yanzhu.common.core.utils.StringUtils;
|
import com.yanzhu.common.core.utils.StringUtils;
|
||||||
import com.yanzhu.system.api.model.LoginUser;
|
import com.yanzhu.system.api.model.LoginUser;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限获取工具类
|
* 权限获取工具类
|
||||||
*
|
*
|
||||||
|
@ -101,6 +103,16 @@ public class SecurityUtils
|
||||||
return getLoginUser().getRoles().contains("gsAdmin");
|
return getLoginUser().getRoles().contains("gsAdmin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为公司管理员
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static boolean isGSAdmin(Set<String> roles)
|
||||||
|
{
|
||||||
|
return roles.contains("gsAdmin");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成BCryptPasswordEncoder密码
|
* 生成BCryptPasswordEncoder密码
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
package com.yanzhu.manage.controller;
|
package com.yanzhu.manage.controller;
|
||||||
|
|
||||||
|
import com.yanzhu.common.core.domain.R;
|
||||||
|
import com.yanzhu.common.core.utils.bean.BeanUtils;
|
||||||
import com.yanzhu.common.core.utils.poi.ExcelUtil;
|
import com.yanzhu.common.core.utils.poi.ExcelUtil;
|
||||||
import com.yanzhu.common.core.web.controller.BaseController;
|
import com.yanzhu.common.core.web.controller.BaseController;
|
||||||
import com.yanzhu.common.core.web.domain.AjaxResult;
|
import com.yanzhu.common.core.web.domain.AjaxResult;
|
||||||
import com.yanzhu.common.core.web.page.TableDataInfo;
|
import com.yanzhu.common.core.web.page.TableDataInfo;
|
||||||
import com.yanzhu.common.log.annotation.Log;
|
import com.yanzhu.common.log.annotation.Log;
|
||||||
import com.yanzhu.common.log.enums.BusinessType;
|
import com.yanzhu.common.log.enums.BusinessType;
|
||||||
|
import com.yanzhu.common.security.annotation.InnerAuth;
|
||||||
import com.yanzhu.common.security.annotation.RequiresPermissions;
|
import com.yanzhu.common.security.annotation.RequiresPermissions;
|
||||||
import com.yanzhu.manage.domain.ProProjectInfo;
|
import com.yanzhu.manage.domain.ProProjectInfo;
|
||||||
import com.yanzhu.manage.service.IProProjectInfoService;
|
import com.yanzhu.manage.service.IProProjectInfoService;
|
||||||
|
@ -14,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目信息Controller
|
* 项目信息Controller
|
||||||
|
@ -63,6 +67,22 @@ public class ProProjectInfoController extends BaseController
|
||||||
return success(proProjectInfoService.selectProProjectInfoById(id));
|
return success(proProjectInfoService.selectProProjectInfoById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取项目信息详细信息
|
||||||
|
*/
|
||||||
|
@InnerAuth
|
||||||
|
@GetMapping("/info/{id}")
|
||||||
|
public R<Map<String, Object>> info(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
ProProjectInfo info = proProjectInfoService.selectProProjectInfoById(id);
|
||||||
|
try {
|
||||||
|
Map<String, Object> data = BeanUtils.beanToMap(info);
|
||||||
|
return R.ok(data);
|
||||||
|
}catch (Exception e){
|
||||||
|
return R.fail("项目信息异常!!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增项目信息
|
* 新增项目信息
|
||||||
*/
|
*/
|
||||||
|
@ -95,4 +115,15 @@ public class ProProjectInfoController extends BaseController
|
||||||
{
|
{
|
||||||
return toAjax(proProjectInfoService.deleteProProjectInfoByIds(ids));
|
return toAjax(proProjectInfoService.deleteProProjectInfoByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取我的项目列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/findMyProjectList")
|
||||||
|
public TableDataInfo findMyProjectList(ProProjectInfo proProjectInfo)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<ProProjectInfo> list = proProjectInfoService.selectProProjectInfoList(proProjectInfo);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class ProProjectInfoDeptsController extends BaseController
|
||||||
* 导出参建单位列表
|
* 导出参建单位列表
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("manage:proProjectInfoDepts:export")
|
@RequiresPermissions("manage:proProjectInfoDepts:export")
|
||||||
@Log(title = "参建单位", businessType = BusinessType.EXPORT)
|
@Log(title = "建设单位", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, ProProjectInfoDepts proProjectInfoDepts)
|
public void export(HttpServletResponse response, ProProjectInfoDepts proProjectInfoDepts)
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ public class ProProjectInfoDeptsController extends BaseController
|
||||||
* 新增参建单位
|
* 新增参建单位
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("manage:proProjectInfoDepts:add")
|
@RequiresPermissions("manage:proProjectInfoDepts:add")
|
||||||
@Log(title = "参建单位", businessType = BusinessType.INSERT)
|
@Log(title = "建设单位", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody ProProjectInfoDepts proProjectInfoDepts)
|
public AjaxResult add(@RequestBody ProProjectInfoDepts proProjectInfoDepts)
|
||||||
{
|
{
|
||||||
|
@ -78,7 +78,7 @@ public class ProProjectInfoDeptsController extends BaseController
|
||||||
* 修改参建单位
|
* 修改参建单位
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("manage:proProjectInfoDepts:edit")
|
@RequiresPermissions("manage:proProjectInfoDepts:edit")
|
||||||
@Log(title = "参建单位", businessType = BusinessType.UPDATE)
|
@Log(title = "建设单位", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody ProProjectInfoDepts proProjectInfoDepts)
|
public AjaxResult edit(@RequestBody ProProjectInfoDepts proProjectInfoDepts)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,7 @@ public class ProProjectInfoDeptsController extends BaseController
|
||||||
* 删除参建单位
|
* 删除参建单位
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("manage:proProjectInfoDepts:remove")
|
@RequiresPermissions("manage:proProjectInfoDepts:remove")
|
||||||
@Log(title = "参建单位", businessType = BusinessType.DELETE)
|
@Log(title = "建设单位", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package com.yanzhu.manage.controller;
|
package com.yanzhu.manage.controller;
|
||||||
|
|
||||||
|
import com.yanzhu.common.core.domain.R;
|
||||||
import com.yanzhu.common.core.utils.poi.ExcelUtil;
|
import com.yanzhu.common.core.utils.poi.ExcelUtil;
|
||||||
import com.yanzhu.common.core.web.controller.BaseController;
|
import com.yanzhu.common.core.web.controller.BaseController;
|
||||||
import com.yanzhu.common.core.web.domain.AjaxResult;
|
import com.yanzhu.common.core.web.domain.AjaxResult;
|
||||||
import com.yanzhu.common.core.web.page.TableDataInfo;
|
import com.yanzhu.common.core.web.page.TableDataInfo;
|
||||||
import com.yanzhu.common.log.annotation.Log;
|
import com.yanzhu.common.log.annotation.Log;
|
||||||
import com.yanzhu.common.log.enums.BusinessType;
|
import com.yanzhu.common.log.enums.BusinessType;
|
||||||
|
import com.yanzhu.common.security.annotation.InnerAuth;
|
||||||
import com.yanzhu.common.security.annotation.RequiresPermissions;
|
import com.yanzhu.common.security.annotation.RequiresPermissions;
|
||||||
import com.yanzhu.manage.domain.ProProjectInfoUsers;
|
import com.yanzhu.manage.domain.ProProjectInfoUsers;
|
||||||
import com.yanzhu.manage.service.IProProjectInfoUsersService;
|
import com.yanzhu.manage.service.IProProjectInfoUsersService;
|
||||||
|
@ -14,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目人员Controller
|
* 项目人员Controller
|
||||||
|
@ -95,4 +98,24 @@ public class ProProjectInfoUsersController extends BaseController
|
||||||
{
|
{
|
||||||
return toAjax(proProjectInfoUsersService.deleteProProjectInfoUsersByIds(ids));
|
return toAjax(proProjectInfoUsersService.deleteProProjectInfoUsersByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改为默认项目
|
||||||
|
*/
|
||||||
|
@GetMapping("/changeDefaultProject/{id}")
|
||||||
|
public AjaxResult changeDefaultProject(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return toAjax(proProjectInfoUsersService.editDefaultProjectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户入场项目信息
|
||||||
|
*/
|
||||||
|
@InnerAuth
|
||||||
|
@GetMapping("/projects/{userId}")
|
||||||
|
public R<List<Map<String, Object>>> getProjects(@PathVariable("userId") Long userId)
|
||||||
|
{
|
||||||
|
List<Map<String, Object>> list = proProjectInfoUsersService.selectProjectsByUserId(userId);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,14 +15,14 @@ public interface IProProjectInfoDeptsService
|
||||||
* 查询参建单位
|
* 查询参建单位
|
||||||
*
|
*
|
||||||
* @param id 参建单位主键
|
* @param id 参建单位主键
|
||||||
* @return 参建单位
|
* @return 建设单位
|
||||||
*/
|
*/
|
||||||
public ProProjectInfoDepts selectProProjectInfoDeptsById(Long id);
|
public ProProjectInfoDepts selectProProjectInfoDeptsById(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询参建单位列表
|
* 查询参建单位列表
|
||||||
*
|
*
|
||||||
* @param proProjectInfoDepts 参建单位
|
* @param proProjectInfoDepts 建设单位
|
||||||
* @return 参建单位集合
|
* @return 参建单位集合
|
||||||
*/
|
*/
|
||||||
public List<ProProjectInfoDepts> selectProProjectInfoDeptsList(ProProjectInfoDepts proProjectInfoDepts);
|
public List<ProProjectInfoDepts> selectProProjectInfoDeptsList(ProProjectInfoDepts proProjectInfoDepts);
|
||||||
|
@ -30,7 +30,7 @@ public interface IProProjectInfoDeptsService
|
||||||
/**
|
/**
|
||||||
* 新增参建单位
|
* 新增参建单位
|
||||||
*
|
*
|
||||||
* @param proProjectInfoDepts 参建单位
|
* @param proProjectInfoDepts 建设单位
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertProProjectInfoDepts(ProProjectInfoDepts proProjectInfoDepts);
|
public int insertProProjectInfoDepts(ProProjectInfoDepts proProjectInfoDepts);
|
||||||
|
@ -38,7 +38,7 @@ public interface IProProjectInfoDeptsService
|
||||||
/**
|
/**
|
||||||
* 修改参建单位
|
* 修改参建单位
|
||||||
*
|
*
|
||||||
* @param proProjectInfoDepts 参建单位
|
* @param proProjectInfoDepts 建设单位
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateProProjectInfoDepts(ProProjectInfoDepts proProjectInfoDepts);
|
public int updateProProjectInfoDepts(ProProjectInfoDepts proProjectInfoDepts);
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.yanzhu.manage.service;
|
package com.yanzhu.manage.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.yanzhu.manage.domain.ProProjectInfoUsers;
|
import com.yanzhu.manage.domain.ProProjectInfoUsers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,4 +60,20 @@ public interface IProProjectInfoUsersService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteProProjectInfoUsersById(Long id);
|
public int deleteProProjectInfoUsersById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改项目人员的默认项目
|
||||||
|
*
|
||||||
|
* @param id 项目人员主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int editDefaultProjectById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户编号查询入场项目信息
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> selectProjectsByUserId(Long userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class ProProjectInfoDeptsServiceImpl implements IProProjectInfoDeptsServi
|
||||||
* 查询参建单位
|
* 查询参建单位
|
||||||
*
|
*
|
||||||
* @param id 参建单位主键
|
* @param id 参建单位主键
|
||||||
* @return 参建单位
|
* @return 建设单位
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ProProjectInfoDepts selectProProjectInfoDeptsById(Long id)
|
public ProProjectInfoDepts selectProProjectInfoDeptsById(Long id)
|
||||||
|
@ -36,8 +36,8 @@ public class ProProjectInfoDeptsServiceImpl implements IProProjectInfoDeptsServi
|
||||||
/**
|
/**
|
||||||
* 查询参建单位列表
|
* 查询参建单位列表
|
||||||
*
|
*
|
||||||
* @param proProjectInfoDepts 参建单位
|
* @param proProjectInfoDepts 建设单位
|
||||||
* @return 参建单位
|
* @return 建设单位
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ProProjectInfoDepts> selectProProjectInfoDeptsList(ProProjectInfoDepts proProjectInfoDepts)
|
public List<ProProjectInfoDepts> selectProProjectInfoDeptsList(ProProjectInfoDepts proProjectInfoDepts)
|
||||||
|
@ -48,7 +48,7 @@ public class ProProjectInfoDeptsServiceImpl implements IProProjectInfoDeptsServi
|
||||||
/**
|
/**
|
||||||
* 新增参建单位
|
* 新增参建单位
|
||||||
*
|
*
|
||||||
* @param proProjectInfoDepts 参建单位
|
* @param proProjectInfoDepts 建设单位
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -61,7 +61,7 @@ public class ProProjectInfoDeptsServiceImpl implements IProProjectInfoDeptsServi
|
||||||
/**
|
/**
|
||||||
* 修改参建单位
|
* 修改参建单位
|
||||||
*
|
*
|
||||||
* @param proProjectInfoDepts 参建单位
|
* @param proProjectInfoDepts 建设单位
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,11 +1,21 @@
|
||||||
package com.yanzhu.manage.service.impl;
|
package com.yanzhu.manage.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.yanzhu.common.core.constant.SecurityConstants;
|
||||||
|
import com.yanzhu.common.core.domain.R;
|
||||||
|
import com.yanzhu.common.core.exception.ServiceException;
|
||||||
import com.yanzhu.common.core.utils.DateUtils;
|
import com.yanzhu.common.core.utils.DateUtils;
|
||||||
|
import com.yanzhu.common.security.utils.SecurityUtils;
|
||||||
|
import com.yanzhu.manage.domain.ProDept;
|
||||||
import com.yanzhu.manage.domain.ProProjectInfoDepts;
|
import com.yanzhu.manage.domain.ProProjectInfoDepts;
|
||||||
import com.yanzhu.manage.domain.ProProjectInfoSetting;
|
import com.yanzhu.manage.domain.ProProjectInfoSetting;
|
||||||
import com.yanzhu.manage.mapper.ProProjectInfoDeptsMapper;
|
import com.yanzhu.manage.mapper.ProProjectInfoDeptsMapper;
|
||||||
import com.yanzhu.manage.mapper.ProProjectInfoSettingMapper;
|
import com.yanzhu.manage.mapper.ProProjectInfoSettingMapper;
|
||||||
|
import com.yanzhu.system.api.RemoteDeptService;
|
||||||
|
import com.yanzhu.system.api.RemoteUserService;
|
||||||
|
import com.yanzhu.system.api.domain.SysDept;
|
||||||
|
import com.yanzhu.system.api.domain.SysUser;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.yanzhu.manage.mapper.ProProjectInfoMapper;
|
import com.yanzhu.manage.mapper.ProProjectInfoMapper;
|
||||||
|
@ -21,12 +31,18 @@ import com.yanzhu.manage.service.IProProjectInfoService;
|
||||||
@Service
|
@Service
|
||||||
public class ProProjectInfoServiceImpl implements IProProjectInfoService
|
public class ProProjectInfoServiceImpl implements IProProjectInfoService
|
||||||
{
|
{
|
||||||
@Autowired
|
|
||||||
private ProProjectInfoMapper proProjectInfoMapper;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProProjectInfoDeptsMapper deptsMapper;
|
private ProProjectInfoDeptsMapper deptsMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProProjectInfoSettingMapper settingMapper;
|
private ProProjectInfoSettingMapper settingMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProProjectInfoMapper proProjectInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RemoteDeptService remoteDeptService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询项目信息
|
* 查询项目信息
|
||||||
*
|
*
|
||||||
|
@ -48,6 +64,13 @@ public class ProProjectInfoServiceImpl implements IProProjectInfoService
|
||||||
@Override
|
@Override
|
||||||
public List<ProProjectInfo> selectProProjectInfoList(ProProjectInfo proProjectInfo)
|
public List<ProProjectInfo> selectProProjectInfoList(ProProjectInfo proProjectInfo)
|
||||||
{
|
{
|
||||||
|
SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
|
||||||
|
if(!SecurityUtils.isAdmin(sysUser.getUserId())){
|
||||||
|
proProjectInfo.setActiveComId(sysUser.getComId());
|
||||||
|
if(!SecurityUtils.isGSAdmin()){
|
||||||
|
proProjectInfo.setCurrentUserId(sysUser.getUserId());
|
||||||
|
}
|
||||||
|
}
|
||||||
return proProjectInfoMapper.selectProProjectInfoList(proProjectInfo);
|
return proProjectInfoMapper.selectProProjectInfoList(proProjectInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,8 +83,27 @@ public class ProProjectInfoServiceImpl implements IProProjectInfoService
|
||||||
@Override
|
@Override
|
||||||
public int insertProProjectInfo(ProProjectInfo proProjectInfo)
|
public int insertProProjectInfo(ProProjectInfo proProjectInfo)
|
||||||
{
|
{
|
||||||
|
R<SysDept> deptResult = remoteDeptService.getDeptInfo(proProjectInfo.getDisDeptId(), SecurityConstants.INNER);
|
||||||
|
SysDept sysDept = deptResult.getData();
|
||||||
|
ProDept proDept = new ProDept();
|
||||||
|
proDept.setParentId(proProjectInfo.getDisDeptId());
|
||||||
|
proDept.setAncestors(sysDept.getAncestors()+","+proProjectInfo.getDisDeptId());
|
||||||
|
proDept.setDeptName(proProjectInfo.getProjectName());
|
||||||
|
proDept.setDeptShortName(proProjectInfo.getSimpleName());
|
||||||
|
proDept.setDeptType("4");
|
||||||
|
proDept.setOrderNum(100);
|
||||||
|
proDept.setLeader(proProjectInfo.getProjectPerson());
|
||||||
|
proDept.setPhone(proProjectInfo.getProjectPersonPhone());
|
||||||
|
proDept.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
int res = proProjectInfoMapper.insertDept(proDept);
|
||||||
|
if(res>0){
|
||||||
|
proProjectInfo.setId(proDept.getDeptId());
|
||||||
|
proProjectInfo.setComId(sysDept.getComId());
|
||||||
proProjectInfo.setCreateTime(DateUtils.getNowDate());
|
proProjectInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
return proProjectInfoMapper.insertProProjectInfo(proProjectInfo);
|
return proProjectInfoMapper.insertProProjectInfo(proProjectInfo);
|
||||||
|
}else{
|
||||||
|
throw new ServiceException("项目信息保存失败!!!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,7 +116,7 @@ public class ProProjectInfoServiceImpl implements IProProjectInfoService
|
||||||
public int updateProProjectInfo(ProProjectInfo proProjectInfo)
|
public int updateProProjectInfo(ProProjectInfo proProjectInfo)
|
||||||
{
|
{
|
||||||
proProjectInfo.setUpdateTime(DateUtils.getNowDate());
|
proProjectInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
List<ProProjectInfoDepts> depts= proProjectInfo.getProjectDeptsList();
|
List<ProProjectInfoDepts> depts = proProjectInfo.getProjectDeptsList();
|
||||||
if(depts!=null){
|
if(depts!=null){
|
||||||
depts.forEach(dept->{
|
depts.forEach(dept->{
|
||||||
dept.setProjectId(proProjectInfo.getId());
|
dept.setProjectId(proProjectInfo.getId());
|
||||||
|
@ -85,7 +127,7 @@ public class ProProjectInfoServiceImpl implements IProProjectInfoService
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
ProProjectInfoSetting setting= proProjectInfo.getSetting();
|
ProProjectInfoSetting setting = proProjectInfo.getSetting();
|
||||||
if(setting!=null){
|
if(setting!=null){
|
||||||
setting.setProjectId(proProjectInfo.getId());
|
setting.setProjectId(proProjectInfo.getId());
|
||||||
if(setting.getId()!=null){
|
if(setting.getId()!=null){
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
package com.yanzhu.manage.service.impl;
|
package com.yanzhu.manage.service.impl;
|
||||||
|
|
||||||
import com.yanzhu.common.core.utils.DateUtils;
|
import com.yanzhu.common.core.utils.DateUtils;
|
||||||
|
import com.yanzhu.common.security.utils.SecurityUtils;
|
||||||
import com.yanzhu.manage.domain.ProProjectInfoUsers;
|
import com.yanzhu.manage.domain.ProProjectInfoUsers;
|
||||||
import com.yanzhu.manage.mapper.ProProjectInfoUsersMapper;
|
import com.yanzhu.manage.mapper.ProProjectInfoUsersMapper;
|
||||||
import com.yanzhu.manage.service.IProProjectInfoUsersService;
|
import com.yanzhu.manage.service.IProProjectInfoUsersService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目人员Service业务层处理
|
* 项目人员Service业务层处理
|
||||||
|
@ -94,4 +97,34 @@ public class ProProjectInfoUsersServiceImpl implements IProProjectInfoUsersServi
|
||||||
{
|
{
|
||||||
return proProjectInfoUsersMapper.deleteProProjectInfoUsersById(id);
|
return proProjectInfoUsersMapper.deleteProProjectInfoUsersById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改项目人员的默认项目
|
||||||
|
*
|
||||||
|
* @param id 项目人员主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public int editDefaultProjectById(Long id){
|
||||||
|
int res = proProjectInfoUsersMapper.cancelDefaultSortByUserId(SecurityUtils.getUserId());
|
||||||
|
if(res>0){
|
||||||
|
ProProjectInfoUsers entity = new ProProjectInfoUsers();
|
||||||
|
entity.setId(id);
|
||||||
|
entity.setSortBy(0L);
|
||||||
|
proProjectInfoUsersMapper.updateProProjectInfoUsers(entity);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户编号查询入场项目信息
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> selectProjectsByUserId(Long userId){
|
||||||
|
return proProjectInfoUsersMapper.selectProjectsByUserId(userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +1,29 @@
|
||||||
package com.yanzhu.system.controller;
|
package com.yanzhu.system.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import com.yanzhu.common.core.constant.CacheConstants;
|
|
||||||
import com.yanzhu.common.core.constant.Constants;
|
import com.yanzhu.common.core.constant.Constants;
|
||||||
import com.yanzhu.common.core.enums.IsDelEnums;
|
|
||||||
import com.yanzhu.common.redis.service.RedisService;
|
|
||||||
import com.yanzhu.system.domain.vo.TreeSelect;
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.yanzhu.common.core.constant.UserConstants;
|
import com.yanzhu.common.core.constant.UserConstants;
|
||||||
|
import com.yanzhu.common.core.domain.R;
|
||||||
|
import com.yanzhu.common.core.enums.IsDelEnums;
|
||||||
import com.yanzhu.common.core.utils.StringUtils;
|
import com.yanzhu.common.core.utils.StringUtils;
|
||||||
import com.yanzhu.common.core.web.controller.BaseController;
|
import com.yanzhu.common.core.web.controller.BaseController;
|
||||||
import com.yanzhu.common.core.web.domain.AjaxResult;
|
import com.yanzhu.common.core.web.domain.AjaxResult;
|
||||||
import com.yanzhu.common.log.annotation.Log;
|
import com.yanzhu.common.log.annotation.Log;
|
||||||
import com.yanzhu.common.log.enums.BusinessType;
|
import com.yanzhu.common.log.enums.BusinessType;
|
||||||
|
import com.yanzhu.common.redis.service.RedisService;
|
||||||
|
import com.yanzhu.common.security.annotation.InnerAuth;
|
||||||
import com.yanzhu.common.security.annotation.RequiresPermissions;
|
import com.yanzhu.common.security.annotation.RequiresPermissions;
|
||||||
import com.yanzhu.common.security.utils.SecurityUtils;
|
import com.yanzhu.common.security.utils.SecurityUtils;
|
||||||
import com.yanzhu.system.api.domain.SysDept;
|
import com.yanzhu.system.api.domain.SysDept;
|
||||||
|
import com.yanzhu.system.domain.vo.TreeSelect;
|
||||||
import com.yanzhu.system.service.ISysDeptService;
|
import com.yanzhu.system.service.ISysDeptService;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门信息
|
* 部门信息
|
||||||
|
@ -80,6 +74,17 @@ public class SysDeptController extends BaseController
|
||||||
return success(deptService.selectDeptById(deptId));
|
return success(deptService.selectDeptById(deptId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门编号获取详细信息
|
||||||
|
*/
|
||||||
|
@InnerAuth
|
||||||
|
@GetMapping("/info/{deptId}")
|
||||||
|
public R<SysDept> getSysDeptInfo(@PathVariable("deptId") Long deptId)
|
||||||
|
{
|
||||||
|
SysDept sysDept = deptService.selectDeptById(deptId);
|
||||||
|
return R.ok(sysDept);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增部门
|
* 新增部门
|
||||||
*/
|
*/
|
||||||
|
@ -161,6 +166,7 @@ public class SysDeptController extends BaseController
|
||||||
redisService.setCacheObject(key,depts, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
redisService.setCacheObject(key,depts, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||||
return success(depts);
|
return success(depts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("system:dept:list")
|
@RequiresPermissions("system:dept:list")
|
||||||
@GetMapping("/deptTree")
|
@GetMapping("/deptTree")
|
||||||
public AjaxResult userDeptTree(){
|
public AjaxResult userDeptTree(){
|
||||||
|
|
|
@ -278,7 +278,7 @@ public class SysRoleController extends BaseController
|
||||||
@GetMapping("/deptRole/{roleId}")
|
@GetMapping("/deptRole/{roleId}")
|
||||||
public AjaxResult list(@PathVariable("roleId") Long deptId)
|
public AjaxResult list(@PathVariable("roleId") Long deptId)
|
||||||
{
|
{
|
||||||
List<SysRole> list = roleService.findDeptRoleList(deptId);
|
List<SysRole> list = roleService.findDeptRoleListByDeptId(deptId);
|
||||||
return success(list);
|
return success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.util.stream.Collectors;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.yanzhu.common.core.constant.Constants;
|
import com.yanzhu.common.core.constant.Constants;
|
||||||
|
import com.yanzhu.common.core.text.Convert;
|
||||||
import com.yanzhu.common.redis.service.RedisService;
|
import com.yanzhu.common.redis.service.RedisService;
|
||||||
import com.yanzhu.system.domain.vo.TreeSelect;
|
import com.yanzhu.system.domain.vo.TreeSelect;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
@ -129,6 +130,57 @@ public class SysUserController extends BaseController
|
||||||
{
|
{
|
||||||
return R.fail("用户名或密码错误");
|
return R.fail("用户名或密码错误");
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isEmpty(sysUser.getRoles()))
|
||||||
|
{
|
||||||
|
return R.fail("用户未查询到分配角色,请联系管理员!!!");
|
||||||
|
}
|
||||||
|
// 重写登录方法
|
||||||
|
if(!sysUser.isAdmin() && sysUser.getRoles().size()>1){
|
||||||
|
List<SysRole> gsAdmins = sysUser.getRoles().stream().filter(role -> role.getRoleId()==2L).collect(Collectors.toList());
|
||||||
|
if(StringUtils.isNotEmpty(gsAdmins)){
|
||||||
|
// 默认以公司管理员登录
|
||||||
|
sysUser = userService.selectUserByUserName(username,sysUser.getComId());
|
||||||
|
sysUser.setActiveComId(sysUser.getComId());
|
||||||
|
}else{
|
||||||
|
// 查询用户绑定项目列表
|
||||||
|
List<Map<String, Object>> list = userService.selectProjectsByUserId(sysUser.getUserId());
|
||||||
|
if (StringUtils.isEmpty(list))
|
||||||
|
{
|
||||||
|
return R.fail("用户角色配置异常,请联系管理员!!!");
|
||||||
|
}
|
||||||
|
// 以项目人员身份登录
|
||||||
|
sysUser = userService.selectUserByUserName(username, Convert.toLong(list.get(0).get("project_id")));
|
||||||
|
sysUser.setActiveComId(sysUser.getComId());
|
||||||
|
sysUser.setActiveProjectId(Convert.toLong(list.get(0).get("project_id")));
|
||||||
|
sysUser.setActiveProjectName(Convert.toStr(list.get(0).get("project_name")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 角色集合
|
||||||
|
Set<String> roles = permissionService.getRolePermission(sysUser);
|
||||||
|
// 权限集合
|
||||||
|
Set<String> permissions = permissionService.getMenuPermission(sysUser);
|
||||||
|
LoginUser sysUserVo = new LoginUser();
|
||||||
|
sysUserVo.setSysUser(sysUser);
|
||||||
|
sysUserVo.setRoles(roles);
|
||||||
|
sysUserVo.setPermissions(permissions);
|
||||||
|
return R.ok(sysUserVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户信息
|
||||||
|
*/
|
||||||
|
@InnerAuth
|
||||||
|
@GetMapping("/infoAndDept/{username}/{deptId}")
|
||||||
|
public R<LoginUser> infoAndDept(@PathVariable("username") String username,@PathVariable("deptId") Long deptId)
|
||||||
|
{
|
||||||
|
// 以项目人员身份登录
|
||||||
|
SysUser sysUser = userService.selectUserByUserName(username, deptId);
|
||||||
|
List<Map<String, Object>> list = userService.selectProjectsByUserId(sysUser.getUserId());
|
||||||
|
|
||||||
|
sysUser.setActiveComId(sysUser.getComId());
|
||||||
|
sysUser.setActiveProjectId(Convert.toLong(list.get(0).get("project_id")));
|
||||||
|
sysUser.setActiveProjectName(Convert.toStr(list.get(0).get("project_name")));
|
||||||
|
|
||||||
// 角色集合
|
// 角色集合
|
||||||
Set<String> roles = permissionService.getRolePermission(sysUser);
|
Set<String> roles = permissionService.getRolePermission(sysUser);
|
||||||
// 权限集合
|
// 权限集合
|
||||||
|
@ -159,17 +211,6 @@ public class SysUserController extends BaseController
|
||||||
return R.ok(userService.registerUser(sysUser));
|
return R.ok(userService.registerUser(sysUser));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前用户入场项目信息
|
|
||||||
*/
|
|
||||||
@InnerAuth
|
|
||||||
@GetMapping("/projects/{userId}")
|
|
||||||
public R<List<Map<String, Object>>> getProjects(@PathVariable("userId") Long userId)
|
|
||||||
{
|
|
||||||
List<Map<String, Object>> list = userService.selectProjectsByUserId(userId);
|
|
||||||
return R.ok(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户信息
|
* 获取用户信息
|
||||||
*/
|
*/
|
||||||
|
@ -189,7 +230,20 @@ public class SysUserController extends BaseController
|
||||||
@GetMapping("getInfo")
|
@GetMapping("getInfo")
|
||||||
public AjaxResult getInfo()
|
public AjaxResult getInfo()
|
||||||
{
|
{
|
||||||
SysUser user = userService.selectUserById(SecurityUtils.getUserId());
|
SysUser cache = SecurityUtils.getLoginUser().getSysUser();
|
||||||
|
SysUser user;
|
||||||
|
if(SecurityUtils.isAdmin(cache.getUserId())){
|
||||||
|
user = userService.selectUserById(cache.getUserId());
|
||||||
|
}else{
|
||||||
|
if(SecurityUtils.isGSAdmin()){
|
||||||
|
user = userService.selectUserByIdAndDept(cache.getUserId(),cache.getComId());
|
||||||
|
}else{
|
||||||
|
user = userService.selectUserByIdAndDept(cache.getUserId(),cache.getActiveProjectId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
user.setActiveComId(cache.getComId());
|
||||||
|
user.setActiveProjectId(cache.getActiveProjectId());
|
||||||
|
user.setActiveProjectName(cache.getActiveProjectName());
|
||||||
// 角色集合
|
// 角色集合
|
||||||
Set<String> roles = permissionService.getRolePermission(user);
|
Set<String> roles = permissionService.getRolePermission(user);
|
||||||
// 权限集合
|
// 权限集合
|
||||||
|
@ -215,7 +269,13 @@ public class SysUserController extends BaseController
|
||||||
ajax.put("posts", postService.selectPostAll());
|
ajax.put("posts", postService.selectPostAll());
|
||||||
if (StringUtils.isNotNull(userId))
|
if (StringUtils.isNotNull(userId))
|
||||||
{
|
{
|
||||||
SysUser sysUser = userService.selectUserById(userId);
|
SysUser sysUser;
|
||||||
|
if(SysUser.isAdmin(userId)){
|
||||||
|
sysUser = userService.selectUserById(userId);
|
||||||
|
}else{
|
||||||
|
SysUser user = userService.selectUserByUserId(userId);
|
||||||
|
sysUser = userService.selectUserByIdAndDept(userId,user.getDeptId());
|
||||||
|
}
|
||||||
ajax.put(AjaxResult.DATA_TAG, sysUser);
|
ajax.put(AjaxResult.DATA_TAG, sysUser);
|
||||||
ajax.put("postIds", postService.selectPostListByUserId(userId));
|
ajax.put("postIds", postService.selectPostListByUserId(userId));
|
||||||
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
||||||
|
@ -327,9 +387,9 @@ public class SysUserController extends BaseController
|
||||||
{
|
{
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
SysUser user = userService.selectUserById(userId);
|
SysUser user = userService.selectUserById(userId);
|
||||||
List<SysRole> roles = roleService.findDeptRoleList(user.getDeptId());
|
List<SysRole> roles = roleService.findDeptRoleListByComId(user.getComId());
|
||||||
ajax.put("user", user);
|
ajax.put("user", user);
|
||||||
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin() && !r.isGsAdmin(r.getRoleKey())).collect(Collectors.toList()));
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,10 @@ public class SysUserRole
|
||||||
/** 角色ID */
|
/** 角色ID */
|
||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
/** 角色ID */
|
/** 单位ID */
|
||||||
private Long projectId;
|
private Long deptId;
|
||||||
|
|
||||||
|
private Long[] roleIds;
|
||||||
|
|
||||||
public Long getUserId()
|
public Long getUserId()
|
||||||
{
|
{
|
||||||
|
@ -39,12 +41,20 @@ public class SysUserRole
|
||||||
this.roleId = roleId;
|
this.roleId = roleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getProjectId() {
|
public Long getDeptId() {
|
||||||
return projectId;
|
return deptId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProjectId(Long projectId) {
|
public void setDeptId(Long deptId) {
|
||||||
this.projectId = projectId;
|
this.deptId = deptId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long[] getRoleIds() {
|
||||||
|
return roleIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleIds(Long[] roleIds) {
|
||||||
|
this.roleIds = roleIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,7 +62,6 @@ public class SysUserRole
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("userId", getUserId())
|
.append("userId", getUserId())
|
||||||
.append("roleId", getRoleId())
|
.append("roleId", getRoleId())
|
||||||
.append("projectId", getProjectId())
|
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ public interface SysDeptMapper
|
||||||
* 根据deptId查询此ID及下面的子项,用于构建树
|
* 根据deptId查询此ID及下面的子项,用于构建树
|
||||||
*/
|
*/
|
||||||
public List<SysDept> selectDeptListForComp(SysDept dept);
|
public List<SysDept> selectDeptListForComp(SysDept dept);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询部门树信息
|
* 根据角色ID查询部门树信息
|
||||||
*
|
*
|
||||||
|
|
|
@ -51,6 +51,15 @@ public interface SysMenuMapper
|
||||||
*/
|
*/
|
||||||
public List<String> selectMenuPermsByUserId(Long userId);
|
public List<String> selectMenuPermsByUserId(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID查询权限
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param deptId 单位ID
|
||||||
|
* @return 权限列表
|
||||||
|
*/
|
||||||
|
public List<String> selectMenuPermsByUserIdAndDept(@Param("userId")Long userId,@Param("deptId") Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID查询菜单
|
* 根据用户ID查询菜单
|
||||||
*
|
*
|
||||||
|
|
|
@ -41,4 +41,12 @@ public interface SysRoleDeptMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int batchRoleDept(List<SysRoleDept> roleDeptList);
|
public int batchRoleDept(List<SysRoleDept> roleDeptList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除增角色部门信息
|
||||||
|
*
|
||||||
|
* @param sysRoleDept 角色部门信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int delRoleDept(SysRoleDept sysRoleDept);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.yanzhu.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.yanzhu.system.api.domain.SysRole;
|
import com.yanzhu.system.api.domain.SysRole;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色表 数据层
|
* 角色表 数据层
|
||||||
|
@ -26,6 +27,15 @@ public interface SysRoleMapper
|
||||||
*/
|
*/
|
||||||
public List<SysRole> selectRolePermissionByUserId(Long userId);
|
public List<SysRole> selectRolePermissionByUserId(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID查询角色
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param deptId 单位ID
|
||||||
|
* @return 角色列表
|
||||||
|
*/
|
||||||
|
public List<SysRole> selectRolePermissionByUserIdAndDept(@Param("userId") Long userId, @Param("deptId") Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有角色
|
* 查询所有角色
|
||||||
*
|
*
|
||||||
|
@ -111,5 +121,13 @@ public interface SysRoleMapper
|
||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 角色列表
|
* @return 角色列表
|
||||||
*/
|
*/
|
||||||
public List<SysRole> findDeptRoleList(Long deptId);
|
public List<SysRole> findDeptRoleListByDeptId(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据公司ID查询角色列表
|
||||||
|
*
|
||||||
|
* @param comId 公司ID
|
||||||
|
* @return 角色列表
|
||||||
|
*/
|
||||||
|
public List<SysRole> findDeptRoleListByComId(Long comId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,15 @@ public interface SysUserMapper
|
||||||
*/
|
*/
|
||||||
public SysUser selectUserByUserName(String userName);
|
public SysUser selectUserByUserName(String userName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户名查询用户
|
||||||
|
*
|
||||||
|
* @param userName 用户名
|
||||||
|
* @param deptId 单位主键
|
||||||
|
* @return 用户对象信息
|
||||||
|
*/
|
||||||
|
public SysUser selectUserByUserNameAndDept(@Param("userName") String userName, @Param("deptId") Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户ID查询用户
|
* 通过用户ID查询用户
|
||||||
*
|
*
|
||||||
|
@ -53,6 +62,15 @@ public interface SysUserMapper
|
||||||
*/
|
*/
|
||||||
public SysUser selectUserById(Long userId);
|
public SysUser selectUserById(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户ID查询用户
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param deptId 单位ID
|
||||||
|
* @return 用户对象信息
|
||||||
|
*/
|
||||||
|
public SysUser selectUserByIdAndDept(@Param("userId") Long userId, @Param("deptId") Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户ID查询用户
|
* 通过用户ID查询用户
|
||||||
*
|
*
|
||||||
|
|
|
@ -20,6 +20,14 @@ public interface SysUserRoleMapper
|
||||||
*/
|
*/
|
||||||
public int deleteUserRoleByUserId(Long userId);
|
public int deleteUserRoleByUserId(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户ID删除用户和角色关联
|
||||||
|
*
|
||||||
|
* @param userRole 用户角色信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteUserRoleByUserRole(SysUserRole userRole);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除用户和角色关联
|
* 批量删除用户和角色关联
|
||||||
*
|
*
|
||||||
|
@ -60,4 +68,5 @@ public interface SysUserRoleMapper
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
|
public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,15 @@ public interface ISysMenuService
|
||||||
*/
|
*/
|
||||||
public Set<String> selectMenuPermsByUserId(Long userId);
|
public Set<String> selectMenuPermsByUserId(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID查询权限
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param deptId 单位ID
|
||||||
|
* @return 权限列表
|
||||||
|
*/
|
||||||
|
public Set<String> selectMenuPermsByUserIdAndDept(Long userId,Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询权限
|
* 根据角色ID查询权限
|
||||||
*
|
*
|
||||||
|
|
|
@ -14,7 +14,7 @@ public interface ISysPermissionService
|
||||||
/**
|
/**
|
||||||
* 获取角色数据权限
|
* 获取角色数据权限
|
||||||
*
|
*
|
||||||
* @param userId 用户Id
|
* @param user 用户信息
|
||||||
* @return 角色权限信息
|
* @return 角色权限信息
|
||||||
*/
|
*/
|
||||||
public Set<String> getRolePermission(SysUser user);
|
public Set<String> getRolePermission(SysUser user);
|
||||||
|
@ -22,7 +22,7 @@ public interface ISysPermissionService
|
||||||
/**
|
/**
|
||||||
* 获取菜单数据权限
|
* 获取菜单数据权限
|
||||||
*
|
*
|
||||||
* @param userId 用户Id
|
* @param user 用户信息
|
||||||
* @return 菜单权限信息
|
* @return 菜单权限信息
|
||||||
*/
|
*/
|
||||||
public Set<String> getMenuPermission(SysUser user);
|
public Set<String> getMenuPermission(SysUser user);
|
||||||
|
|
|
@ -36,6 +36,15 @@ public interface ISysRoleService
|
||||||
*/
|
*/
|
||||||
public Set<String> selectRolePermissionByUserId(Long userId);
|
public Set<String> selectRolePermissionByUserId(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID查询角色权限
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param deptId 单位ID
|
||||||
|
* @return 权限列表
|
||||||
|
*/
|
||||||
|
public Set<String> selectRolePermissionByUserIdAndDept(Long userId, Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有角色
|
* 查询所有角色
|
||||||
*
|
*
|
||||||
|
@ -177,5 +186,14 @@ public interface ISysRoleService
|
||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 角色列表
|
* @return 角色列表
|
||||||
*/
|
*/
|
||||||
public List<SysRole> findDeptRoleList(Long deptId);
|
public List<SysRole> findDeptRoleListByDeptId(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据公司ID查询角色列表
|
||||||
|
*
|
||||||
|
* @param comId 公司ID
|
||||||
|
* @return 角色列表
|
||||||
|
*/
|
||||||
|
public List<SysRole> findDeptRoleListByComId(Long comId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.yanzhu.system.service;
|
package com.yanzhu.system.service;
|
||||||
|
|
||||||
|
import com.yanzhu.system.api.domain.SysUser;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.yanzhu.system.api.domain.SysUser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户 业务层
|
* 用户 业务层
|
||||||
*
|
*
|
||||||
|
@ -44,6 +44,15 @@ public interface ISysUserService
|
||||||
*/
|
*/
|
||||||
public SysUser selectUserByUserName(String userName);
|
public SysUser selectUserByUserName(String userName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户名查询用户
|
||||||
|
*
|
||||||
|
* @param userName 用户名
|
||||||
|
* @param deptId 单位主键
|
||||||
|
* @return 用户对象信息
|
||||||
|
*/
|
||||||
|
public SysUser selectUserByUserName(String userName,Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户ID查询用户
|
* 通过用户ID查询用户
|
||||||
*
|
*
|
||||||
|
@ -52,6 +61,15 @@ public interface ISysUserService
|
||||||
*/
|
*/
|
||||||
public SysUser selectUserById(Long userId);
|
public SysUser selectUserById(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户ID查询用户
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param deptId 单位ID
|
||||||
|
* @return 用户对象信息
|
||||||
|
*/
|
||||||
|
public SysUser selectUserByIdAndDept(Long userId, Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户ID查询用户
|
* 通过用户ID查询用户
|
||||||
*
|
*
|
||||||
|
|
|
@ -101,6 +101,27 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||||
return permsSet;
|
return permsSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID查询权限
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param deptId 单位ID
|
||||||
|
* @return 权限列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Set<String> selectMenuPermsByUserIdAndDept(Long userId,Long deptId){
|
||||||
|
List<String> perms = menuMapper.selectMenuPermsByUserIdAndDept(userId,deptId);
|
||||||
|
Set<String> permsSet = new HashSet<>();
|
||||||
|
for (String perm : perms)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotEmpty(perm))
|
||||||
|
{
|
||||||
|
permsSet.addAll(Arrays.asList(perm.trim().split(",")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return permsSet;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据角色ID查询权限
|
* 根据角色ID查询权限
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,7 +2,14 @@ package com.yanzhu.system.service.impl;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.yanzhu.common.core.constant.SecurityConstants;
|
||||||
|
import com.yanzhu.common.core.domain.R;
|
||||||
|
import com.yanzhu.common.security.utils.SecurityUtils;
|
||||||
|
import com.yanzhu.system.api.RemoteProService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.yanzhu.system.api.domain.SysRole;
|
import com.yanzhu.system.api.domain.SysRole;
|
||||||
|
@ -25,10 +32,13 @@ public class SysPermissionServiceImpl implements ISysPermissionService
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysMenuService menuService;
|
private ISysMenuService menuService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RemoteProService remoteProService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取角色数据权限
|
* 获取角色数据权限
|
||||||
*
|
*
|
||||||
* @param userId 用户Id
|
* @param user 用户信息
|
||||||
* @return 角色权限信息
|
* @return 角色权限信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,7 +52,11 @@ public class SysPermissionServiceImpl implements ISysPermissionService
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if(SysRole.isGsAdmin(getRoleKeys(user.getRoles()))){
|
||||||
roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId()));
|
roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId()));
|
||||||
|
}else{
|
||||||
|
roles.addAll(roleService.selectRolePermissionByUserIdAndDept(user.getUserId(),user.getActiveProjectId()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +64,7 @@ public class SysPermissionServiceImpl implements ISysPermissionService
|
||||||
/**
|
/**
|
||||||
* 获取菜单数据权限
|
* 获取菜单数据权限
|
||||||
*
|
*
|
||||||
* @param userId 用户Id
|
* @param user 用户信息
|
||||||
* @return 菜单权限信息
|
* @return 菜单权限信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -70,16 +84,35 @@ public class SysPermissionServiceImpl implements ISysPermissionService
|
||||||
// 多角色设置permissions属性,以便数据权限匹配权限
|
// 多角色设置permissions属性,以便数据权限匹配权限
|
||||||
for (SysRole role : roles)
|
for (SysRole role : roles)
|
||||||
{
|
{
|
||||||
Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId());
|
Set<String> rolePerms;
|
||||||
|
if(SysRole.isGsAdmin(getRoleKeys(user.getRoles()))){
|
||||||
|
rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId());
|
||||||
|
}else{
|
||||||
|
rolePerms = menuService.selectMenuPermsByUserIdAndDept(role.getRoleId(),user.getActiveProjectId());
|
||||||
|
}
|
||||||
role.setPermissions(rolePerms);
|
role.setPermissions(rolePerms);
|
||||||
perms.addAll(rolePerms);
|
perms.addAll(rolePerms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if(SysRole.isGsAdmin(getRoleKeys(user.getRoles()))){
|
||||||
perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId()));
|
perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId()));
|
||||||
|
}else{
|
||||||
|
perms.addAll(menuService.selectMenuPermsByUserIdAndDept(user.getUserId(), user.getActiveProjectId()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return perms;
|
return perms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取roleKey
|
||||||
|
* @param roles
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<String> getRoleKeys(List<SysRole> roles){
|
||||||
|
return roles.stream().map(SysRole::getRoleKey)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
package com.yanzhu.system.service.impl;
|
package com.yanzhu.system.service.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import com.yanzhu.common.datascope.annotation.DataScope;
|
import com.yanzhu.common.datascope.annotation.DataScope;
|
||||||
import com.yanzhu.system.api.domain.SysRoleDept;
|
import com.yanzhu.system.api.domain.SysRoleDept;
|
||||||
|
@ -105,6 +101,26 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
return permsSet;
|
return permsSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID查询角色权限
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param deptId 单位ID
|
||||||
|
* @return 权限列表
|
||||||
|
*/
|
||||||
|
public Set<String> selectRolePermissionByUserIdAndDept(Long userId, Long deptId){
|
||||||
|
List<SysRole> perms = roleMapper.selectRolePermissionByUserIdAndDept(userId,deptId);
|
||||||
|
Set<String> permsSet = new HashSet<>();
|
||||||
|
for (SysRole perm : perms)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(perm))
|
||||||
|
{
|
||||||
|
permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(",")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return permsSet;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有角色
|
* 查询所有角色
|
||||||
*
|
*
|
||||||
|
@ -233,6 +249,9 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
public int insertRole(SysRole role)
|
public int insertRole(SysRole role)
|
||||||
{
|
{
|
||||||
// 新增角色信息
|
// 新增角色信息
|
||||||
|
if(Objects.nonNull(role.getDeptId()) && StringUtils.isEmpty(role.getRoleKey())){
|
||||||
|
role.setRoleKey(role.getDeptId()+"_"+System.currentTimeMillis());
|
||||||
|
}
|
||||||
roleMapper.insertRole(role);
|
roleMapper.insertRole(role);
|
||||||
int res = insertRoleMenu(role);
|
int res = insertRoleMenu(role);
|
||||||
// 角色和部门信息
|
// 角色和部门信息
|
||||||
|
@ -289,7 +308,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
// 修改角色信息
|
// 修改角色信息
|
||||||
roleMapper.updateRole(role);
|
roleMapper.updateRole(role);
|
||||||
// 删除角色与部门关联
|
// 删除角色与部门关联
|
||||||
roleDeptMapper.deleteRoleDeptByRoleId(role.getRoleId());
|
// roleDeptMapper.deleteRoleDeptByRoleId(role.getRoleId());
|
||||||
// 新增角色和部门信息(数据权限)
|
// 新增角色和部门信息(数据权限)
|
||||||
return insertRoleDeptList(role);
|
return insertRoleDeptList(role);
|
||||||
}
|
}
|
||||||
|
@ -331,6 +350,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
SysRoleDept rd = new SysRoleDept();
|
SysRoleDept rd = new SysRoleDept();
|
||||||
rd.setRoleId(role.getRoleId());
|
rd.setRoleId(role.getRoleId());
|
||||||
rd.setDeptId(role.getDeptId());
|
rd.setDeptId(role.getDeptId());
|
||||||
|
roleDeptMapper.delRoleDept(rd);
|
||||||
list.add(rd);
|
list.add(rd);
|
||||||
if (list.size() > 0)
|
if (list.size() > 0)
|
||||||
{
|
{
|
||||||
|
@ -354,6 +374,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
SysRoleDept rd = new SysRoleDept();
|
SysRoleDept rd = new SysRoleDept();
|
||||||
rd.setRoleId(role.getRoleId());
|
rd.setRoleId(role.getRoleId());
|
||||||
rd.setDeptId(deptId);
|
rd.setDeptId(deptId);
|
||||||
|
roleDeptMapper.delRoleDept(rd);
|
||||||
list.add(rd);
|
list.add(rd);
|
||||||
}
|
}
|
||||||
if (list.size() > 0)
|
if (list.size() > 0)
|
||||||
|
@ -461,7 +482,18 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
* @return 角色列表
|
* @return 角色列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysRole> findDeptRoleList(Long deptId){
|
public List<SysRole> findDeptRoleListByDeptId(Long deptId){
|
||||||
return roleMapper.findDeptRoleList(deptId);
|
return roleMapper.findDeptRoleListByDeptId(deptId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据公司ID查询角色列表
|
||||||
|
*
|
||||||
|
* @param comId 公司ID
|
||||||
|
* @return 角色列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysRole> findDeptRoleListByComId(Long comId){
|
||||||
|
return roleMapper.findDeptRoleListByComId(comId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,15 @@ package com.yanzhu.system.service.impl;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.validation.Validator;
|
import javax.validation.Validator;
|
||||||
|
|
||||||
|
import com.yanzhu.system.api.domain.SysDept;
|
||||||
import com.yanzhu.system.domain.SysPost;
|
import com.yanzhu.system.domain.SysPost;
|
||||||
import com.yanzhu.system.domain.SysUserPost;
|
import com.yanzhu.system.domain.SysUserPost;
|
||||||
import com.yanzhu.system.domain.SysUserRole;
|
import com.yanzhu.system.domain.SysUserRole;
|
||||||
import com.yanzhu.system.mapper.SysRoleMapper;
|
import com.yanzhu.system.mapper.*;
|
||||||
import com.yanzhu.system.mapper.SysUserMapper;
|
|
||||||
import com.yanzhu.system.mapper.SysUserPostMapper;
|
|
||||||
import net.sourceforge.pinyin4j.PinyinHelper;
|
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||||
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -29,8 +29,6 @@ import com.yanzhu.common.datascope.annotation.DataScope;
|
||||||
import com.yanzhu.common.security.utils.SecurityUtils;
|
import com.yanzhu.common.security.utils.SecurityUtils;
|
||||||
import com.yanzhu.system.api.domain.SysRole;
|
import com.yanzhu.system.api.domain.SysRole;
|
||||||
import com.yanzhu.system.api.domain.SysUser;
|
import com.yanzhu.system.api.domain.SysUser;
|
||||||
import com.yanzhu.system.mapper.SysPostMapper;
|
|
||||||
import com.yanzhu.system.mapper.SysUserRoleMapper;
|
|
||||||
import com.yanzhu.system.service.ISysConfigService;
|
import com.yanzhu.system.service.ISysConfigService;
|
||||||
import com.yanzhu.system.service.ISysUserService;
|
import com.yanzhu.system.service.ISysUserService;
|
||||||
|
|
||||||
|
@ -44,6 +42,9 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
{
|
{
|
||||||
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
|
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysDeptMapper deptMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysUserMapper userMapper;
|
private SysUserMapper userMapper;
|
||||||
|
|
||||||
|
@ -116,6 +117,18 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
return userMapper.selectUserByUserName(userName);
|
return userMapper.selectUserByUserName(userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户名查询用户
|
||||||
|
*
|
||||||
|
* @param userName 用户名
|
||||||
|
* @param deptId 单位主键
|
||||||
|
* @return 用户对象信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysUser selectUserByUserName(String userName,Long deptId){
|
||||||
|
return userMapper.selectUserByUserNameAndDept(userName,deptId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户ID查询用户
|
* 通过用户ID查询用户
|
||||||
*
|
*
|
||||||
|
@ -128,6 +141,18 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
return userMapper.selectUserById(userId);
|
return userMapper.selectUserById(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户ID查询用户
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param deptId 单位ID
|
||||||
|
* @return 用户对象信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysUser selectUserByIdAndDept(Long userId, Long deptId){
|
||||||
|
return userMapper.selectUserByIdAndDept(userId,deptId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户ID查询用户
|
* 通过用户ID查询用户
|
||||||
*
|
*
|
||||||
|
@ -273,6 +298,11 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
{
|
{
|
||||||
// 新增用户信息
|
// 新增用户信息
|
||||||
user.setUserName(userNameAndCout(user.getNickName()));
|
user.setUserName(userNameAndCout(user.getNickName()));
|
||||||
|
SysDept dept = deptMapper.selectDeptById(user.getDeptId());
|
||||||
|
if(Objects.isNull(dept)){
|
||||||
|
throw new ServiceException("所属单位选择异常,必须选择子公司及下属单位");
|
||||||
|
}
|
||||||
|
user.setComId(dept.getComId());
|
||||||
int rows = userMapper.insertUser(user);
|
int rows = userMapper.insertUser(user);
|
||||||
// 新增用户岗位关联
|
// 新增用户岗位关联
|
||||||
insertUserPost(user);
|
insertUserPost(user);
|
||||||
|
@ -305,7 +335,11 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
{
|
{
|
||||||
Long userId = user.getUserId();
|
Long userId = user.getUserId();
|
||||||
// 删除用户与角色关联
|
// 删除用户与角色关联
|
||||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
SysUserRole userRole = new SysUserRole();
|
||||||
|
userRole.setUserId(userId);
|
||||||
|
SysUser entity = userMapper.selectUserById(userId);
|
||||||
|
userRole.setDeptId(entity.getDeptId());
|
||||||
|
userRoleMapper.deleteUserRoleByUserRole(userRole);
|
||||||
// 新增用户与角色管理
|
// 新增用户与角色管理
|
||||||
insertUserRole(user);
|
insertUserRole(user);
|
||||||
// 删除用户与岗位关联
|
// 删除用户与岗位关联
|
||||||
|
@ -314,6 +348,11 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
insertUserPost(user);
|
insertUserPost(user);
|
||||||
//这里不允许修改密码
|
//这里不允许修改密码
|
||||||
user.setPassword(null);
|
user.setPassword(null);
|
||||||
|
SysDept dept = deptMapper.selectDeptById(user.getDeptId());
|
||||||
|
if(Objects.isNull(dept)){
|
||||||
|
throw new ServiceException("所属单位选择异常,必须选择子公司及下属单位");
|
||||||
|
}
|
||||||
|
user.setComId(dept.getComId());
|
||||||
return userMapper.updateUser(user);
|
return userMapper.updateUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +398,10 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void insertUserAuth(Long userId, Long[] roleIds)
|
public void insertUserAuth(Long userId, Long[] roleIds)
|
||||||
{
|
{
|
||||||
userRoleMapper.deleteUserRoleByUserId(userId);
|
SysUserRole userRole = new SysUserRole();
|
||||||
|
userRole.setUserId(userId);
|
||||||
|
userRole.setRoleIds(roleIds);
|
||||||
|
userRoleMapper.deleteUserRoleByUserRole(userRole);
|
||||||
insertUserRole(userId, roleIds);
|
insertUserRole(userId, roleIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
${params.dataScope}
|
${params.dataScope}
|
||||||
order by d.parent_id, d.order_num
|
order by d.parent_id, d.order_num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeptListForComp" parameterType="SysDept" resultMap="SysDeptResult">
|
<select id="selectDeptListForComp" parameterType="SysDept" resultMap="SysDeptResult">
|
||||||
<include refid="selectDeptVo"/>
|
<include refid="selectDeptVo"/>
|
||||||
where d.del_flag = '0'
|
where d.del_flag = '0'
|
||||||
|
@ -64,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</if>
|
</if>
|
||||||
order by d.parent_id, d.order_num
|
order by d.parent_id, d.order_num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeptListByRoleId" resultType="Long">
|
<select id="selectDeptListByRoleId" resultType="Long">
|
||||||
select d.dept_id
|
select d.dept_id
|
||||||
from sys_dept d
|
from sys_dept d
|
||||||
|
|
|
@ -111,6 +111,16 @@
|
||||||
where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
|
where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMenuPermsByUserIdAndDept" resultType="String">
|
||||||
|
select distinct m.perms
|
||||||
|
from sys_menu m
|
||||||
|
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||||
|
left join sys_user_role ur on rm.role_id = ur.role_id
|
||||||
|
left join sys_role r on r.role_id = ur.role_id
|
||||||
|
left join sys_role_dept rd on rd.role_id = r.role.id
|
||||||
|
where m.status = '0' and r.status = '0' and ur.user_id = #{userId} and rd.dept_id = #{deptId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
|
<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
|
||||||
select distinct m.perms
|
select distinct m.perms
|
||||||
from sys_menu m
|
from sys_menu m
|
||||||
|
|
|
@ -24,6 +24,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<delete id="delRoleDept" parameterType="SysRoleDept">
|
||||||
|
delete from sys_role_dept
|
||||||
|
<where>
|
||||||
|
<if test="roleId !=null ">and role_id=#{roleId}</if>
|
||||||
|
<if test="deptId !=null ">and dept_id=#{deptId}</if>
|
||||||
|
</where>
|
||||||
|
</delete>
|
||||||
|
|
||||||
<insert id="batchRoleDept">
|
<insert id="batchRoleDept">
|
||||||
insert into sys_role_dept(role_id, dept_id) values
|
insert into sys_role_dept(role_id, dept_id) values
|
||||||
<foreach item="item" index="index" collection="list" separator=",">
|
<foreach item="item" index="index" collection="list" separator=",">
|
||||||
|
|
|
@ -33,13 +33,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<sql id="selectRoleVo">
|
<sql id="selectRoleVo">
|
||||||
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
|
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
|
||||||
r.status, r.del_flag, r.create_time, r.remark, rd.role_id as sub_role_id, rd.dept_id as sub_dept_id, rdd.dept_name as sub_dept_name
|
r.status, r.del_flag, r.create_time, r.remark, rd.role_id as sub_role_id, rd.dept_id as sub_dept_id, d.dept_name as sub_dept_name
|
||||||
|
from sys_role r
|
||||||
|
left join sys_role_dept rd on rd.role_id = r.role_id
|
||||||
|
left join sys_dept d on d.dept_id = rd.dept_id
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<sql id="queryRoleVo">
|
||||||
|
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
|
||||||
|
r.status, r.del_flag, r.create_time, r.remark, ur.role_id as sub_role_id, d.dept_id as sub_dept_id, d.dept_name as sub_dept_name
|
||||||
from sys_role r
|
from sys_role r
|
||||||
left join sys_user_role ur on ur.role_id = r.role_id
|
left join sys_user_role ur on ur.role_id = r.role_id
|
||||||
left join sys_user u on u.user_id = ur.user_id
|
left join sys_user u on u.user_id = ur.user_id
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
left join sys_role_dept rd on rd.role_id = r.role_id
|
|
||||||
left join sys_dept rdd on rd.dept_id = rdd.dept_id
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleSysRoleDeptResult">
|
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleSysRoleDeptResult">
|
||||||
|
@ -49,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
AND r.role_id = #{roleId}
|
AND r.role_id = #{roleId}
|
||||||
</if>
|
</if>
|
||||||
<if test="deptId != null and deptId != 0">
|
<if test="deptId != null and deptId != 0">
|
||||||
AND rdd.dept_id = #{deptId}
|
AND rd.dept_id = #{deptId}
|
||||||
</if>
|
</if>
|
||||||
<if test="roleName != null and roleName != ''">
|
<if test="roleName != null and roleName != ''">
|
||||||
AND r.role_name like concat('%', #{roleName}, '%')
|
AND r.role_name like concat('%', #{roleName}, '%')
|
||||||
|
@ -71,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
order by r.role_sort
|
order by r.role_sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findDeptRoleList" parameterType="Long" resultMap="SysRoleResult">
|
<select id="findDeptRoleListByDeptId" parameterType="Long" resultMap="SysRoleResult">
|
||||||
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
|
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
|
||||||
r.status, r.del_flag, r.create_time, r.remark
|
r.status, r.del_flag, r.create_time, r.remark
|
||||||
from sys_role r
|
from sys_role r
|
||||||
|
@ -80,13 +86,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
order by r.role_sort
|
order by r.role_sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="findDeptRoleListByComId" parameterType="Long" resultMap="SysRoleSysRoleDeptResult">
|
||||||
|
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
|
||||||
|
r.status, r.del_flag, r.create_time, r.remark, rd.role_id as sub_role_id, rd.dept_id as sub_dept_id, d.dept_name as sub_dept_name
|
||||||
|
from sys_role r
|
||||||
|
left join sys_role_dept rd on rd.role_id = r.role_id
|
||||||
|
left join sys_dept d on d.dept_id = rd.dept_id
|
||||||
|
where r.del_flag = '0' and rd.dept_id in (select sd.dept_id from sys_dept sd where sd.dept_id = #{comId} or FIND_IN_SET(#{comId},sd.ancestors))
|
||||||
|
order by r.role_sort
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleSysRoleDeptResult">
|
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleSysRoleDeptResult">
|
||||||
<include refid="selectRoleVo"/>
|
<include refid="queryRoleVo"/>
|
||||||
WHERE r.del_flag = '0' and ur.user_id = #{userId}
|
WHERE r.del_flag = '0' and ur.user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRolePermissionByUserIdAndDept" resultMap="SysRoleSysRoleDeptResult">
|
||||||
|
<include refid="queryRoleVo"/>
|
||||||
|
left join sys_role_dept rd on rd.role_id = r.role_id
|
||||||
|
WHERE r.del_flag = '0' and ur.user_id = #{userId} and rd.dept_id = #{deptId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectRoleAll" resultMap="SysRoleSysRoleDeptResult">
|
<select id="selectRoleAll" resultMap="SysRoleSysRoleDeptResult">
|
||||||
<include refid="selectRoleVo"/>
|
<include refid="queryRoleVo"/>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectRoleListByUserId" parameterType="Long" resultType="Long">
|
<select id="selectRoleListByUserId" parameterType="Long" resultType="Long">
|
||||||
|
@ -103,7 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleSysRoleDeptResult">
|
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleSysRoleDeptResult">
|
||||||
<include refid="selectRoleVo"/>
|
<include refid="queryRoleVo"/>
|
||||||
WHERE r.del_flag = '0' and u.user_name = #{userName}
|
WHERE r.del_flag = '0' and u.user_name = #{userName}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
@ -153,11 +153,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where u.user_name = #{userName} and u.del_flag = '0'
|
where u.user_name = #{userName} and u.del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUserByUserNameAndDept" parameterType="String" resultMap="SysUserResult">
|
||||||
|
<include refid="selectUserVo"/>
|
||||||
|
left join sys_role_dept rd on rd.role_id = r.role_id
|
||||||
|
where u.user_name = #{userName} and rd.dept_id = ${deptId} and u.del_flag = '0'
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
where u.user_id = #{userId}
|
where u.user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUserByIdAndDept" resultMap="SysUserResult">
|
||||||
|
<include refid="selectUserVo"/>
|
||||||
|
left join sys_role_dept rd on rd.role_id = r.role_id
|
||||||
|
where u.user_id = #{userId} and rd.dept_id = ${deptId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectUserByUserId" parameterType="Long" resultMap="SysUserResult">
|
<select id="selectUserByUserId" parameterType="Long" resultMap="SysUserResult">
|
||||||
select * from sys_user u where u.user_id = #{userId}
|
select * from sys_user u where u.user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
@ -276,7 +288,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<!--根据用户编号查询入场项目信息-->
|
<!--根据用户编号查询入场项目信息-->
|
||||||
<select id="selectProjectsByUserId" parameterType="Long" resultType="Map">
|
<select id="selectProjectsByUserId" parameterType="Long" resultType="Map">
|
||||||
select * from pro_project_info_users where user_id=#{userId} and is_del=0 and use_status=1 order by sort_by asc
|
select pu.project_id, pi.project_name, pi.com_id from pro_project_info_users pu
|
||||||
|
left join pro_project_info pi on pi.id = pu.project_id
|
||||||
|
where pu.user_id=#{userId} and pu.is_del=0 and pu.use_status=1 order by pu.sort_by asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -13,6 +13,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
delete from sys_user_role where user_id=#{userId}
|
delete from sys_user_role where user_id=#{userId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteUserRoleByUserRole" parameterType="SysUserRole">
|
||||||
|
delete from sys_user_role ur where ur.user_id=#{userId}
|
||||||
|
<if test="deptId != null"> and ur.role_id in (select rd.role_id from sys_role_dept rd where rd.dept_id = #{deptId})</if>
|
||||||
|
<if test="roleIds != null and roleIds.length>0"> and ur.role_id in
|
||||||
|
<foreach collection="roleIds" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</delete>
|
||||||
|
|
||||||
<select id="countUserRoleByRoleId" resultType="Integer">
|
<select id="countUserRoleByRoleId" resultType="Integer">
|
||||||
select count(1) from sys_user_role where role_id=#{roleId}
|
select count(1) from sys_user_role where role_id=#{roleId}
|
||||||
</select>
|
</select>
|
||||||
|
@ -32,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<delete id="deleteUserRoleInfo" parameterType="SysUserRole">
|
<delete id="deleteUserRoleInfo" parameterType="SysUserRole">
|
||||||
delete from sys_user_role where user_id=#{userId} and role_id=#{roleId}
|
delete from sys_user_role where user_id = #{userId} and role_id = #{roleId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteUserRoleInfos">
|
<delete id="deleteUserRoleInfos">
|
||||||
|
|
|
@ -32,6 +32,14 @@ export function refreshToken() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 切换项目登录
|
||||||
|
export function switchProject(proId) {
|
||||||
|
return request({
|
||||||
|
url: '/auth/switchProject/'+proId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 获取用户详细信息
|
// 获取用户详细信息
|
||||||
export function getInfo() {
|
export function getInfo() {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
@ -42,3 +42,11 @@ export function delProProjectInfoUsers(id) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 改变项目排序
|
||||||
|
export function changeDefaultProject(id) {
|
||||||
|
return request({
|
||||||
|
url: '/manage/proProjectInfoUsers/changeDefaultProject/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 获取我的项目列表
|
||||||
|
export function findMyProjectList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/manage/proProjectInfo/findMyProjectList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
|
@ -0,0 +1,167 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-button type="primary" plain :icon="OfficeBuilding" @click="showProList">{{userStore.currentProId?userStore.currentProName:'所有项目'}}</el-button>
|
||||||
|
|
||||||
|
<!--选择项目-->
|
||||||
|
<el-dialog v-model="dialogVisible" title="选择切换项目" width="800">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" label-width="68px">
|
||||||
|
<el-form-item label="项目名称" prop="projectName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.projectName"
|
||||||
|
placeholder="请输入项目名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="projectDataList">
|
||||||
|
<el-table-column type="index" label="序号" width="50" align="center" />
|
||||||
|
<el-table-column prop="comName" label="所属公司" align="center" />
|
||||||
|
<el-table-column prop="projectName" label="项目名称" align="center" />
|
||||||
|
<!-- <el-table-column v-if="!isAdmin" label="默认项目" align="center" width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-rate :model-value="scope.$index==0?1:0" max="1" @change="changeDefault(scope.row.id)"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column> -->
|
||||||
|
<el-table-column prop="createTime" label="创建时间" align="center" width="120">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button v-if="scope.row.id == userStore.currentProId" disabled link type="primary">已 选 中</el-button>
|
||||||
|
<el-button v-if="scope.row.id != userStore.currentProId" link type="primary" icon="Switch" @click="changeDefault(scope.row.id)">切换项目</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getProjectList"
|
||||||
|
/>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="CurrentProject">
|
||||||
|
import { OfficeBuilding } from '@element-plus/icons-vue'
|
||||||
|
import { findMyProjectList } from "@/api/publics";
|
||||||
|
import { switchProject } from '@/api/login'
|
||||||
|
import { changeDefaultProject } from "@/api/manage/proProjectInfoUsers";
|
||||||
|
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance();
|
||||||
|
import useUserStore from '@/store/modules/user'
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
|
const isAdmin = ref(false);
|
||||||
|
const defaultRate = ref(1);
|
||||||
|
// 显示dialog
|
||||||
|
const dialogVisible = ref(false);
|
||||||
|
const total = ref(0);
|
||||||
|
const loading = ref(true);
|
||||||
|
const projectDataList = ref([]);
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, form } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询项目列表 */
|
||||||
|
function getProjectList() {
|
||||||
|
loading.value = true;
|
||||||
|
findMyProjectList(queryParams.value).then(response => {
|
||||||
|
projectDataList.value = response.rows;
|
||||||
|
total.value = response.total;
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
dialogVisible.value = false;
|
||||||
|
proxy.resetForm("queryRef");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getProjectList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef");
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 改变默认项目 */
|
||||||
|
function changeDefault(proId) {
|
||||||
|
if(isAdmin.value){
|
||||||
|
switchProject(proId).then(res =>{
|
||||||
|
if(res.code==200){
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
changeDefaultProject(proId).then(response =>{
|
||||||
|
switchProject(proId).then(res =>{
|
||||||
|
if(res.code==200){
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 显示项目列表 */
|
||||||
|
function showProList() {
|
||||||
|
getProjectList();
|
||||||
|
dialogVisible.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化页面 */
|
||||||
|
function initPage() {
|
||||||
|
let roles = userStore.roles;
|
||||||
|
if(roles.includes("admin") || roles.includes("gsAdmin")){
|
||||||
|
isAdmin.value = true;
|
||||||
|
}else{
|
||||||
|
isAdmin.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initPage();
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scope>
|
||||||
|
.el-dialog__body{
|
||||||
|
margin-top: -30px;
|
||||||
|
padding-bottom: 50px;
|
||||||
|
.pagination-container{
|
||||||
|
margin-top: 0px;
|
||||||
|
padding-bottom: 30px !important;
|
||||||
|
.el-pagination{
|
||||||
|
margin-right: 50px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -6,16 +6,10 @@
|
||||||
|
|
||||||
<div class="right-menu">
|
<div class="right-menu">
|
||||||
<template v-if="appStore.device !== 'mobile'">
|
<template v-if="appStore.device !== 'mobile'">
|
||||||
|
<current-project id="current-project" class="right-menu-item"/>
|
||||||
|
|
||||||
<header-search id="header-search" class="right-menu-item" />
|
<header-search id="header-search" class="right-menu-item" />
|
||||||
|
|
||||||
<el-tooltip content="源码地址" effect="dark" placement="bottom">
|
|
||||||
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
|
|
||||||
</el-tooltip>
|
|
||||||
|
|
||||||
<el-tooltip content="文档地址" effect="dark" placement="bottom">
|
|
||||||
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
|
|
||||||
</el-tooltip>
|
|
||||||
|
|
||||||
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
||||||
|
|
||||||
<el-tooltip content="布局大小" effect="dark" placement="bottom">
|
<el-tooltip content="布局大小" effect="dark" placement="bottom">
|
||||||
|
@ -55,8 +49,7 @@ import Hamburger from '@/components/Hamburger'
|
||||||
import Screenfull from '@/components/Screenfull'
|
import Screenfull from '@/components/Screenfull'
|
||||||
import SizeSelect from '@/components/SizeSelect'
|
import SizeSelect from '@/components/SizeSelect'
|
||||||
import HeaderSearch from '@/components/HeaderSearch'
|
import HeaderSearch from '@/components/HeaderSearch'
|
||||||
import RuoYiGit from '@/components/RuoYi/Git'
|
import CurrentProject from '@/components/CurrentProject'
|
||||||
import RuoYiDoc from '@/components/RuoYi/Doc'
|
|
||||||
import useAppStore from '@/store/modules/app'
|
import useAppStore from '@/store/modules/app'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
import useSettingsStore from '@/store/modules/settings'
|
import useSettingsStore from '@/store/modules/settings'
|
||||||
|
|
|
@ -11,7 +11,9 @@ const useUserStore = defineStore(
|
||||||
avatar: '',
|
avatar: '',
|
||||||
compInfo:{},
|
compInfo:{},
|
||||||
roles: [],
|
roles: [],
|
||||||
permissions: []
|
permissions: [],
|
||||||
|
currentProId: null,
|
||||||
|
currentProName: null,
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
// 登录
|
// 登录
|
||||||
|
@ -47,6 +49,8 @@ const useUserStore = defineStore(
|
||||||
this.name = user.userName
|
this.name = user.userName
|
||||||
this.compInfo=user.comp;
|
this.compInfo=user.comp;
|
||||||
this.avatar = avatar;
|
this.avatar = avatar;
|
||||||
|
this.currentProId = user.activeProjectId
|
||||||
|
this.currentProName = user.activeProjectName
|
||||||
resolve(res)
|
resolve(res)
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject(error)
|
reject(error)
|
||||||
|
|
|
@ -38,8 +38,8 @@
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="proProjectInfoList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="proProjectInfoList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="所属单位" align="center" prop="comName" width="120" />
|
||||||
<el-table-column label="项目名称" align="center" prop="projectName" width="250" />
|
<el-table-column label="项目名称" align="center" prop="projectName" width="250" />
|
||||||
<el-table-column label="项目部门" align="center" prop="deptName" width="200" />
|
|
||||||
<el-table-column label="项目简称" align="center" prop="simpleName" />
|
<el-table-column label="项目简称" align="center" prop="simpleName" />
|
||||||
<el-table-column label="项目类型" align="center" prop="projectType" width="100">
|
<el-table-column label="项目类型" align="center" prop="projectType" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
@ -51,13 +51,13 @@
|
||||||
<image-preview :src="scope.row.projectQrCode" :width="50" :height="50" />
|
<image-preview :src="scope.row.projectQrCode" :width="50" :height="50" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="项目排序" align="center" prop="projectSort" width="120">
|
<el-table-column label="项目排序" align="center" prop="projectSort" width="180" v-if="isAdmin">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-input-number v-model="scope.row.projectSort" :min="1" :max="999"
|
<el-input-number v-model="scope.row.projectSort" :min="1" :max="999"
|
||||||
@change="setProjectSort(scope.row, $event)"></el-input-number>
|
@change="setProjectSort(scope.row, $event)"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="项目地址" align="center" prop="projectAddress" width="250" />
|
<el-table-column label="项目地址" align="center" prop="projectAddress" width="280" />
|
||||||
<el-table-column label="负责人" align="center" prop="projectPerson" width="100" />
|
<el-table-column label="负责人" align="center" prop="projectPerson" width="100" />
|
||||||
<el-table-column label="负责人电话" align="center" prop="projectPersonPhone" width="120" />
|
<el-table-column label="负责人电话" align="center" prop="projectPersonPhone" width="120" />
|
||||||
<el-table-column label="项目工期" align="center" prop="projectTimeLimit" width="120">
|
<el-table-column label="项目工期" align="center" prop="projectTimeLimit" width="120">
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" fixed="right" width="150" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['manage:proProjectInfo:edit']">修改</el-button>
|
v-hasPermi="['manage:proProjectInfo:edit']">修改</el-button>
|
||||||
|
@ -124,23 +124,13 @@
|
||||||
<el-tab-pane label="项目基本信息" name="base">
|
<el-tab-pane label="项目基本信息" name="base">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="归属单位" prop="deptId">
|
<el-form-item label="所属单位" prop="disDeptId">
|
||||||
<el-select v-model="form.deptId" placeholder="请选择公司" clearable @change="doChangeComp">
|
|
||||||
<el-option v-for="dict in data.compOptions" :key="dict.deptId" :label="dict.deptName"
|
|
||||||
:value="dict.deptId"></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="归属部门" prop="disDeptId">
|
|
||||||
<el-tree-select v-model="form.disDeptId" :data="deptOptions"
|
<el-tree-select v-model="form.disDeptId" :data="deptOptions"
|
||||||
:props="{ value: 'id', label: 'label', children: 'children' }" value-key="id" placeholder="请选择显示层级"
|
:props="{ value: 'id', label: 'label', children: 'children' }" value-key="id" placeholder="请选择所属单位"
|
||||||
check-strictly style="width:100%" />
|
check-strictly style="width:100%" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
<el-col :span="8">
|
||||||
<el-row :gutter="20">
|
|
||||||
<el-col :span="16">
|
|
||||||
<el-form-item label="项目名称" prop="projectName">
|
<el-form-item label="项目名称" prop="projectName">
|
||||||
<el-input v-model="form.projectName" maxlength="64" show-word-limit placeholder="请输入项目名称" />
|
<el-input v-model="form.projectName" maxlength="64" show-word-limit placeholder="请输入项目名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -259,7 +249,7 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="参建单位信息" name="depts" v-if="data.opt=='edit'">
|
<el-tab-pane label="建设单位信息" name="depts" v-if="data.opt=='edit'">
|
||||||
<div v-for="(it,idx) in projectDeptsList" :key="idx" class="prj-dept-item">
|
<div v-for="(it,idx) in projectDeptsList" :key="idx" class="prj-dept-item">
|
||||||
<div class="dept-item-header">
|
<div class="dept-item-header">
|
||||||
<el-icon size="14" color="#2196F3"><OfficeBuilding /></el-icon>
|
<el-icon size="14" color="#2196F3"><OfficeBuilding /></el-icon>
|
||||||
|
@ -267,16 +257,19 @@
|
||||||
</div>
|
</div>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<span class="sp-label">{{ it.deptType }}名称</span>
|
<el-form-item :label="it.deptType+'名称'">
|
||||||
<el-input v-model="it.deptName" class="txt-dept-name"/>
|
<el-input v-model="it.deptName" class="txt-dept-name" placeholder="请输入单位名称"/>
|
||||||
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<span class="sp-label">负责人姓名</span>
|
<el-form-item label="负责人姓名">
|
||||||
<el-input v-model="it.leader" class="txt-leader"/>
|
<el-input v-model="it.leader" class="txt-leader" placeholder="请输入负责人姓名"/>
|
||||||
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<span class="sp-label">负责人联系电话</span>
|
<el-form-item label="负责人电话">
|
||||||
<el-input v-model="it.phone" class="txt-phone"/>
|
<el-input v-model="it.phone" class="txt-phone" placeholder="请输入负责人电话"/>
|
||||||
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
@ -332,13 +325,13 @@
|
||||||
|
|
||||||
<script setup name="ProProjectInfo">
|
<script setup name="ProProjectInfo">
|
||||||
import { deptTreeSelect } from "@/api/system/user";
|
import { deptTreeSelect } from "@/api/system/user";
|
||||||
import { projectDeptList, deptTree, listDept } from "@/api/system/dept";
|
|
||||||
import { listProProjectInfo, getProProjectInfo, delProProjectInfo, addProProjectInfo, updateProProjectInfo } from "@/api/manage/proProjectInfo";
|
import { listProProjectInfo, getProProjectInfo, delProProjectInfo, addProProjectInfo, updateProProjectInfo } from "@/api/manage/proProjectInfo";
|
||||||
import BaiduMap from "@/components/BaiduMap/Map.vue";
|
import BaiduMap from "@/components/BaiduMap/Map.vue";
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { pro_project_type, pro_project_schedule, pro_dept_type, sys_is_del } = proxy.useDict('pro_project_type', 'pro_project_schedule', 'pro_dept_type', 'sys_is_del');
|
const { pro_project_type, pro_project_schedule, pro_dept_type, sys_is_del } = proxy.useDict('pro_project_type', 'pro_project_schedule', 'pro_dept_type', 'sys_is_del');
|
||||||
|
|
||||||
|
const isAdmin = ref(false);
|
||||||
const mapRef = ref("");
|
const mapRef = ref("");
|
||||||
const proProjectInfoList = ref([]);
|
const proProjectInfoList = ref([]);
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
|
@ -389,8 +382,6 @@ const data = reactive({
|
||||||
totalInvestment: [{ required: true, message: "项目总投资不能为空", trigger: "blur" }],
|
totalInvestment: [{ required: true, message: "项目总投资不能为空", trigger: "blur" }],
|
||||||
contractAmount: [{ required: true, message: "合同金额不能为空", trigger: "blur" }],
|
contractAmount: [{ required: true, message: "合同金额不能为空", trigger: "blur" }],
|
||||||
},
|
},
|
||||||
allDeptTree:[],
|
|
||||||
compOptions:[],
|
|
||||||
opt:'',
|
opt:'',
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -466,7 +457,7 @@ function reset() {
|
||||||
setting: {}
|
setting: {}
|
||||||
};
|
};
|
||||||
proxy.resetForm("proProjectInfoRef");
|
proxy.resetForm("proProjectInfoRef");
|
||||||
activeName.value="base";
|
activeTags.value="base";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
|
@ -493,7 +484,7 @@ function handleAdd() {
|
||||||
data.opt="add"
|
data.opt="add"
|
||||||
reset();
|
reset();
|
||||||
open.value = true;
|
open.value = true;
|
||||||
title.value = "添加项目信息";
|
title.value = "添加项目";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
|
@ -617,42 +608,26 @@ function handleExport() {
|
||||||
/** 查询部门下拉树结构 */
|
/** 查询部门下拉树结构 */
|
||||||
function getDeptTree() {
|
function getDeptTree() {
|
||||||
deptTreeSelect().then(response => {
|
deptTreeSelect().then(response => {
|
||||||
data.allDeptTree = response.data;
|
deptOptions.value = response.data;
|
||||||
});
|
|
||||||
listDept({ deptType: 2 }).then(response => {
|
|
||||||
data.compOptions = response.data;
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
//公司下拉选择
|
|
||||||
function doChangeComp(){
|
|
||||||
const findDept=nodes=>{
|
|
||||||
let tmps=nodes.filter(d=>d.data.deptId==form.value.deptId);
|
|
||||||
if(tmps.length>0){
|
|
||||||
return tmps[0].children;
|
|
||||||
}else{
|
|
||||||
for(let i=0;i<nodes.length;i++){
|
|
||||||
let obj=findDept(nodes[i].children);
|
|
||||||
if(obj){
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if(form.value.deptId){
|
|
||||||
deptOptions.value=findDept(data.allDeptTree);
|
|
||||||
}else{
|
|
||||||
deptOptions.value=[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 地图选择 */
|
/** 地图选择 */
|
||||||
function getMapInfo() {
|
function getMapInfo() {
|
||||||
mapRef.value.showDlg();
|
mapRef.value.showDlg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 初始化页面 */
|
||||||
|
function initPage() {
|
||||||
|
let roles = userStore.roles;
|
||||||
|
if(roles.includes("admin") || roles.includes("gsAdmin")){
|
||||||
|
isAdmin.value = true;
|
||||||
|
}else{
|
||||||
|
isAdmin.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initPage();
|
||||||
getList();
|
getList();
|
||||||
getDeptTree();
|
getDeptTree();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,32 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="单位主键" prop="deptId">
|
<el-form-item label="项目名称" prop="projectName">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.deptId"
|
v-model="queryParams.projectName"
|
||||||
placeholder="请输入单位主键"
|
placeholder="请输入项目名称"
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter="handleQuery"
|
@keyup.enter="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="项目主键" prop="projectId">
|
<el-form-item label="单位类型" prop="subDeptType">
|
||||||
<el-input
|
<el-select v-model="queryParams.subDeptType" placeholder="请选择参建单位类型" clearable>
|
||||||
v-model="queryParams.projectId"
|
|
||||||
placeholder="请输入项目主键"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="分包单位" prop="subDeptId">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.subDeptId"
|
|
||||||
placeholder="请输入分包单位"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="分包单位类型" prop="subDeptType">
|
|
||||||
<el-select v-model="queryParams.subDeptType" placeholder="请选择分包单位类型" clearable>
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in sub_dept_type"
|
v-for="dict in sub_dept_type"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
|
@ -35,82 +19,14 @@
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="分包单位名称" prop="subDeptName">
|
<el-form-item label="单位名称" prop="subDeptName">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.subDeptName"
|
v-model="queryParams.subDeptName"
|
||||||
placeholder="请输入分包单位名称"
|
placeholder="请输入参建单位名称"
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter="handleQuery"
|
@keyup.enter="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="分包单位编号" prop="subDeptCode">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.subDeptCode"
|
|
||||||
placeholder="请输入分包单位编号"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="负责人主键" prop="subDeptLeaderId">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.subDeptLeaderId"
|
|
||||||
placeholder="请输入负责人主键"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="负责人姓名" prop="subDeptLeaderName">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.subDeptLeaderName"
|
|
||||||
placeholder="请输入负责人姓名"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="负责人证件号码" prop="subDeptLeaderCode">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.subDeptLeaderCode"
|
|
||||||
placeholder="请输入负责人证件号码"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="负责人电话" prop="subDeptLeaderPhone">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.subDeptLeaderPhone"
|
|
||||||
placeholder="请输入负责人电话"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="进场状态" prop="useStatus">
|
|
||||||
<el-select v-model="queryParams.useStatus" placeholder="请选择进场状态" clearable>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in sys_use_status"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="二维码" prop="qrCode">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.qrCode"
|
|
||||||
placeholder="请输入二维码"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="删除标识" prop="isDel">
|
|
||||||
<el-select v-model="queryParams.isDel" placeholder="请选择删除标识" clearable>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in sys_is_del"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
@ -159,36 +75,48 @@
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
<el-tabs
|
||||||
|
v-model="activeName"
|
||||||
|
type="card"
|
||||||
|
class="demo-tabs"
|
||||||
|
@tab-click="getList"
|
||||||
|
>
|
||||||
|
<el-tab-pane :label="'全部('+tabs.all+')'" name="all"></el-tab-pane>
|
||||||
|
<el-tab-pane :label="'已入场('+tabs.in+')'" name="in"></el-tab-pane>
|
||||||
|
<el-tab-pane :label="'已退场('+tabs.out+')'" name="out"></el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
<el-table v-loading="loading" :data="proProjectInfoSubdeptsList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="proProjectInfoSubdeptsList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="主键" align="center" prop="id" />
|
<el-table-column label="公司名称" align="center" prop="comName" />
|
||||||
<el-table-column label="单位主键" align="center" prop="deptId" />
|
<el-table-column label="项目名称" align="center" prop="projectName" />
|
||||||
<el-table-column label="项目主键" align="center" prop="projectId" />
|
<el-table-column label="单位类型" align="center" prop="subDeptType">
|
||||||
<el-table-column label="分包单位" align="center" prop="subDeptId" />
|
|
||||||
<el-table-column label="分包单位类型" align="center" prop="subDeptType">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="sub_dept_type" :value="scope.row.subDeptType"/>
|
<dict-tag :options="sub_dept_type" :value="scope.row.subDeptType"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="分包单位名称" align="center" prop="subDeptName" />
|
<el-table-column label="单位名称" align="center" prop="subDeptName" />
|
||||||
<el-table-column label="分包单位编号" align="center" prop="subDeptCode" />
|
<el-table-column label="信用代码" align="center" prop="subDeptCode" />
|
||||||
<el-table-column label="负责人主键" align="center" prop="subDeptLeaderId" />
|
<el-table-column label="委托人" align="center" prop="subDeptLeaderName" />
|
||||||
<el-table-column label="负责人姓名" align="center" prop="subDeptLeaderName" />
|
<el-table-column label="委托人电话" align="center" prop="subDeptLeaderPhone" />
|
||||||
<el-table-column label="负责人证件号码" align="center" prop="subDeptLeaderCode" />
|
<el-table-column label="入场二维码" align="center" prop="qrCode" width="80" >
|
||||||
<el-table-column label="负责人电话" align="center" prop="subDeptLeaderPhone" />
|
<template #default="scope">
|
||||||
|
<image-preview v-if="scope.row.qrCode" :src="scope.row.qrCode" :width="50" :height="50" />
|
||||||
|
<span v-if="!scope.row.qrCode">-</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="进场状态" align="center" prop="useStatus">
|
<el-table-column label="进场状态" align="center" prop="useStatus">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="sys_use_status" :value="scope.row.useStatus"/>
|
<dict-tag :options="sys_use_status" :value="scope.row.useStatus"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="审批状态" align="center" prop="approveStatus" />
|
<el-table-column label="添加用户" align="center" prop="createBy" />
|
||||||
<el-table-column label="二维码" align="center" prop="qrCode" />
|
<el-table-column label="添加时间" align="center" prop="subDeptLeaderPhone" />
|
||||||
<el-table-column label="删除标识" align="center" prop="isDel">
|
<el-table-column label="审批状态" align="center" prop="approveStatus" >
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="sys_is_del" :value="scope.row.isDel"/>
|
<dict-tag :options="sys_approve_status" :value="scope.row.approveStatus"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:proProjectInfoSubdepts:edit']">修改</el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:proProjectInfoSubdepts:edit']">修改</el-button>
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:proProjectInfoSubdepts:remove']">删除</el-button>
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:proProjectInfoSubdepts:remove']">删除</el-button>
|
||||||
|
@ -205,19 +133,16 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改分包单位对话框 -->
|
<!-- 添加或修改分包单位对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
<el-dialog :title="title" v-model="open" width="680px" append-to-body>
|
||||||
<el-form ref="proProjectInfoSubdeptsRef" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="proProjectInfoSubdeptsRef" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="单位主键" prop="deptId">
|
<el-form-item label="公司名称" v-if="form.comId">
|
||||||
<el-input v-model="form.deptId" placeholder="请输入单位主键" />
|
{{form.comName}}
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="项目主键" prop="projectId">
|
<el-form-item label="项目名称" v-if="form.projectId">
|
||||||
<el-input v-model="form.projectId" placeholder="请输入项目主键" />
|
<el-tag effect="plain">{{ form.projectName }}</el-tag>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="分包单位" prop="subDeptId">
|
<el-form-item label="单位类型" prop="subDeptType">
|
||||||
<el-input v-model="form.subDeptId" placeholder="请输入分包单位" />
|
<el-select v-model="form.subDeptType" placeholder="请选择单位类型">
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="分包单位类型" prop="subDeptType">
|
|
||||||
<el-select v-model="form.subDeptType" placeholder="请选择分包单位类型">
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in sub_dept_type"
|
v-for="dict in sub_dept_type"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
|
@ -226,11 +151,11 @@
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="分包单位名称" prop="subDeptName">
|
<el-form-item label="单位名称" prop="subDeptName">
|
||||||
<el-input v-model="form.subDeptName" placeholder="请输入分包单位名称" />
|
<el-input v-model="form.subDeptName" placeholder="请输入单位名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="分包单位编号" prop="subDeptCode">
|
<el-form-item label="信用代码" prop="subDeptCode">
|
||||||
<el-input v-model="form.subDeptCode" placeholder="请输入分包单位编号" />
|
<el-input v-model="form.subDeptCode" placeholder="请输入信用代码" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="负责人主键" prop="subDeptLeaderId">
|
<el-form-item label="负责人主键" prop="subDeptLeaderId">
|
||||||
<el-input v-model="form.subDeptLeaderId" placeholder="请输入负责人主键" />
|
<el-input v-model="form.subDeptLeaderId" placeholder="请输入负责人主键" />
|
||||||
|
@ -285,7 +210,7 @@
|
||||||
import { listProProjectInfoSubdepts, getProProjectInfoSubdepts, delProProjectInfoSubdepts, addProProjectInfoSubdepts, updateProProjectInfoSubdepts } from "@/api/manage/proProjectInfoSubdepts";
|
import { listProProjectInfoSubdepts, getProProjectInfoSubdepts, delProProjectInfoSubdepts, addProProjectInfoSubdepts, updateProProjectInfoSubdepts } from "@/api/manage/proProjectInfoSubdepts";
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { sys_use_status, sub_dept_type, sys_is_del } = proxy.useDict('sys_use_status', 'sub_dept_type', 'sys_is_del');
|
const { sys_use_status, sub_dept_type, sys_approve_status } = proxy.useDict('sys_use_status', 'sub_dept_type', 'sys_approve_status');
|
||||||
|
|
||||||
const proProjectInfoSubdeptsList = ref([]);
|
const proProjectInfoSubdeptsList = ref([]);
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
|
@ -296,6 +221,8 @@ const single = ref(true);
|
||||||
const multiple = ref(true);
|
const multiple = ref(true);
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
const title = ref("");
|
const title = ref("");
|
||||||
|
const tabs = ref({all:0,in:0,out:0});
|
||||||
|
const activeName = ref("all");
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: {},
|
||||||
|
@ -389,7 +316,7 @@ function handleSelectionChange(selection) {
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
reset();
|
reset();
|
||||||
open.value = true;
|
open.value = true;
|
||||||
title.value = "添加分包单位";
|
title.value = "添加参建单位";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
|
@ -399,7 +326,7 @@ function handleUpdate(row) {
|
||||||
getProProjectInfoSubdepts(_id).then(response => {
|
getProProjectInfoSubdepts(_id).then(response => {
|
||||||
form.value = response.data;
|
form.value = response.data;
|
||||||
open.value = true;
|
open.value = true;
|
||||||
title.value = "修改分包单位";
|
title.value = "修改参建单位";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,11 +123,11 @@
|
||||||
<!-- 表格数据 -->
|
<!-- 表格数据 -->
|
||||||
<el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="角色编号" prop="roleId" width="120" />
|
<el-table-column label="角色编号" align="center" prop="roleId" width="120" />
|
||||||
<el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" />
|
<el-table-column label="角色名称" align="center" prop="roleName" :show-overflow-tooltip="true" width="150" />
|
||||||
<el-table-column label="所属部门">
|
<el-table-column label="所属部门" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div class="flex gap-2">
|
<div v-if="scope.row.roleId!==2" class="flex gap-2">
|
||||||
<el-tag
|
<el-tag
|
||||||
v-for="item in scope.row.roleDeptList"
|
v-for="item in scope.row.roleDeptList"
|
||||||
effect="dark"
|
effect="dark"
|
||||||
|
@ -135,18 +135,24 @@
|
||||||
{{ item.deptName }}
|
{{ item.deptName }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
-
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="150" />
|
<el-table-column label="权限字符" align="center" prop="roleKey" :show-overflow-tooltip="true" width="150" />
|
||||||
<el-table-column label="显示顺序" prop="roleSort" width="100" />
|
<el-table-column label="显示顺序" align="center" prop="roleSort" width="100" />
|
||||||
<el-table-column label="状态" align="center" width="100">
|
<el-table-column label="角色状态" align="center" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-switch
|
<el-switch
|
||||||
|
v-if="scope.row.roleId !== 1 && (scope.row.roleId !== 2 && !isAdmin)"
|
||||||
v-model="scope.row.status"
|
v-model="scope.row.status"
|
||||||
active-value="0"
|
active-value="0"
|
||||||
inactive-value="1"
|
inactive-value="1"
|
||||||
@change="handleStatusChange(scope.row)"
|
@change="handleStatusChange(scope.row)"
|
||||||
></el-switch>
|
></el-switch>
|
||||||
|
<el-button v-if="scope.row.roleId==1" type="primary" link disabled>不可修改</el-button>
|
||||||
|
<el-button v-if="scope.row.roleId == 2 && !isAdmin" type="danger" link disabled>权限不足</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime">
|
<el-table-column label="创建时间" align="center" prop="createTime">
|
||||||
|
@ -156,18 +162,20 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip content="修改" placement="top" v-if="scope.row.roleId !== 1">
|
<el-tooltip content="修改" placement="top" v-if="scope.row.roleId !== 1 && (scope.row.roleId !== 2 && !isAdmin)">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="删除" placement="top" v-if="scope.row.roleId !== 1">
|
<el-tooltip content="删除" placement="top" v-if="scope.row.roleId !== 1 && (scope.row.roleId !== 2 && !isAdmin)">
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:role:remove']"></el-button>
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:role:remove']"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="数据权限" placement="top" v-if="scope.row.roleId !== 1">
|
<el-tooltip content="数据权限" placement="top" v-if="scope.row.roleId !== 1 && isAdmin">
|
||||||
<el-button link type="primary" icon="CircleCheck" @click="handleDataScope(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
|
<el-button link type="primary" icon="CircleCheck" @click="handleDataScope(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="分配用户" placement="top" v-if="scope.row.roleId !== 1">
|
<el-tooltip content="分配用户" placement="top" v-if="scope.row.roleId !== 1 && (scope.row.roleId !== 2 && !isAdmin)">
|
||||||
<el-button link type="primary" icon="User" @click="handleAuthUser(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
|
<el-button link type="primary" icon="User" @click="handleAuthUser(scope.row)" v-hasPermi="['system:role:edit']"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
<el-button v-if="scope.row.roleId==1" type="primary" link disabled>不可修改</el-button>
|
||||||
|
<el-button v-if="scope.row.roleId == 2 && !isAdmin" type="danger" link disabled>权限不足</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -183,26 +191,41 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<!-- 添加或修改角色配置对话框 -->
|
<!-- 添加或修改角色配置对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
|
||||||
<el-form ref="roleRef" :model="form" :rules="rules" label-width="100px">
|
<el-form ref="roleRef" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-form-item label="所属单位" prop="deptId" v-if="form.roleId!==2">
|
||||||
|
<el-tree-select
|
||||||
|
v-model="form.deptId"
|
||||||
|
:data="deptFirOptions"
|
||||||
|
:props="{ value: 'id', label: 'label', children: 'children' }"
|
||||||
|
value-key="id"
|
||||||
|
placeholder="请选择所属单位"
|
||||||
|
check-strictly
|
||||||
|
style="width:100%"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="角色名称" prop="roleName">
|
<el-form-item label="角色名称" prop="roleName">
|
||||||
<el-input v-model="form.roleName" placeholder="请输入角色名称" />
|
<el-input v-model="form.roleName" placeholder="请输入角色名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="roleKey">
|
<el-form-item prop="roleKey" label="权限字符" v-if="form.roleId">
|
||||||
<template #label>
|
<!-- <template #label>
|
||||||
<span>
|
<span>
|
||||||
<el-tooltip content="控制器中定义的权限字符,如:@PreAuthorize(`@ss.hasRole('admin')`)" placement="top">
|
<el-tooltip content="控制器中定义的权限字符,如:@PreAuthorize(`@ss.hasRole('admin')`)" placement="top">
|
||||||
<el-icon><question-filled /></el-icon>
|
<el-icon><question-filled /></el-icon>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
权限字符
|
权限字符
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template> -->
|
||||||
<el-input v-model="form.roleKey" placeholder="请输入权限字符" />
|
<el-input v-model="form.roleKey" :disabled="!isAdmin" placeholder="请输入权限字符" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
<el-form-item label="角色顺序" prop="roleSort">
|
<el-form-item label="角色顺序" prop="roleSort">
|
||||||
<el-input-number v-model="form.roleSort" controls-position="right" :min="0" />
|
<el-input-number v-model="form.roleSort" controls-position="right" :min="0" style="width:100%" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态">
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="角色状态">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in sys_normal_disable"
|
v-for="dict in sys_normal_disable"
|
||||||
|
@ -211,6 +234,8 @@
|
||||||
>{{ dict.label }}</el-radio>
|
>{{ dict.label }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
<el-form-item label="菜单权限">
|
<el-form-item label="菜单权限">
|
||||||
<el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>
|
<el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>
|
||||||
<el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox>
|
<el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox>
|
||||||
|
@ -226,9 +251,6 @@
|
||||||
:props="{ label: 'label', children: 'children' }"
|
:props="{ label: 'label', children: 'children' }"
|
||||||
></el-tree>
|
></el-tree>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注">
|
|
||||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
|
@ -299,11 +321,14 @@
|
||||||
import { deptFirTreeSelect } from "@/api/system/user";
|
import { deptFirTreeSelect } from "@/api/system/user";
|
||||||
import { addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updateRole, deptTreeSelect } from "@/api/system/role";
|
import { addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updateRole, deptTreeSelect } from "@/api/system/role";
|
||||||
import { roleMenuTreeselect, treeselect as menuTreeselect } from "@/api/system/menu";
|
import { roleMenuTreeselect, treeselect as menuTreeselect } from "@/api/system/menu";
|
||||||
|
import useUserStore from '@/store/modules/user'
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||||
|
|
||||||
|
const isAdmin = ref(false);
|
||||||
const roleList = ref([]);
|
const roleList = ref([]);
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
@ -491,6 +516,9 @@ function handleUpdate(row) {
|
||||||
const roleId = row.roleId || ids.value;
|
const roleId = row.roleId || ids.value;
|
||||||
const roleMenu = getRoleMenuTreeselect(roleId);
|
const roleMenu = getRoleMenuTreeselect(roleId);
|
||||||
getRole(roleId).then(response => {
|
getRole(roleId).then(response => {
|
||||||
|
if(response.data.roleId!=2){
|
||||||
|
response.data.deptId = response.data.roleDeptList[0].deptId;
|
||||||
|
}
|
||||||
form.value = response.data;
|
form.value = response.data;
|
||||||
form.value.roleSort = Number(form.value.roleSort);
|
form.value.roleSort = Number(form.value.roleSort);
|
||||||
open.value = true;
|
open.value = true;
|
||||||
|
@ -518,6 +546,7 @@ function getRoleMenuTreeselect(roleId) {
|
||||||
function getDeptTree() {
|
function getDeptTree() {
|
||||||
deptFirTreeSelect().then(response => {
|
deptFirTreeSelect().then(response => {
|
||||||
deptFirOptions.value = response.data;
|
deptFirOptions.value = response.data;
|
||||||
|
defaultEK.value.push(response.data[0].id);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
/** 根据角色ID查询部门树结构 */
|
/** 根据角色ID查询部门树结构 */
|
||||||
|
@ -635,6 +664,17 @@ function cancelDataScope() {
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 初始化页面 */
|
||||||
|
function initPage() {
|
||||||
|
let roles = userStore.roles;
|
||||||
|
if(roles.includes("admin")){
|
||||||
|
isAdmin.value = true;
|
||||||
|
}else{
|
||||||
|
isAdmin.value = false;
|
||||||
|
}
|
||||||
|
getDeptTree();
|
||||||
|
}
|
||||||
|
|
||||||
getList();
|
getList();
|
||||||
getDeptTree();
|
initPage();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -26,6 +26,19 @@
|
||||||
<el-table-column type="selection" :reserve-selection="true" width="55" />
|
<el-table-column type="selection" :reserve-selection="true" width="55" />
|
||||||
<el-table-column label="角色编号" align="center" prop="roleId" />
|
<el-table-column label="角色编号" align="center" prop="roleId" />
|
||||||
<el-table-column label="角色名称" align="center" prop="roleName" />
|
<el-table-column label="角色名称" align="center" prop="roleName" />
|
||||||
|
<el-table-column label="所属部门" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<el-tag
|
||||||
|
v-for="item in scope.row.roleDeptList"
|
||||||
|
effect="dark"
|
||||||
|
>
|
||||||
|
{{ item.deptName }}
|
||||||
|
</el-tag>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="权限字符" align="center" prop="roleKey" />
|
<el-table-column label="权限字符" align="center" prop="roleKey" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
@ -62,6 +75,7 @@ const form = ref({
|
||||||
userName: undefined,
|
userName: undefined,
|
||||||
userId: undefined
|
userId: undefined
|
||||||
});
|
});
|
||||||
|
const currentRoleIds = ref([]);
|
||||||
|
|
||||||
/** 单击选中行数据 */
|
/** 单击选中行数据 */
|
||||||
function clickRow(row) {
|
function clickRow(row) {
|
||||||
|
@ -96,11 +110,18 @@ function submitForm() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
getAuthRole(userId).then(response => {
|
getAuthRole(userId).then(response => {
|
||||||
form.value = response.user;
|
form.value = response.user;
|
||||||
|
let rlist = [];
|
||||||
|
if(response.user.roles){
|
||||||
|
response.user.roles.forEach(item => {
|
||||||
|
rlist.push(item.roleId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
currentRoleIds.value = rlist;
|
||||||
roles.value = response.roles;
|
roles.value = response.roles;
|
||||||
total.value = roles.value.length;
|
total.value = roles.value.length;
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
roles.value.forEach(row => {
|
roles.value.forEach(row => {
|
||||||
if (row.flag) {
|
if (currentRoleIds.value.includes(row.roleId)) {
|
||||||
proxy.$refs["roleRef"].toggleRowSelection(row);
|
proxy.$refs["roleRef"].toggleRowSelection(row);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -313,6 +313,7 @@ watch(deptName, val => {
|
||||||
function getDeptTree() {
|
function getDeptTree() {
|
||||||
deptTreeSelect().then(response => {
|
deptTreeSelect().then(response => {
|
||||||
deptOptions.value = response.data;
|
deptOptions.value = response.data;
|
||||||
|
defaultEK.value.push(response.data[0].id);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
/** 查询用户列表 */
|
/** 查询用户列表 */
|
||||||
|
@ -498,7 +499,7 @@ function handleUpdate(row) {
|
||||||
|
|
||||||
/** 根据单位选择角色 */
|
/** 根据单位选择角色 */
|
||||||
function handleChangeDept(value) {
|
function handleChangeDept(value) {
|
||||||
form.roleIds = null;
|
form.value.roleIds = [];
|
||||||
getDeptRole(value).then(response => {
|
getDeptRole(value).then(response => {
|
||||||
roleOptions.value = response.data;
|
roleOptions.value = response.data;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue