Commit 07d3b95b authored by sml's avatar sml

用户及成员代码提交

parent aa80f0d8
......@@ -7,6 +7,9 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.jz.common.utils.web.SessionUtils;
import com.jz.dmp.modules.model.DmpMember;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
......@@ -77,8 +80,12 @@ public class BaseService {
*/
public Integer getHttpRequestUserId(HttpServletRequest httpRequest)throws Exception{
DmpMember dmpMember = SessionUtils.getSecurityUser();
if (dmpMember==null) {
return null;
}
return dmpMember.getUserId();
}
}
package com.jz.common.utils.web;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.jz.dmp.modules.model.DmpMember;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
......@@ -86,19 +90,6 @@ public class SessionUtils {
}*/
/**
* @Title: hasLoginStatus
* @Description: TODO(通用登录态校验)
* @return boolean
*/
/* public static boolean hasLoginStatus() {
try {
return getSessionUserId() != null;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}*/
/**
* @Title: getSecurityUser
......@@ -107,22 +98,34 @@ public class SessionUtils {
* @return DspSystemUser 返回类型
* @throws
*/
/* public static DmpSystemUser getSecurityUser(){
public static DmpMember getSecurityUser(){
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if (principal==null || "anonymousUser".equals(principal)) {
return null;
}
return (DmpSystemUser)principal;
return (DmpMember)principal;
}
public static DmpSystemUser getSecurityDspUser(){
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if (principal==null || "anonymousUser".equals(principal)) {
return null;
/**
* @Title: getAuthentication
* @Description: TODO(获取authentication)
* @param @return 参数
* @return Authentication 返回类型
* @throws
*/
public static Authentication getAuthentication() {
return SecurityContextHolder.getContext().getAuthentication();
}
return (DmpSystemUser)principal;
}*/
/**
* @Title: setAuthentication
* @Description: TODO(设置authentication)
* @param @param authentication 参数
* @return void 返回类型
* @throws
*/
public static void setAuthentication(Authentication authentication) {
SecurityContextHolder.getContext().setAuthentication(authentication);
}
}
package com.jz.dmp.modules.controller;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.constant.StatuConstant;
import com.jz.dmp.modules.controller.bean.DmpProjectDto;
import com.jz.dmp.modules.controller.bean.DmpProjectRequest;
import com.jz.dmp.modules.service.DmpProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 项目信息Controller
* @author ybz
*
*/
@RestController
@RequestMapping("/dmp/project")
@Api(tags = "项目信息")
public class DmpProjectController {
@Autowired
private DmpProjectService dmpProjectService;
/**列表查询项目信息
* @param dmpProjectRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/findList")
@ApiOperation(value = "列表查询项目信息", notes = "列表查询项目信息")
public BaseBeanResponse<DmpProjectDto> findList(@RequestBody DmpProjectRequest dmpProjectRequest, HttpServletRequest httpRequest){
BaseBeanResponse<DmpProjectDto> baseBeanResponse = new BaseBeanResponse<DmpProjectDto>();
try {
baseBeanResponse = dmpProjectService.findList(dmpProjectRequest, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("查询失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
}
package com.jz.dmp.modules.controller.bean;
import java.util.List;
import com.jz.dmp.modules.model.DmpProject;
/**
* @author ybz
*
*/
public class DmpProjectBatch {
private List<DmpProject> dmpProjects;
public List<DmpProject> getDmpProjects() {
return dmpProjects;
}
public void setDmpProjects(List<DmpProject> dmpProjects) {
this.dmpProjects = dmpProjects;
}
}
package com.jz.dmp.modules.controller.bean;
import com.jz.dmp.modules.model.DmpProject;
import io.swagger.annotations.ApiModel;
/**项目信息Dto
* @author ybz
*
*/
@ApiModel(value = "项目信息Dto", description = "项目信息Dto")
public class DmpProjectDto extends DmpProject {
}
package com.jz.dmp.modules.controller.bean;
import java.util.Date;
import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**项目信息参数请求封装
* @author ybz
*
*/
@ApiModel(value = "项目信息参数请求封装", description = "项目信息参数请求封装")
public class DmpProjectRequest extends BasePageBean {
/**
* ID
*/
@ApiModelProperty(value = "ID")
private Integer id;
/**
* 管理员帐号
*/
@ApiModelProperty(value = "管理员帐号")
private String ownerId;
/**
* 生产帐号
*/
@ApiModelProperty(value = "生产帐号")
private String productionId;
/**
* 数据仓库帐号
*/
@ApiModelProperty(value = "数据仓库帐号")
private String dataWarehouseId;
/**
* 项目名称
*/
@ApiModelProperty(value = "项目名称")
private String name;
/**
* 项目显示名称
*/
@ApiModelProperty(value = "项目显示名称")
private String displayName;
/**
* 项目描述
*/
@ApiModelProperty(value = "项目描述")
private String projectDesc;
/**
* 发布目标
*/
@ApiModelProperty(value = "发布目标")
private Integer publishTargetId;
/**
* 启动调度周期
*/
@ApiModelProperty(value = "启动调度周期")
private String isEnableScheduler;
/**
* 允许在本项目中直接编辑任务和代码
*/
@ApiModelProperty(value = "允许在本项目中直接编辑任务和代码")
private String isEditTaskCode;
/**
* 能否下载select结果
*/
@ApiModelProperty(value = "能否下载select结果")
private String isEnableSelect;
/**
* 数据仓库项目名称
*/
@ApiModelProperty(value = "数据仓库项目名称")
private String dwName;
/**
* 数据仓库访问身份类型
*/
@ApiModelProperty(value = "数据仓库访问身份类型")
private String dwAccessType;
/**
* 使用ACL授权
*/
@ApiModelProperty(value = "使用ACL授权")
private String dwIsEnableAcl;
/**
* 允许对象创建者访问对象
*/
@ApiModelProperty(value = "允许对象创建者访问对象")
private String dwIsEnableAccessObj;
/**
* 允许对象创建者授权对象
*/
@ApiModelProperty(value = "允许对象创建者授权对象")
private String dwIsEnableAuthObj;
/**
* 项目空间数据保护
*/
@ApiModelProperty(value = "项目空间数据保护")
private String dwIsProtectData;
/**
* 数据状态
*/
@ApiModelProperty(value = "数据状态")
private String dataStatus;
/**
* 创建用户ID
*/
@ApiModelProperty(value = "创建用户ID")
private String createUserId;
/**
* 数据创建时间起
*/
@ApiModelProperty(value = "数据创建时间起")
private Date createTimeStart;
/**
* 数据创建时间止
*/
@ApiModelProperty(value = "数据创建时间止")
private Date createTimeEnd;
/**
* 创建用户ID
*/
@ApiModelProperty(value = "创建用户ID")
private String updateUserId;
/**
*
*/
@ApiModelProperty(value = "")
private String impalaJdbcUrl;
/**
*
*/
@ApiModelProperty(value = "")
private String impalaMasterFqdn;
/**
* 数据更新时间起
*/
@ApiModelProperty(value = "数据更新时间起")
private Date updateTimeStart;
/**
* 数据更新时间止
*/
@ApiModelProperty(value = "数据更新时间止")
private Date updateTimeEnd;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getOwnerId() {
return ownerId;
}
public void setOwnerId(String ownerId) {
this.ownerId = ownerId;
}
public String getProductionId() {
return productionId;
}
public void setProductionId(String productionId) {
this.productionId = productionId;
}
public String getDataWarehouseId() {
return dataWarehouseId;
}
public void setDataWarehouseId(String dataWarehouseId) {
this.dataWarehouseId = dataWarehouseId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getProjectDesc() {
return projectDesc;
}
public void setProjectDesc(String projectDesc) {
this.projectDesc = projectDesc;
}
public Integer getPublishTargetId() {
return publishTargetId;
}
public void setPublishTargetId(Integer publishTargetId) {
this.publishTargetId = publishTargetId;
}
public String getIsEnableScheduler() {
return isEnableScheduler;
}
public void setIsEnableScheduler(String isEnableScheduler) {
this.isEnableScheduler = isEnableScheduler;
}
public String getIsEditTaskCode() {
return isEditTaskCode;
}
public void setIsEditTaskCode(String isEditTaskCode) {
this.isEditTaskCode = isEditTaskCode;
}
public String getIsEnableSelect() {
return isEnableSelect;
}
public void setIsEnableSelect(String isEnableSelect) {
this.isEnableSelect = isEnableSelect;
}
public String getDwName() {
return dwName;
}
public void setDwName(String dwName) {
this.dwName = dwName;
}
public String getDwAccessType() {
return dwAccessType;
}
public void setDwAccessType(String dwAccessType) {
this.dwAccessType = dwAccessType;
}
public String getDwIsEnableAcl() {
return dwIsEnableAcl;
}
public void setDwIsEnableAcl(String dwIsEnableAcl) {
this.dwIsEnableAcl = dwIsEnableAcl;
}
public String getDwIsEnableAccessObj() {
return dwIsEnableAccessObj;
}
public void setDwIsEnableAccessObj(String dwIsEnableAccessObj) {
this.dwIsEnableAccessObj = dwIsEnableAccessObj;
}
public String getDwIsEnableAuthObj() {
return dwIsEnableAuthObj;
}
public void setDwIsEnableAuthObj(String dwIsEnableAuthObj) {
this.dwIsEnableAuthObj = dwIsEnableAuthObj;
}
public String getDwIsProtectData() {
return dwIsProtectData;
}
public void setDwIsProtectData(String dwIsProtectData) {
this.dwIsProtectData = dwIsProtectData;
}
public String getDataStatus() {
return dataStatus;
}
public void setDataStatus(String dataStatus) {
this.dataStatus = dataStatus;
}
public String getCreateUserId() {
return createUserId;
}
public void setCreateUserId(String createUserId) {
this.createUserId = createUserId;
}
public Date getCreateTimeStart() {
return createTimeStart;
}
public void setCreateTimeStart(Date createTimeStart) {
this.createTimeStart = createTimeStart;
}
public Date getCreateTimeEnd() {
return createTimeEnd;
}
public void setCreateTimeEnd(Date createTimeEnd) {
this.createTimeEnd = createTimeEnd;
}
public String getUpdateUserId() {
return updateUserId;
}
public void setUpdateUserId(String updateUserId) {
this.updateUserId = updateUserId;
}
public String getImpalaJdbcUrl() {
return impalaJdbcUrl;
}
public void setImpalaJdbcUrl(String impalaJdbcUrl) {
this.impalaJdbcUrl = impalaJdbcUrl;
}
public String getImpalaMasterFqdn() {
return impalaMasterFqdn;
}
public void setImpalaMasterFqdn(String impalaMasterFqdn) {
this.impalaMasterFqdn = impalaMasterFqdn;
}
public Date getUpdateTimeStart() {
return updateTimeStart;
}
public void setUpdateTimeStart(Date updateTimeStart) {
this.updateTimeStart = updateTimeStart;
}
public Date getUpdateTimeEnd() {
return updateTimeEnd;
}
public void setUpdateTimeEnd(Date updateTimeEnd) {
this.updateTimeEnd = updateTimeEnd;
}
}
package com.jz.dmp.modules.controller.bean;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.BeanUtils;
import com.jz.dmp.modules.model.DmpProject;
public class MyDmpProjectConverter {
private static MyDmpProjectConverter instance;
private MyDmpProjectConverter() {};
public synchronized static MyDmpProjectConverter INSTANCE() {
if (instance==null) {
instance = new MyDmpProjectConverter();
}
return instance;
}
public DmpProjectDto domain2dto(DmpProject dmpProject) {
DmpProjectDto dmpProjectDto = new DmpProjectDto();
BeanUtils.copyProperties(dmpProject, dmpProjectDto);
return dmpProjectDto;
}
public List<DmpProjectDto> domain2dto(List<DmpProject> dmpProjects) {
List<DmpProjectDto> dmpProjectDtos = new ArrayList<DmpProjectDto>();
dmpProjects.stream().forEach(x -> {
dmpProjectDtos.add(domain2dto(x));
});
return dmpProjectDtos;
}
public DmpProject dto2domain(DmpProjectDto dmpProjectDto) {
DmpProject dmpProject = new DmpProject();
BeanUtils.copyProperties(dmpProjectDto, dmpProject);
return dmpProject;
}
public List<DmpProject> dto2domain(List<DmpProjectDto> dmpProjectDtos) {
List<DmpProject> dmpProjects = new ArrayList<DmpProject>();
dmpProjectDtos.stream().forEach(x -> {
dmpProjects.add(domain2dto(x));
});
return dmpProjects;
}
}
package com.jz.dmp.modules.controller.sys;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.StatuConstant;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberBatch;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberDto;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberRequest;
......@@ -19,6 +23,7 @@ import com.jz.dmp.modules.model.DmpMember;
import com.jz.dmp.modules.service.sys.DmpMemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
/**
......@@ -34,23 +39,42 @@ public class DmpMemberController {
@Autowired
private DmpMemberService dmpMemberService;
/**列表查询用户表
* @param dmpMemberRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/findListWithPage")
@ApiOperation(value = "分頁列表查询用户表", notes = "分頁列表查询用户表")
public BaseBeanResponse<Map<String, Object>> findListWithPage(@RequestBody DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest){
BaseBeanResponse<Map<String, Object>> baseBeanResponse = new BaseBeanResponse<>();
try {
baseBeanResponse = dmpMemberService.findListWithPage(dmpMemberRequest, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("查询失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**列表查询用户表
* @param dmpMemberRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/findList")
@ApiOperation(value = "列表查询用户表", notes = "列表查询用户表")
public PageInfoResponse<DmpMemberDto> findList(@RequestBody DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest){
PageInfoResponse<DmpMemberDto> pageInfo = new PageInfoResponse<DmpMemberDto>();
public BaseBeanResponse<DmpMemberDto> findList(@RequestBody DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest){
BaseBeanResponse<DmpMemberDto> baseBeanResponse = new BaseBeanResponse<DmpMemberDto>();
try {
pageInfo = dmpMemberService.findList(dmpMemberRequest, httpRequest);
baseBeanResponse = dmpMemberService.findList(dmpMemberRequest, httpRequest);
} catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(ResultCode.INTERNAL_SERVER_ERROR.val());
baseBeanResponse.setMessage("查询失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return pageInfo;
return baseBeanResponse;
}
......@@ -58,8 +82,8 @@ public class DmpMemberController {
* @param dmpMemberRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/view")
@ApiOperation(value = "主键查询用户表", notes = "主键查询用户表")
//@RequestMapping(method = RequestMethod.POST, value = "/view")
//@ApiOperation(value = "主键查询用户表", notes = "主键查询用户表")
public BaseBeanResponse<DmpMemberDto> view(@RequestBody DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest){
BaseBeanResponse<DmpMemberDto> baseBeanResponse = new BaseBeanResponse<DmpMemberDto>();
try {
......@@ -77,15 +101,36 @@ public class DmpMemberController {
* @param dmpMemberRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/delete")
@ApiOperation(value = "删除用户表", notes = "删除用户表")
public BaseResponse delete(@RequestBody DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest){
//@RequestMapping(method = RequestMethod.POST, value = "/delete")
//@ApiOperation(value = "删除用户表", notes = "删除用户表")
//@ApiImplicitParam(name = "userId", value = "用户表主键")
public BaseResponse delete(@RequestParam(name = "userId", required = true ) Integer userId, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse();
try {
baseResponse = dmpMemberService.deleteById(dmpMemberRequest, httpRequest);
baseResponse = dmpMemberService.deleteById(userId, httpRequest);
} catch (Exception e) {
baseResponse.setMessage("删除失败");
baseResponse.setCode(ResultCode.INTERNAL_SERVER_ERROR.val());
baseResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseResponse;
}
/**软删除用户表
* @param userId
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/softDelete")
@ApiOperation(value = "软删除用户表", notes = "软删除用户表")
@ApiImplicitParam(name = "userId", value = "用户表主键")
public BaseResponse softDelete(@RequestParam(name = "userId", required = true ) Integer userId, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse();
try {
baseResponse = dmpMemberService.softDeleteById(userId, httpRequest);
} catch (Exception e) {
baseResponse.setMessage("软删除失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
......@@ -115,8 +160,8 @@ public class DmpMemberController {
* @param dmpMemberRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/addBatch")
@ApiOperation(value = "批量新增用户表", notes = "批量新增用户表")
//@RequestMapping(method = RequestMethod.POST, value = "/addBatch")
//@ApiOperation(value = "批量新增用户表", notes = "批量新增用户表")
public BaseBeanResponse<DmpMemberBatch> addBatch(@RequestBody DmpMemberBatch dmpMemberBatch, HttpServletRequest httpRequest){
BaseBeanResponse<DmpMemberBatch> baseBeanResponse = new BaseBeanResponse<DmpMemberBatch>();
try {
......@@ -134,8 +179,8 @@ public class DmpMemberController {
* @param dmpMemberRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/edit")
@ApiOperation(value = "修改用户表", notes = "修改用户表")
//@RequestMapping(method = RequestMethod.POST, value = "/edit")
//@ApiOperation(value = "修改用户表", notes = "修改用户表")
public BaseBeanResponse<DmpMember> edit(@RequestBody DmpMember dmpMember, HttpServletRequest httpRequest){
BaseBeanResponse<DmpMember> baseBeanResponse = new BaseBeanResponse<DmpMember>();
try {
......@@ -149,4 +194,24 @@ public class DmpMemberController {
return baseBeanResponse;
}
/**用户项目切换
* @param dmpMemberRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/switchProj")
@ApiImplicitParam(name = "projectId", value = "项目主键")
@ApiOperation(value = "用户项目切换", notes = "用户项目切换")
public BaseBeanResponse<DmpMember> switchProj(@RequestParam(name = "projectId", required = true) Integer projectId, HttpServletRequest httpRequest){
BaseBeanResponse<DmpMember> baseBeanResponse = new BaseBeanResponse<DmpMember>();
try {
baseBeanResponse = dmpMemberService.switchProj(projectId, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("项目切换失败");
baseBeanResponse.setCode(ResultCode.INTERNAL_SERVER_ERROR.val());
e.printStackTrace();
}
return baseBeanResponse;
}
}
package com.jz.dmp.modules.controller.sys;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.StatuConstant;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberProjectRoleBatch;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberProjectRoleDto;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberProjectRoleRequest;
import com.jz.dmp.modules.controller.sys.bean.MembProjRoleBatchReq;
import com.jz.dmp.modules.model.DmpMemberProjectRole;
import com.jz.dmp.modules.service.sys.DmpMemberProjectRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
/**
* 用户项目角色表Controller
* @author ybz
*
*/
@RestController
@RequestMapping("/dmp/member/project/role")
@Api(tags = "用户项目角色表")
public class DmpMemberProjectRoleController {
@Autowired
private DmpMemberProjectRoleService dmpMemberProjectRoleService;
/**列表查询用户项目角色表
* @param dmpMemberProjectRoleRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/findListWithPage")
//@ApiOperation(value = "分頁列表查询用户项目角色表", notes = "分頁列表查询用户项目角色表")
public PageInfoResponse<DmpMemberProjectRoleDto> findListWithPage(@RequestBody DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest){
PageInfoResponse<DmpMemberProjectRoleDto> pageInfo = new PageInfoResponse<DmpMemberProjectRoleDto>();
try {
pageInfo = dmpMemberProjectRoleService.findListWithPage(dmpMemberProjectRoleRequest, httpRequest);
} catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return pageInfo;
}
/**列表查询用户项目角色表
* @param dmpMemberProjectRoleRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/findList")
//@ApiOperation(value = "列表查询用户项目角色表", notes = "列表查询用户项目角色表")
public BaseBeanResponse<DmpMemberProjectRoleDto> findList(@RequestBody DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest){
BaseBeanResponse<DmpMemberProjectRoleDto> baseBeanResponse = new BaseBeanResponse<DmpMemberProjectRoleDto>();
try {
baseBeanResponse = dmpMemberProjectRoleService.findList(dmpMemberProjectRoleRequest, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("查询失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**主键查询用户项目角色表
* @param dmpMemberProjectRoleRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/view")
//@ApiOperation(value = "主键查询用户项目角色表", notes = "主键查询用户项目角色表")
//@ApiImplicitParam(name = "memberProjectRoleId", value = "用户项目角色表主键")
public BaseBeanResponse<DmpMemberProjectRoleDto> view(@RequestParam(name = "memberProjectRoleId", required = true ) Integer memberProjectRoleId, HttpServletRequest httpRequest){
BaseBeanResponse<DmpMemberProjectRoleDto> baseBeanResponse = new BaseBeanResponse<DmpMemberProjectRoleDto>();
try {
baseBeanResponse = dmpMemberProjectRoleService.findById(memberProjectRoleId, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("请求失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**删除用户项目角色表
* @param memberProjectRoleId
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/delete")
//@ApiOperation(value = "删除用户项目角色表", notes = "删除用户项目角色表")
//@ApiImplicitParam(name = "memberProjectRoleId", value = "用户项目角色表主键")
public BaseResponse delete(@RequestParam(name = "memberProjectRoleId", required = true ) Integer memberProjectRoleId, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse();
try {
baseResponse = dmpMemberProjectRoleService.deleteById(memberProjectRoleId, httpRequest);
} catch (Exception e) {
baseResponse.setMessage("删除失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseResponse;
}
/**软删除用户项目角色表
* @param memberProjectRoleId
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/softDelete")
//@ApiOperation(value = "软删除用户项目角色表", notes = "软删除用户项目角色表")
//@ApiImplicitParam(name = "memberProjectRoleId", value = "用户项目角色表主键")
public BaseResponse softDelete(@RequestParam(name = "memberProjectRoleId", required = true ) Integer memberProjectRoleId, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse();
try {
baseResponse = dmpMemberProjectRoleService.softDeleteById(memberProjectRoleId, httpRequest);
} catch (Exception e) {
baseResponse.setMessage("软删除失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseResponse;
}
/**条件删除用户项目角色表
* @param memberProjectRoleId
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/deleteByPojo")
@ApiOperation(value = "条件删除用户项目角色表", notes = "删除用户项目角色表")
public BaseResponse deleteByPojo(@RequestBody DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse();
try {
baseResponse = dmpMemberProjectRoleService.delete(dmpMemberProjectRoleRequest, httpRequest);
} catch (Exception e) {
baseResponse.setMessage("删除失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseResponse;
}
/**条件软删除用户项目角色表
* @param memberProjectRoleId
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/softDeleteByPojo")
//@ApiOperation(value = "条件软删除用户项目角色表", notes = "条件软删除用户项目角色表")
public BaseResponse softDeleteByPojo(@RequestBody DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse();
try {
baseResponse = dmpMemberProjectRoleService.softDelete(dmpMemberProjectRoleRequest, httpRequest);
} catch (Exception e) {
baseResponse.setMessage("软删除失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseResponse;
}
/**新增用户项目角色表
* @param dmpMemberProjectRoleRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/add")
@ApiOperation(value = "新增用户项目角色表", notes = "新增用户项目角色表")
public BaseBeanResponse<DmpMemberProjectRole> add(@RequestBody DmpMemberProjectRole dmpMemberProjectRole, HttpServletRequest httpRequest){
BaseBeanResponse<DmpMemberProjectRole> baseBeanResponse = new BaseBeanResponse<DmpMemberProjectRole>();
try {
baseBeanResponse = dmpMemberProjectRoleService.add(dmpMemberProjectRole, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("新增失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**批量新增用户项目角色表
* @param dmpMemberProjectRoleRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/addBatch")
//@ApiOperation(value = "批量新增用户项目角色表", notes = "批量新增用户项目角色表")
public BaseBeanResponse<DmpMemberProjectRoleBatch> addBatch(@RequestBody DmpMemberProjectRoleBatch dmpMemberProjectRoleBatch, HttpServletRequest httpRequest){
BaseBeanResponse<DmpMemberProjectRoleBatch> baseBeanResponse = new BaseBeanResponse<DmpMemberProjectRoleBatch>();
try {
baseBeanResponse = dmpMemberProjectRoleService.addBatch(dmpMemberProjectRoleBatch, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("批量新增失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**修改用户项目角色表
* @param dmpMemberProjectRoleRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/edit")
//@ApiOperation(value = "修改用户项目角色表", notes = "修改用户项目角色表")
public BaseBeanResponse<DmpMemberProjectRole> edit(@RequestBody DmpMemberProjectRole dmpMemberProjectRole, HttpServletRequest httpRequest){
BaseBeanResponse<DmpMemberProjectRole> baseBeanResponse = new BaseBeanResponse<DmpMemberProjectRole>();
try {
baseBeanResponse = dmpMemberProjectRoleService.edit(dmpMemberProjectRole, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("修改失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**项目成员添加
* @param dmpMemberProjectRoleRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/addProjMembers")
@ApiOperation(value = "项目成员添加", notes = "项目成员添加")
public BaseBeanResponse<DmpMemberProjectRole> addProjMembers(@RequestBody MembProjRoleBatchReq membProjRoleBatchReq, HttpServletRequest httpRequest){
BaseBeanResponse<DmpMemberProjectRole> baseBeanResponse = new BaseBeanResponse<DmpMemberProjectRole>();
try {
baseBeanResponse = dmpMemberProjectRoleService.addProjMembers(membProjRoleBatchReq, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("批量添加项目成员失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
}
package com.jz.dmp.modules.controller.sys;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.StatuConstant;
import com.jz.dmp.modules.controller.sys.bean.DmpPermissionBatch;
import com.jz.dmp.modules.controller.sys.bean.DmpPermissionDto;
import com.jz.dmp.modules.controller.sys.bean.DmpPermissionRequest;
import com.jz.dmp.modules.model.DmpPermission;
import com.jz.dmp.modules.service.sys.DmpPermissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
/**
* 资源表Controller
* @author ybz
*
*/
@RestController
@RequestMapping("/dmp/permission")
@Api(tags = "资源表")
public class DmpPermissionController {
@Autowired
private DmpPermissionService dmpPermissionService;
/**列表查询资源表
* @param dmpPermissionRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/findList")
//@ApiOperation(value = "列表查询资源表", notes = "列表查询资源表")
public PageInfoResponse<DmpPermissionDto> findList(@RequestBody DmpPermissionRequest dmpPermissionRequest, HttpServletRequest httpRequest){
PageInfoResponse<DmpPermissionDto> pageInfo = new PageInfoResponse<DmpPermissionDto>();
try {
pageInfo = dmpPermissionService.findList(dmpPermissionRequest, httpRequest);
} catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return pageInfo;
}
/**主键查询资源表
* @param dmpPermissionRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/view")
//@ApiOperation(value = "主键查询资源表", notes = "主键查询资源表")
public BaseBeanResponse<DmpPermissionDto> view(@RequestBody DmpPermissionRequest dmpPermissionRequest, HttpServletRequest httpRequest){
BaseBeanResponse<DmpPermissionDto> baseBeanResponse = new BaseBeanResponse<DmpPermissionDto>();
try {
baseBeanResponse = dmpPermissionService.findById(dmpPermissionRequest, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("请求失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**删除资源表
* @param dmpPermissionRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/delete")
//@ApiOperation(value = "删除资源表", notes = "删除资源表")
public BaseResponse delete(@RequestBody DmpPermissionRequest dmpPermissionRequest, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse();
try {
baseResponse = dmpPermissionService.deleteById(dmpPermissionRequest, httpRequest);
} catch (Exception e) {
baseResponse.setMessage("删除失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseResponse;
}
/**新增资源表
* @param dmpPermissionRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/add")
//@ApiOperation(value = "新增资源表", notes = "新增资源表")
public BaseBeanResponse<DmpPermission> add(@RequestBody DmpPermission dmpPermission, HttpServletRequest httpRequest){
BaseBeanResponse<DmpPermission> baseBeanResponse = new BaseBeanResponse<DmpPermission>();
try {
baseBeanResponse = dmpPermissionService.add(dmpPermission, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("新增失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**批量新增资源表
* @param dmpPermissionRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/addBatch")
//@ApiOperation(value = "批量新增资源表", notes = "批量新增资源表")
public BaseBeanResponse<DmpPermissionBatch> addBatch(@RequestBody DmpPermissionBatch dmpPermissionBatch, HttpServletRequest httpRequest){
BaseBeanResponse<DmpPermissionBatch> baseBeanResponse = new BaseBeanResponse<DmpPermissionBatch>();
try {
baseBeanResponse = dmpPermissionService.addBatch(dmpPermissionBatch, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("批量新增失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**修改资源表
* @param dmpPermissionRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/edit")
//@ApiOperation(value = "修改资源表", notes = "修改资源表")
public BaseBeanResponse<DmpPermission> edit(@RequestBody DmpPermission dmpPermission, HttpServletRequest httpRequest){
BaseBeanResponse<DmpPermission> baseBeanResponse = new BaseBeanResponse<DmpPermission>();
try {
baseBeanResponse = dmpPermissionService.edit(dmpPermission, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("修改失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**根据父级资源编码,获取当前登录用户所有资源
* @param dmpPermissionRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/findListByParentCode")
@ApiOperation(value = "获取当前用户指定资源", notes = "根据父级资源编码,获取当前登录用户所有资源")
@ApiImplicitParam(name = "parentCode", value = "父资源编码")
public BaseBeanResponse<DmpPermissionDto> findListByParentCode(@RequestParam(name = "parentCode", required = true) String parentCode, HttpServletRequest httpRequest){
BaseBeanResponse<DmpPermissionDto> baseBeanResponse = new BaseBeanResponse<DmpPermissionDto>();
try {
baseBeanResponse = dmpPermissionService.findListByParentCode(parentCode, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("查询失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
}
package com.jz.dmp.modules.controller.sys;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.StatuConstant;
import com.jz.dmp.modules.controller.sys.bean.DmpRoleBatch;
import com.jz.dmp.modules.controller.sys.bean.DmpRoleDto;
import com.jz.dmp.modules.controller.sys.bean.DmpRoleRequest;
import com.jz.dmp.modules.model.DmpRole;
import com.jz.dmp.modules.service.sys.DmpRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 角色表Controller
* @author ybz
*
*/
@RestController
@RequestMapping("/dmp/role")
@Api(tags = "角色表")
public class DmpRoleController {
@Autowired
private DmpRoleService dmpRoleService;
/**列表查询角色表
* @param dmpRoleRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/findListWithPage")
//@ApiOperation(value = "分頁列表查询角色表", notes = "分頁列表查询角色表")
public PageInfoResponse<DmpRoleDto> findListWithPage(@RequestBody DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest){
PageInfoResponse<DmpRoleDto> pageInfo = new PageInfoResponse<DmpRoleDto>();
try {
pageInfo = dmpRoleService.findListWithPage(dmpRoleRequest, httpRequest);
} catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return pageInfo;
}
/**列表查询角色表
* @param dmpRoleRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/findList")
@ApiOperation(value = "列表查询角色表", notes = "列表查询角色表")
public BaseBeanResponse<DmpRoleDto> findList(@RequestBody DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest){
BaseBeanResponse<DmpRoleDto> baseBeanResponse = new BaseBeanResponse<DmpRoleDto>();
try {
baseBeanResponse = dmpRoleService.findList(dmpRoleRequest, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("查询失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**主键查询角色表
* @param dmpRoleRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/view")
//@ApiOperation(value = "主键查询角色表", notes = "主键查询角色表")
//@ApiImplicitParam(name = "roleId", value = "角色表主键")
public BaseBeanResponse<DmpRoleDto> view(@RequestParam(name = "roleId", required = true ) Integer roleId, HttpServletRequest httpRequest){
BaseBeanResponse<DmpRoleDto> baseBeanResponse = new BaseBeanResponse<DmpRoleDto>();
try {
baseBeanResponse = dmpRoleService.findById(roleId, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("请求失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**删除角色表
* @param roleId
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/delete")
//@ApiOperation(value = "删除角色表", notes = "删除角色表")
//@ApiImplicitParam(name = "roleId", value = "角色表主键")
public BaseResponse delete(@RequestParam(name = "roleId", required = true ) Integer roleId, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse();
try {
baseResponse = dmpRoleService.deleteById(roleId, httpRequest);
} catch (Exception e) {
baseResponse.setMessage("删除失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseResponse;
}
/**软删除角色表
* @param roleId
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/softDelete")
//@ApiOperation(value = "软删除角色表", notes = "软删除角色表")
//@ApiImplicitParam(name = "roleId", value = "角色表主键")
public BaseResponse softDelete(@RequestParam(name = "roleId", required = true ) Integer roleId, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse();
try {
baseResponse = dmpRoleService.softDeleteById(roleId, httpRequest);
} catch (Exception e) {
baseResponse.setMessage("软删除失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseResponse;
}
/**新增角色表
* @param dmpRoleRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/add")
//@ApiOperation(value = "新增角色表", notes = "新增角色表")
public BaseBeanResponse<DmpRole> add(@RequestBody DmpRole dmpRole, HttpServletRequest httpRequest){
BaseBeanResponse<DmpRole> baseBeanResponse = new BaseBeanResponse<DmpRole>();
try {
baseBeanResponse = dmpRoleService.add(dmpRole, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("新增失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**批量新增角色表
* @param dmpRoleRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/addBatch")
//@ApiOperation(value = "批量新增角色表", notes = "批量新增角色表")
public BaseBeanResponse<DmpRoleBatch> addBatch(@RequestBody DmpRoleBatch dmpRoleBatch, HttpServletRequest httpRequest){
BaseBeanResponse<DmpRoleBatch> baseBeanResponse = new BaseBeanResponse<DmpRoleBatch>();
try {
baseBeanResponse = dmpRoleService.addBatch(dmpRoleBatch, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("批量新增失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**修改角色表
* @param dmpRoleRequest
* @return
*/
//@RequestMapping(method = RequestMethod.POST, value = "/edit")
//@ApiOperation(value = "修改角色表", notes = "修改角色表")
public BaseBeanResponse<DmpRole> edit(@RequestBody DmpRole dmpRole, HttpServletRequest httpRequest){
BaseBeanResponse<DmpRole> baseBeanResponse = new BaseBeanResponse<DmpRole>();
try {
baseBeanResponse = dmpRoleService.edit(dmpRole, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("修改失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
}
package com.jz.dmp.modules.controller.sys.bean;
import java.util.List;
import com.jz.dmp.modules.model.DmpMember;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**用户表Dto
* @author ybz
*
*/
@Data
@ApiModel(value = "用户表Dto", description = "用户表Dto")
public class DmpMemberDto extends DmpMember {
@ApiModelProperty(value = "项目角色列表")
private List<String> roles;
}
......@@ -19,12 +19,6 @@ public class DmpMemberRequest extends BasePageBean {
@ApiModelProperty(value = "用户ID")
private Integer userId;
/**
* 登录账号
*/
@ApiModelProperty(value = "登录账号")
private String userAccount;
/**
* 用户名称
*/
......@@ -37,6 +31,12 @@ public class DmpMemberRequest extends BasePageBean {
@ApiModelProperty(value = "登录密码")
private String userPassword;
/**
* 真实姓名
*/
@ApiModelProperty(value = "真实姓名")
private String realName;
/**
* 联系电话
*/
......@@ -121,6 +121,12 @@ public class DmpMemberRequest extends BasePageBean {
@ApiModelProperty(value = "修改时间止")
private Date updateTimeEnd;
@ApiModelProperty(value = "用户项目角色编码")
private String mpRoleCode;
@ApiModelProperty(value = "项目主键")
private Integer projectId;
public Integer getUserId() {
return userId;
}
......@@ -129,14 +135,6 @@ public class DmpMemberRequest extends BasePageBean {
this.userId = userId;
}
public String getUserAccount() {
return userAccount;
}
public void setUserAccount(String userAccount) {
this.userAccount = userAccount;
}
public String getUserName() {
return userName;
}
......@@ -153,6 +151,14 @@ public class DmpMemberRequest extends BasePageBean {
this.userPassword = userPassword;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getUserPhone() {
return userPhone;
}
......@@ -264,4 +270,21 @@ public class DmpMemberRequest extends BasePageBean {
public void setUpdateTimeEnd(Date updateTimeEnd) {
this.updateTimeEnd = updateTimeEnd;
}
public String getMpRoleCode() {
return mpRoleCode;
}
public void setMpRoleCode(String mpRoleCode) {
this.mpRoleCode = mpRoleCode;
}
public Integer getProjectId() {
return projectId;
}
public void setProjectId(Integer projectId) {
this.projectId = projectId;
}
}
package com.jz.dmp.modules.controller.sys.bean;
import java.util.List;
import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**项目成员添加参数请求封装
* @author ybz
*
*/
@ApiModel(value = "项目成员添加参数请求封装", description = "项目成员添加参数请求封装")
public class MembProjRoleBatchReq extends BasePageBean {
/**
* 用户ID
*/
@ApiModelProperty(value = "用户ID")
private List<Integer> userIds;
/**
* 项目ID
*/
@ApiModelProperty(value = "项目ID")
private Integer projectId;
/**
* 角色ID
*/
@ApiModelProperty(value = "角色ID")
private List<Integer> roleIds;
public List<Integer> getUserIds() {
return userIds;
}
public void setUserIds(List<Integer> userIds) {
this.userIds = userIds;
}
public Integer getProjectId() {
return projectId;
}
public void setProjectId(Integer projectId) {
this.projectId = projectId;
}
public List<Integer> getRoleIds() {
return roleIds;
}
public void setRoleIds(List<Integer> roleIds) {
this.roleIds = roleIds;
}
}
......@@ -54,6 +54,13 @@ public interface DmpMemberMapper {
*/
public int deleteByPrimaryKey(Integer dmpMemberId)throws Exception;
/**主键软删除用户表
* @param userId
* @return
* @throws Exception
*/
public int softDeleteByPrimaryKey(Integer userId)throws Exception;
/**条件查询用户表
* @param param
* @return
......
......@@ -3,6 +3,8 @@ package com.jz.dmp.modules.dao.sys;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberProjectRoleDto;
import com.jz.dmp.modules.model.DmpMemberProjectRole;
......@@ -41,18 +43,25 @@ public interface DmpMemberProjectRoleMapper {
public int updateByPrimaryKeySelective(DmpMemberProjectRole dmpMemberProjectRole)throws Exception;
/**主键查询用户项目角色表
* @param dmpMemberProjectRoleId
* @param memberProjectRoleId
* @return
* @throws Exception
*/
public DmpMemberProjectRole selectByPrimaryKey(Integer dmpMemberProjectRoleId)throws Exception;
public DmpMemberProjectRole selectByPrimaryKey(Integer memberProjectRoleId)throws Exception;
/**主键删除用户项目角色表
* @param dmpMemberProjectRoleId
* @param memberProjectRoleId
* @return
* @throws Exception
*/
public int deleteByPrimaryKey(Integer dmpMemberProjectRoleId)throws Exception;
public int deleteByPrimaryKey(Integer memberProjectRoleId)throws Exception;
/**主键软删除用户项目角色表
* @param memberProjectRoleId
* @return
* @throws Exception
*/
public int softDeleteByPrimaryKey(Integer memberProjectRoleId)throws Exception;
/**条件查询用户项目角色表
* @param param
......@@ -62,11 +71,11 @@ public interface DmpMemberProjectRoleMapper {
public List<DmpMemberProjectRoleDto> findList(Map<String, Object> param)throws Exception;
/**主键查询用户项目角色表
* @param dmpMemberProjectRoleId
* @param memberProjectRoleId
* @return
* @throws Exception
*/
public DmpMemberProjectRoleDto findById(Integer dmpMemberProjectRoleId)throws Exception;
public DmpMemberProjectRoleDto findById(Integer memberProjectRoleId)throws Exception;
/**批量新增用户项目角色表
* @param dmpMemberProjectRoles
......@@ -74,4 +83,18 @@ public interface DmpMemberProjectRoleMapper {
*/
public void insertBatch(List<DmpMemberProjectRole> dmpMemberProjectRoles)throws Exception;
/**主键删除用户项目角色表
* @param memberProjectRoleId
* @return
* @throws Exception
*/
public int delete(Map<String, Object> param)throws Exception;
/**主键软删除用户项目角色表
* @param memberProjectRoleId
* @return
* @throws Exception
*/
public int softDelete(Map<String, Object> param)throws Exception;
}
......@@ -56,6 +56,13 @@ public interface DmpRoleMapper {
*/
public int deleteByPrimaryKey(Integer dmpRoleId)throws Exception;
/**主键软删除角色表
* @param roleId
* @return
* @throws Exception
*/
public int softDeleteByPrimaryKey(Integer roleId)throws Exception;
/**条件查询角色表
* @param param
* @return
......@@ -99,4 +106,14 @@ public interface DmpRoleMapper {
*/
public List<DmpRole> findMemberProjRoles(@Param("userId")Integer userId, @Param("projectId")Integer projectId)throws Exception;
/**
* @Title: projRoleStat
* @Description: TODO(项目角色用户统计)
* @param @return
* @param @throws Exception 参数
* @return List<Map<String, Object>> 返回类型
* @throws
*/
public List<Map<String, Object>> projRoleStat()throws Exception;
}
......@@ -3,6 +3,7 @@ package com.jz.dmp.modules.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**用户项目角色表
* @author ybz
......@@ -34,6 +35,36 @@ public class DmpMemberProjectRole {
@ApiModelProperty(value = "角色ID")
private Integer roleId;
/**
* 数据状态(0:删除,1,未删除)
*/
@ApiModelProperty(value = "数据状态(0:删除,1,未删除)")
private String dataStatus;
/**
* 创建用户ID
*/
@ApiModelProperty(value = "创建用户ID")
private Integer createUserId;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 修改用户ID
*/
@ApiModelProperty(value = "修改用户ID")
private Integer updateUserId;
/**
* 修改时间
*/
@ApiModelProperty(value = "修改时间")
private Date updateTime;
public Integer getMemberProjectRoleId() {
return memberProjectRoleId;
}
......@@ -65,4 +96,44 @@ public class DmpMemberProjectRole {
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public String getDataStatus() {
return dataStatus;
}
public void setDataStatus(String dataStatus) {
this.dataStatus = dataStatus;
}
public Integer getCreateUserId() {
return createUserId;
}
public void setCreateUserId(Integer createUserId) {
this.createUserId = createUserId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getUpdateUserId() {
return updateUserId;
}
public void setUpdateUserId(Integer updateUserId) {
this.updateUserId = updateUserId;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
package com.jz.dmp.modules.service;
import javax.servlet.http.HttpServletRequest;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.dmp.modules.controller.bean.DmpProjectBatch;
import com.jz.dmp.modules.controller.bean.DmpProjectDto;
import com.jz.dmp.modules.controller.bean.DmpProjectRequest;
import com.jz.dmp.modules.model.DmpProject;
/**
* 项目信息服务接口
* @author ybz
*
*/
public interface DmpProjectService {
/**条件查询所有项目信息
* @param dmpProjectRequest
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DmpProjectDto> findList(DmpProjectRequest dmpProjectRequest, HttpServletRequest httpRequest)throws Exception;
}
package com.jz.dmp.modules.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.constant.StatuConstant;
import com.jz.common.persistence.BaseService;
import com.jz.dmp.modules.controller.bean.DmpProjectDto;
import com.jz.dmp.modules.controller.bean.DmpProjectRequest;
import com.jz.dmp.modules.controller.bean.MyDmpProjectConverter;
import com.jz.dmp.modules.dao.DmpProjectDao;
import com.jz.dmp.modules.model.DmpProject;
import com.jz.dmp.modules.service.DmpProjectService;
/**
* 项目信息服务的实现?
* @author ybz
*
*/
@Service("dmpProjectService")
public class DmpProjectServiceImpl extends BaseService implements DmpProjectService {
private static Logger logger = LoggerFactory.getLogger(DmpProjectServiceImpl.class);
@Autowired
private DmpProjectDao dmpProjectDao;
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpProjectService#findList(com.ycxc.vmts.controller.bean.DmpProjectRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public BaseBeanResponse<DmpProjectDto> findList(DmpProjectRequest dmpProjectRequest, HttpServletRequest httpRequest)
throws Exception {
BaseBeanResponse<DmpProjectDto> baseBeanResponse = new BaseBeanResponse<>();
Map<String, Object> param = new HashMap<>();
//ID
if (dmpProjectRequest.getId() != null) {
param.put("id", dmpProjectRequest.getId());
}
//管理员帐号
if (!StringUtils.isEmpty(dmpProjectRequest.getOwnerId())) {
param.put("ownerId", dmpProjectRequest.getOwnerId());
}
//生产帐号
if (!StringUtils.isEmpty(dmpProjectRequest.getProductionId())) {
param.put("productionId", dmpProjectRequest.getProductionId());
}
//数据仓库帐号
if (!StringUtils.isEmpty(dmpProjectRequest.getDataWarehouseId())) {
param.put("dataWarehouseId", dmpProjectRequest.getDataWarehouseId());
}
//项目名称
if (!StringUtils.isEmpty(dmpProjectRequest.getName())) {
param.put("name", dmpProjectRequest.getName());
}
//项目显示名称
if (!StringUtils.isEmpty(dmpProjectRequest.getDisplayName())) {
param.put("displayName", dmpProjectRequest.getDisplayName());
}
//项目描述
if (!StringUtils.isEmpty(dmpProjectRequest.getProjectDesc())) {
param.put("projectDesc", dmpProjectRequest.getProjectDesc());
}
//发布目标
if (dmpProjectRequest.getPublishTargetId() != null) {
param.put("publishTargetId", dmpProjectRequest.getPublishTargetId());
}
//启动调度周期
if (!StringUtils.isEmpty(dmpProjectRequest.getIsEnableScheduler())) {
param.put("isEnableScheduler", dmpProjectRequest.getIsEnableScheduler());
}
//允许在本项目中直接编辑任务和代码
if (!StringUtils.isEmpty(dmpProjectRequest.getIsEditTaskCode())) {
param.put("isEditTaskCode", dmpProjectRequest.getIsEditTaskCode());
}
//能否下载select结果
if (!StringUtils.isEmpty(dmpProjectRequest.getIsEnableSelect())) {
param.put("isEnableSelect", dmpProjectRequest.getIsEnableSelect());
}
//数据仓库项目名称
if (!StringUtils.isEmpty(dmpProjectRequest.getDwName())) {
param.put("dwName", dmpProjectRequest.getDwName());
}
//数据仓库访问身份类型
if (!StringUtils.isEmpty(dmpProjectRequest.getDwAccessType())) {
param.put("dwAccessType", dmpProjectRequest.getDwAccessType());
}
//使用ACL授权
if (!StringUtils.isEmpty(dmpProjectRequest.getDwIsEnableAcl())) {
param.put("dwIsEnableAcl", dmpProjectRequest.getDwIsEnableAcl());
}
//允许对象创建者访问对象
if (!StringUtils.isEmpty(dmpProjectRequest.getDwIsEnableAccessObj())) {
param.put("dwIsEnableAccessObj", dmpProjectRequest.getDwIsEnableAccessObj());
}
//允许对象创建者授权对象
if (!StringUtils.isEmpty(dmpProjectRequest.getDwIsEnableAuthObj())) {
param.put("dwIsEnableAuthObj", dmpProjectRequest.getDwIsEnableAuthObj());
}
//项目空间数据保护
if (!StringUtils.isEmpty(dmpProjectRequest.getDwIsProtectData())) {
param.put("dwIsProtectData", dmpProjectRequest.getDwIsProtectData());
}
//数据状态
if (!StringUtils.isEmpty(dmpProjectRequest.getDataStatus())) {
param.put("dataStatus", dmpProjectRequest.getDataStatus());
}
//创建用户ID
if (!StringUtils.isEmpty(dmpProjectRequest.getCreateUserId())) {
param.put("createUserId", dmpProjectRequest.getCreateUserId());
}
//数据创建时间起
if (dmpProjectRequest.getCreateTimeStart() != null) {
param.put("createTimeStart", dmpProjectRequest.getCreateTimeStart());
}
//数据创建时间止
if (dmpProjectRequest.getCreateTimeEnd() != null) {
param.put("createTimeEnd", dmpProjectRequest.getCreateTimeEnd());
}
//创建用户ID
if (!StringUtils.isEmpty(dmpProjectRequest.getUpdateUserId())) {
param.put("updateUserId", dmpProjectRequest.getUpdateUserId());
}
//
if (!StringUtils.isEmpty(dmpProjectRequest.getImpalaJdbcUrl())) {
param.put("impalaJdbcUrl", dmpProjectRequest.getImpalaJdbcUrl());
}
//
if (!StringUtils.isEmpty(dmpProjectRequest.getImpalaMasterFqdn())) {
param.put("impalaMasterFqdn", dmpProjectRequest.getImpalaMasterFqdn());
}
//数据更新时间起
if (dmpProjectRequest.getUpdateTimeStart() != null) {
param.put("updateTimeStart", dmpProjectRequest.getUpdateTimeStart());
}
//数据更新时间止
if (dmpProjectRequest.getUpdateTimeEnd() != null) {
param.put("updateTimeEnd", dmpProjectRequest.getUpdateTimeEnd());
}
List<DmpProject> dmpProjects = dmpProjectDao.getExampleQuery(param);
List<DmpProjectDto> list = MyDmpProjectConverter.INSTANCE().domain2dto(dmpProjects);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功");
baseBeanResponse.setDatas(list);
return baseBeanResponse;
}
}
......@@ -8,6 +8,7 @@ import com.jz.common.bean.PageInfoResponse;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberProjectRoleBatch;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberProjectRoleDto;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberProjectRoleRequest;
import com.jz.dmp.modules.controller.sys.bean.MembProjRoleBatchReq;
import com.jz.dmp.modules.model.DmpMemberProjectRole;
/**
......@@ -17,13 +18,22 @@ import com.jz.dmp.modules.model.DmpMemberProjectRole;
*/
public interface DmpMemberProjectRoleService {
/**条件分頁查询所有用户项目角色表
* @param dmpMemberProjectRoleRequest
* @param httpRequest
* @return
* @throws Exception
*/
public PageInfoResponse<DmpMemberProjectRoleDto> findListWithPage(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)throws Exception;
/**条件查询所有用户项目角色表
* @param dmpMemberProjectRoleRequest
* @param httpRequest
* @return
* @throws Exception
*/
public PageInfoResponse<DmpMemberProjectRoleDto> findList(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)throws Exception;
public BaseBeanResponse<DmpMemberProjectRoleDto> findList(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)throws Exception;
/**新增用户项目角色表
......@@ -35,12 +45,12 @@ public interface DmpMemberProjectRoleService {
public BaseBeanResponse<DmpMemberProjectRole> add(DmpMemberProjectRole dmpMemberProjectRole, HttpServletRequest httpRequest)throws Exception;
/**主键查询用户项目角色表
* @param dmpMemberProjectRoleRequest
* @param memberProjectRoleId
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DmpMemberProjectRoleDto> findById(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)throws Exception;
public BaseBeanResponse<DmpMemberProjectRoleDto> findById(Integer memberProjectRoleId, HttpServletRequest httpRequest)throws Exception;
/**修改用户项目角色表
* @param dmpMemberProjectRole
......@@ -51,12 +61,20 @@ public interface DmpMemberProjectRoleService {
public BaseBeanResponse<DmpMemberProjectRole> edit(DmpMemberProjectRole dmpMemberProjectRole, HttpServletRequest httpRequest)throws Exception;
/**主键删除用户项目角色表
* @param dmpMemberProjectRoleRequest
* @param memberProjectRoleId
* @param httpRequest
* @return
* @throws Exception
*/
public BaseResponse deleteById(Integer memberProjectRoleId, HttpServletRequest httpRequest)throws Exception;
/**主键软删除用户项目角色表
* @param memberProjectRoleId
* @param httpRequest
* @return
* @throws Exception
*/
public BaseResponse deleteById(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)throws Exception;
public BaseResponse softDeleteById(Integer memberProjectRoleId, HttpServletRequest httpRequest)throws Exception;
/**批量新增用户项目角色表
* @param dmpMemberProjectRoleVo
......@@ -66,4 +84,33 @@ public interface DmpMemberProjectRoleService {
*/
public BaseBeanResponse<DmpMemberProjectRoleBatch> addBatch(DmpMemberProjectRoleBatch dmpMemberProjectRoleBatch, HttpServletRequest httpRequest)throws Exception;
/**
* @Title: addProjMembers
* @Description: TODO(批量新增项目成员)
* @param @param membProjRoleBatchReq
* @param @param httpRequest
* @param @return
* @param @throws Exception 参数
* @return BaseBeanResponse<DmpMemberProjectRole> 返回类型
* @throws
*/
public BaseBeanResponse<DmpMemberProjectRole> addProjMembers(MembProjRoleBatchReq membProjRoleBatchReq,
HttpServletRequest httpRequest)throws Exception;
/**条件删除用户项目角色表
* @param dmpMemberProjectRoleRequest
* @param httpRequest
* @return
* @throws Exception
*/
public BaseResponse delete(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)throws Exception;
/**条件软删除用户项目角色表
* @param dmpMemberProjectRoleRequest
* @param httpRequest
* @return
* @throws Exception
*/
public BaseResponse softDelete(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)throws Exception;
}
package com.jz.dmp.modules.service.sys;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.jz.common.bean.BaseBeanResponse;
......@@ -17,14 +19,21 @@ import com.jz.dmp.modules.model.DmpMember;
*/
public interface DmpMemberService {
/**条件查询所有用户表
/**条件分頁查询所有用户表
* @param dmpMemberRequest
* @param httpRequest
* @return
* @throws Exception
*/
public PageInfoResponse<DmpMemberDto> findList(DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest)throws Exception;
public BaseBeanResponse<Map<String, Object>> findListWithPage(DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest)throws Exception;
/**条件查询所有用户表
* @param dmpMemberRequest
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DmpMemberDto> findList(DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest)throws Exception;
/**新增用户表
* @param dmpMember
......@@ -51,12 +60,21 @@ public interface DmpMemberService {
public BaseBeanResponse<DmpMember> edit(DmpMember dmpMember, HttpServletRequest httpRequest)throws Exception;
/**主键删除用户表
* @param dmpMemberRequest
* @param userId
* @param httpRequest
* @return
* @throws Exception
*/
public BaseResponse deleteById(Integer userId, HttpServletRequest httpRequest)throws Exception;
/**主键软删除用户表
* @param userId
* @param httpRequest
* @return
* @throws Exception
*/
public BaseResponse deleteById(DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest)throws Exception;
public BaseResponse softDeleteById(Integer userId, HttpServletRequest httpRequest)throws Exception;
/**批量新增用户表
* @param dmpMemberVo
......@@ -89,4 +107,17 @@ public interface DmpMemberService {
*/
public Integer getDefProjectByUserName(String username);
/**
* @Title: switchProj
* @Description: TODO(用户项目切换)
* @param @param projectId
* @param @param httpRequest
* @param @return
* @param @throws Exception 参数
* @return BaseBeanResponse<DmpMember> 返回类型
* @throws
*/
public BaseBeanResponse<DmpMember> switchProj(Integer projectId, HttpServletRequest httpRequest)throws Exception;
}
......@@ -89,4 +89,18 @@ public interface DmpPermissionService {
*/
public List<DmpPermission> findAllList();
/**
* @Title: findListByParentCode
* @Description: TODO(根据父编码)
* @param @param parentCode
* @param @param httpRequest
* @param @return
* @param @throws Exception 参数
* @return BaseBeanResponse<DmpPermissionDto> 返回类型
* @throws
*/
public BaseBeanResponse<DmpPermissionDto> findListByParentCode(String parentCode,
HttpServletRequest httpRequest)throws Exception;
}
package com.jz.dmp.modules.service.sys;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
......@@ -20,14 +21,21 @@ import com.jz.dmp.modules.model.DmpRole;
*/
public interface DmpRoleService {
/**条件查询所有角色表
/**条件分頁查询所有角色表
* @param dmpRoleRequest
* @param httpRequest
* @return
* @throws Exception
*/
public PageInfoResponse<DmpRoleDto> findList(DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest)throws Exception;
public PageInfoResponse<DmpRoleDto> findListWithPage(DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest)throws Exception;
/**条件查询所有角色表
* @param dmpRoleRequest
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DmpRoleDto> findList(DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest)throws Exception;
/**新增角色表
* @param dmpRole
......@@ -38,12 +46,12 @@ public interface DmpRoleService {
public BaseBeanResponse<DmpRole> add(DmpRole dmpRole, HttpServletRequest httpRequest)throws Exception;
/**主键查询角色表
* @param dmpRoleRequest
* @param roleId
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DmpRoleDto> findById(DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest)throws Exception;
public BaseBeanResponse<DmpRoleDto> findById(Integer roleId, HttpServletRequest httpRequest)throws Exception;
/**修改角色表
* @param dmpRole
......@@ -54,12 +62,20 @@ public interface DmpRoleService {
public BaseBeanResponse<DmpRole> edit(DmpRole dmpRole, HttpServletRequest httpRequest)throws Exception;
/**主键删除角色表
* @param dmpRoleRequest
* @param roleId
* @param httpRequest
* @return
* @throws Exception
*/
public BaseResponse deleteById(DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest)throws Exception;
public BaseResponse deleteById(Integer roleId, HttpServletRequest httpRequest)throws Exception;
/**主键软删除角色表
* @param roleId
* @param httpRequest
* @return
* @throws Exception
*/
public BaseResponse softDeleteById(Integer roleId, HttpServletRequest httpRequest)throws Exception;
/**批量新增角色表
* @param dmpRoleVo
......@@ -91,4 +107,5 @@ public interface DmpRoleService {
*/
public List<DmpRole> findMemberProjRolesByUser(DmpMember user);
}
package com.jz.dmp.modules.service.sys.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -14,18 +15,19 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.StatuConstant;
import com.jz.common.persistence.BaseService;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberProjectRoleBatch;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberProjectRoleDto;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberProjectRoleRequest;
import com.jz.dmp.modules.controller.sys.bean.MembProjRoleBatchReq;
import com.jz.dmp.modules.dao.sys.DmpMemberProjectRoleMapper;
import com.jz.dmp.modules.model.DmpMemberProjectRole;
import com.jz.dmp.modules.service.sys.DmpMemberProjectRoleService;
......@@ -47,7 +49,7 @@ public class DmpMemberProjectRoleServiceImpl extends BaseService implements DmpM
* @see com.ycxc.vmts.service.DmpMemberProjectRoleService#findList(com.ycxc.vmts.controller.bean.DmpMemberProjectRoleRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public PageInfoResponse<DmpMemberProjectRoleDto> findList(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)
public PageInfoResponse<DmpMemberProjectRoleDto> findListWithPage(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)
throws Exception {
PageInfoResponse<DmpMemberProjectRoleDto> pageInfoResponse = new PageInfoResponse<>();
......@@ -73,12 +75,46 @@ public class DmpMemberProjectRoleServiceImpl extends BaseService implements DmpM
List<DmpMemberProjectRoleDto> list = dmpMemberProjectRoleMapper.findList(param);
PageInfo<DmpMemberProjectRoleDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(ResultCode.SUCCESS.val());
pageInfoResponse.setCode(StatuConstant.SUCCESS_CODE);
pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpMemberProjectRoleService#findList(com.ycxc.vmts.controller.bean.DmpMemberProjectRoleRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public BaseBeanResponse<DmpMemberProjectRoleDto> findList(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)
throws Exception {
BaseBeanResponse<DmpMemberProjectRoleDto> baseBeanResponse = new BaseBeanResponse<>();
Map<String, Object> param = new HashMap<>();
//主键
if (dmpMemberProjectRoleRequest.getMemberProjectRoleId() != null) {
param.put("memberProjectRoleId", dmpMemberProjectRoleRequest.getMemberProjectRoleId());
}
//用户ID
if (dmpMemberProjectRoleRequest.getUserId() != null) {
param.put("userId", dmpMemberProjectRoleRequest.getUserId());
}
//项目ID
if (dmpMemberProjectRoleRequest.getProjectId() != null) {
param.put("projectId", dmpMemberProjectRoleRequest.getProjectId());
}
//角色ID
if (dmpMemberProjectRoleRequest.getRoleId() != null) {
param.put("roleId", dmpMemberProjectRoleRequest.getRoleId());
}
List<DmpMemberProjectRoleDto> list = dmpMemberProjectRoleMapper.findList(param);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功");
baseBeanResponse.setDatas(list);
return baseBeanResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpMemberProjectRoleService#add(com.ycxc.vmts.entity.DmpMemberProjectRole, javax.servlet.http.HttpServletRequest)
......@@ -88,9 +124,15 @@ public class DmpMemberProjectRoleServiceImpl extends BaseService implements DmpM
public BaseBeanResponse<DmpMemberProjectRole> add(DmpMemberProjectRole dmpMemberProjectRole, HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DmpMemberProjectRole> baseBeanResponse = new BaseBeanResponse<>();
/*$*setMemberProjectRoleIdCodeReplace*$*/
//创建人
dmpMemberProjectRole.setCreateUserId(getHttpRequestUserId(httpRequest));
//创建时间
dmpMemberProjectRole.setCreateTime(new Date());
dmpMemberProjectRoleMapper.insertSelective(dmpMemberProjectRole);
baseBeanResponse.setCode(ResultCode.SUCCESS.val());
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("新增成功");
baseBeanResponse.setData(dmpMemberProjectRole);
......@@ -105,9 +147,14 @@ public class DmpMemberProjectRoleServiceImpl extends BaseService implements DmpM
public BaseBeanResponse<DmpMemberProjectRole> edit(DmpMemberProjectRole dmpMemberProjectRole, HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DmpMemberProjectRole> baseBeanResponse = new BaseBeanResponse<>();
//修改人
dmpMemberProjectRole.setUpdateUserId(getHttpRequestUserId(httpRequest));
//修改时间
dmpMemberProjectRole.setUpdateTime(new Date());
dmpMemberProjectRoleMapper.updateByPrimaryKeySelective(dmpMemberProjectRole);
baseBeanResponse.setCode(ResultCode.SUCCESS.val());
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("修改成功");
baseBeanResponse.setData(dmpMemberProjectRole);
......@@ -118,13 +165,13 @@ public class DmpMemberProjectRoleServiceImpl extends BaseService implements DmpM
* @see com.ycxc.vmts.service.DmpMemberProjectRoleService#findById(com.ycxc.vmts.controller.bean.DmpMemberProjectRoleRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public BaseBeanResponse<DmpMemberProjectRoleDto> findById(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)
public BaseBeanResponse<DmpMemberProjectRoleDto> findById(Integer memberProjectRoleId, HttpServletRequest httpRequest)
throws Exception {
BaseBeanResponse<DmpMemberProjectRoleDto> baseBeanResponse = new BaseBeanResponse<>();
DmpMemberProjectRoleDto dmpMemberProjectRoleDto = dmpMemberProjectRoleMapper.findById(dmpMemberProjectRoleRequest.getMemberProjectRoleId());
DmpMemberProjectRoleDto dmpMemberProjectRoleDto = dmpMemberProjectRoleMapper.findById(memberProjectRoleId);
baseBeanResponse.setCode(ResultCode.SUCCESS.val());
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功");
baseBeanResponse.setData(dmpMemberProjectRoleDto);
......@@ -136,18 +183,105 @@ public class DmpMemberProjectRoleServiceImpl extends BaseService implements DmpM
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseResponse deleteById(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)
public BaseResponse deleteById(Integer memberProjectRoleId, HttpServletRequest httpRequest)
throws Exception {
BaseResponse baseResponse = new BaseResponse();
dmpMemberProjectRoleMapper.deleteByPrimaryKey(dmpMemberProjectRoleRequest.getMemberProjectRoleId());
dmpMemberProjectRoleMapper.deleteByPrimaryKey(memberProjectRoleId);
baseResponse.setCode(ResultCode.SUCCESS.val());
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("删除成功");
return baseResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpMemberProjectRoleService#deleteById(com.ycxc.vmts.controller.bean.DmpMemberProjectRoleRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseResponse softDeleteById(Integer memberProjectRoleId, HttpServletRequest httpRequest)
throws Exception {
BaseResponse baseResponse = new BaseResponse();
dmpMemberProjectRoleMapper.softDeleteByPrimaryKey(memberProjectRoleId);
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("软删除成功");
return baseResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpMemberProjectRoleService#deleteById(com.ycxc.vmts.controller.bean.DmpMemberProjectRoleRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseResponse delete(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)
throws Exception {
BaseResponse baseResponse = new BaseResponse();
Map<String, Object> param = new HashMap<>();
//主键
if (dmpMemberProjectRoleRequest.getMemberProjectRoleId() != null) {
param.put("memberProjectRoleId", dmpMemberProjectRoleRequest.getMemberProjectRoleId());
}
//用户ID
if (dmpMemberProjectRoleRequest.getUserId() != null) {
param.put("userId", dmpMemberProjectRoleRequest.getUserId());
}
//项目ID
if (dmpMemberProjectRoleRequest.getProjectId() != null) {
param.put("projectId", dmpMemberProjectRoleRequest.getProjectId());
}
//角色ID
if (dmpMemberProjectRoleRequest.getRoleId() != null) {
param.put("roleId", dmpMemberProjectRoleRequest.getRoleId());
}
dmpMemberProjectRoleMapper.delete(param);
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("删除成功");
return baseResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpMemberProjectRoleService#deleteById(com.ycxc.vmts.controller.bean.DmpMemberProjectRoleRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseResponse softDelete(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)
throws Exception {
BaseResponse baseResponse = new BaseResponse();
Map<String, Object> param = new HashMap<>();
//主键
if (dmpMemberProjectRoleRequest.getMemberProjectRoleId() != null) {
param.put("memberProjectRoleId", dmpMemberProjectRoleRequest.getMemberProjectRoleId());
}
//用户ID
if (dmpMemberProjectRoleRequest.getUserId() != null) {
param.put("userId", dmpMemberProjectRoleRequest.getUserId());
}
//项目ID
if (dmpMemberProjectRoleRequest.getProjectId() != null) {
param.put("projectId", dmpMemberProjectRoleRequest.getProjectId());
}
//角色ID
if (dmpMemberProjectRoleRequest.getRoleId() != null) {
param.put("roleId", dmpMemberProjectRoleRequest.getRoleId());
}
dmpMemberProjectRoleMapper.softDelete(param);
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("软删除成功");
return baseResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpMemberProjectRoleService#addBatch(com.ycxc.vmts.controller.bean.DmpMemberProjectRoleVo, javax.servlet.http.HttpServletRequest)
*/
......@@ -159,22 +293,101 @@ public class DmpMemberProjectRoleServiceImpl extends BaseService implements DmpM
List<DmpMemberProjectRole> dmpMemberProjectRoles = dmpMemberProjectRoleBatch.getDmpMemberProjectRoles();
if (CollectionUtils.isEmpty(dmpMemberProjectRoles)) {
baseBeanResponse.setCode(ResultCode.PARAMS_ERROR.val());
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
baseBeanResponse.setMessage("数据不能为空!");
return baseBeanResponse;
}
dmpMemberProjectRoles = dmpMemberProjectRoles.stream().map(dmpMemberProjectRole -> {
/*$*setMemberProjectRoleIdCodeReplace*$*/
//创建人
try {
dmpMemberProjectRole.setCreateUserId(getHttpRequestUserId(httpRequest));
} catch (Exception e) {
logger.info(e.getMessage());
e.printStackTrace();
}
//创建时间
dmpMemberProjectRole.setCreateTime(new Date());
return dmpMemberProjectRole;
}).collect(Collectors.toList());
dmpMemberProjectRoleMapper.insertBatch(dmpMemberProjectRoles);
baseBeanResponse.setCode(ResultCode.SUCCESS.val());
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("批量新增成功");
baseBeanResponse.setData(dmpMemberProjectRoleBatch);
return baseBeanResponse;
}
/**
*批量新增项目成员
*/
@Override
@Transactional(rollbackFor = Exception.class)
public BaseBeanResponse<DmpMemberProjectRole> addProjMembers(MembProjRoleBatchReq membProjRoleBatchReq,
HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DmpMemberProjectRole> baseBeanResponse = new BaseBeanResponse<DmpMemberProjectRole>();
//判断用户是否为空
if (CollectionUtils.isEmpty(membProjRoleBatchReq.getUserIds())) {
baseBeanResponse.setCode(StatuConstant.CODE_ERROR_PARAMETER);
baseBeanResponse.setMessage("用户ID不能为空!");
return baseBeanResponse;
}
//判断项目ID是否为空
if (StringUtils.isEmpty(membProjRoleBatchReq.getProjectId())) {
baseBeanResponse.setCode(StatuConstant.CODE_ERROR_PARAMETER);
baseBeanResponse.setMessage("项目不能为空!");
return baseBeanResponse;
}
//判断角色是否为空
if (CollectionUtils.isEmpty(membProjRoleBatchReq.getRoleIds())) {
baseBeanResponse.setCode(StatuConstant.CODE_ERROR_PARAMETER);
baseBeanResponse.setMessage("项目角色不能为空!");
return baseBeanResponse;
}
List<Integer> userIds = membProjRoleBatchReq.getUserIds();
List<Integer> roleIds = membProjRoleBatchReq.getRoleIds();
Integer projectId = membProjRoleBatchReq.getProjectId();
List<DmpMemberProjectRole> dmpMemberProjectRoles = new ArrayList<DmpMemberProjectRole>();
for (Integer userId : userIds) {
for (Integer roleId : roleIds) {
DmpMemberProjectRole dmpMemberProjectRole = new DmpMemberProjectRole();
dmpMemberProjectRole.setUserId(userId);
dmpMemberProjectRole.setProjectId(projectId);
dmpMemberProjectRole.setRoleId(roleId);
dmpMemberProjectRoles.add(dmpMemberProjectRole);
}
}
dmpMemberProjectRoles = dmpMemberProjectRoles.stream().map(dmpMemberProjectRole -> {
/*$*setMemberProjectRoleIdCodeReplace*$*/
//创建人
try {
dmpMemberProjectRole.setCreateUserId(getHttpRequestUserId(httpRequest));
} catch (Exception e) {
logger.info(e.getMessage());
e.printStackTrace();
}
//创建时间
dmpMemberProjectRole.setCreateTime(new Date());
return dmpMemberProjectRole;
}).collect(Collectors.toList());
for (DmpMemberProjectRole dmpMemberProjectRole : dmpMemberProjectRoles) {
dmpMemberProjectRoleMapper.insertSelective(dmpMemberProjectRole);
}
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("批量新增成功");
return baseBeanResponse;
}
}
package com.jz.dmp.modules.service.sys.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -11,6 +12,9 @@ import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
......@@ -22,15 +26,22 @@ import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.StatuConstant;
import com.jz.common.persistence.BaseService;
import com.jz.common.utils.web.SessionUtils;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberBatch;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberDto;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberRequest;
import com.jz.dmp.modules.dao.DmpProjectDao;
import com.jz.dmp.modules.dao.sys.DmpMemberMapper;
import com.jz.dmp.modules.dao.sys.DmpRoleMapper;
import com.jz.dmp.modules.model.DmpMember;
import com.jz.dmp.modules.model.DmpPermission;
import com.jz.dmp.modules.model.DmpProject;
import com.jz.dmp.modules.model.DmpRole;
import com.jz.dmp.modules.service.sys.DmpMemberService;
import com.jz.dmp.modules.service.sys.DmpPermissionService;
import com.jz.dmp.modules.service.sys.DmpRoleService;
/**
* 用户表服务的实现?
......@@ -45,26 +56,31 @@ public class DmpMemberServiceImpl extends BaseService implements DmpMemberServic
@Autowired
private DmpMemberMapper dmpMemberMapper;
@Autowired
private DmpRoleMapper dmpRoleMapper;
@Autowired
private DmpProjectDao dmpProjectDao;
@Autowired
private DmpRoleService dmpRoleService;
@Autowired
private DmpPermissionService dmpPermissionService;
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpMemberService#findList(com.ycxc.vmts.controller.bean.DmpMemberRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public PageInfoResponse<DmpMemberDto> findList(DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest)
public BaseBeanResponse<Map<String, Object>> findListWithPage(DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest)
throws Exception {
PageInfoResponse<DmpMemberDto> pageInfoResponse = new PageInfoResponse<>();
BaseBeanResponse<Map<String, Object>> baseBeanResponse = new BaseBeanResponse<>();
Map<String, Object> param = new HashMap<>();
//用户ID
if (dmpMemberRequest.getUserId() != null) {
param.put("userId", dmpMemberRequest.getUserId());
}
//登录账号
if (!StringUtils.isEmpty(dmpMemberRequest.getUserAccount())) {
param.put("userAccount", dmpMemberRequest.getUserAccount());
}
//用户名称
if (!StringUtils.isEmpty(dmpMemberRequest.getUserName())) {
param.put("userName", dmpMemberRequest.getUserName());
......@@ -73,6 +89,10 @@ public class DmpMemberServiceImpl extends BaseService implements DmpMemberServic
if (!StringUtils.isEmpty(dmpMemberRequest.getUserPassword())) {
param.put("userPassword", dmpMemberRequest.getUserPassword());
}
//真实姓名
if (!StringUtils.isEmpty(dmpMemberRequest.getRealName())) {
param.put("realName", dmpMemberRequest.getRealName());
}
//联系电话
if (!StringUtils.isEmpty(dmpMemberRequest.getUserPhone())) {
param.put("userPhone", dmpMemberRequest.getUserPhone());
......@@ -129,15 +149,121 @@ public class DmpMemberServiceImpl extends BaseService implements DmpMemberServic
if (dmpMemberRequest.getUpdateTimeEnd() != null) {
param.put("updateTimeEnd", dmpMemberRequest.getUpdateTimeEnd());
}
//用户项目角色编码
if (!StringUtils.isEmpty(dmpMemberRequest.getMpRoleCode())) {
param.put("mpRoleCode", dmpMemberRequest.getMpRoleCode());
}
// 项目主键
if (dmpMemberRequest.getProjectId() != null) {
param.put("projectId", dmpMemberRequest.getProjectId());
}
PageHelper.startPage(dmpMemberRequest.getPageNum(), dmpMemberRequest.getPageSize());
List<DmpMemberDto> list = dmpMemberMapper.findList(param);
PageInfo<DmpMemberDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(ResultCode.SUCCESS.val());
pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
//获取所有用户角色统计信息
List<Map<String, Object>> roleStatList = dmpRoleMapper.projRoleStat();
Map<String, Object> resultMap = new HashMap<String, Object>();
resultMap.put("pageInfo", pageInfo);
resultMap.put("roleStatList", roleStatList);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功");
baseBeanResponse.setData(resultMap);
return baseBeanResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpMemberService#findList(com.ycxc.vmts.controller.bean.DmpMemberRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public BaseBeanResponse<DmpMemberDto> findList(DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest)
throws Exception {
BaseBeanResponse<DmpMemberDto> baseBeanResponse = new BaseBeanResponse<>();
Map<String, Object> param = new HashMap<>();
//用户ID
if (dmpMemberRequest.getUserId() != null) {
param.put("userId", dmpMemberRequest.getUserId());
}
//用户名称
if (!StringUtils.isEmpty(dmpMemberRequest.getUserName())) {
param.put("userName", dmpMemberRequest.getUserName());
}
//登录密码
if (!StringUtils.isEmpty(dmpMemberRequest.getUserPassword())) {
param.put("userPassword", dmpMemberRequest.getUserPassword());
}
//真实姓名
if (!StringUtils.isEmpty(dmpMemberRequest.getRealName())) {
param.put("realName", dmpMemberRequest.getRealName());
}
//联系电话
if (!StringUtils.isEmpty(dmpMemberRequest.getUserPhone())) {
param.put("userPhone", dmpMemberRequest.getUserPhone());
}
//登录IP
if (!StringUtils.isEmpty(dmpMemberRequest.getLoginIp())) {
param.put("loginIp", dmpMemberRequest.getLoginIp());
}
//最近登录时间起
if (dmpMemberRequest.getLoginTimeStart() != null) {
param.put("loginTimeStart", dmpMemberRequest.getLoginTimeStart());
}
//最近登录时间止
if (dmpMemberRequest.getLoginTimeEnd() != null) {
param.put("loginTimeEnd", dmpMemberRequest.getLoginTimeEnd());
}
//是否登录锁定(0:否,1:是)
if (!StringUtils.isEmpty(dmpMemberRequest.getLoginLocked())) {
param.put("loginLocked", dmpMemberRequest.getLoginLocked());
}
//连续登录错误次数
if (dmpMemberRequest.getLoginErrtimes() != null) {
param.put("loginErrtimes", dmpMemberRequest.getLoginErrtimes());
}
//备注
if (!StringUtils.isEmpty(dmpMemberRequest.getRemark())) {
param.put("remark", dmpMemberRequest.getRemark());
}
//数据状态(0:删除,1,未删除)
if (!StringUtils.isEmpty(dmpMemberRequest.getDataStatus())) {
param.put("dataStatus", dmpMemberRequest.getDataStatus());
}
//创建用户ID
if (dmpMemberRequest.getCreateUserId() != null) {
param.put("createUserId", dmpMemberRequest.getCreateUserId());
}
//创建时间起
if (dmpMemberRequest.getCreateTimeStart() != null) {
param.put("createTimeStart", dmpMemberRequest.getCreateTimeStart());
}
//创建时间止
if (dmpMemberRequest.getCreateTimeEnd() != null) {
param.put("createTimeEnd", dmpMemberRequest.getCreateTimeEnd());
}
//修改用户ID
if (dmpMemberRequest.getUpdateUserId() != null) {
param.put("updateUserId", dmpMemberRequest.getUpdateUserId());
}
//修改时间起
if (dmpMemberRequest.getUpdateTimeStart() != null) {
param.put("updateTimeStart", dmpMemberRequest.getUpdateTimeStart());
}
//修改时间止
if (dmpMemberRequest.getUpdateTimeEnd() != null) {
param.put("updateTimeEnd", dmpMemberRequest.getUpdateTimeEnd());
}
List<DmpMemberDto> list = dmpMemberMapper.findList(param);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功");
baseBeanResponse.setDatas(list);
return baseBeanResponse;
}
......@@ -149,6 +275,14 @@ public class DmpMemberServiceImpl extends BaseService implements DmpMemberServic
public BaseBeanResponse<DmpMember> add(DmpMember dmpMember, HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DmpMember> baseBeanResponse = new BaseBeanResponse<>();
//判断账户是否已经存在
DmpMember dmpMemberDb = dmpMemberMapper.findByUserName(dmpMember.getUsername());
if (dmpMemberDb!=null) {
baseBeanResponse.setCode(StatuConstant.CODE_DATA_EXISTED);
baseBeanResponse.setMessage("该用户名已经存在");
return baseBeanResponse;
}
/*$*setUserIdCodeReplace*$*/
//创建人
dmpMember.setCreateUserId(getHttpRequestUserId(httpRequest));
......@@ -208,18 +342,35 @@ public class DmpMemberServiceImpl extends BaseService implements DmpMemberServic
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseResponse deleteById(DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest)
public BaseResponse deleteById(Integer userId, HttpServletRequest httpRequest)
throws Exception {
BaseResponse baseResponse = new BaseResponse();
dmpMemberMapper.deleteByPrimaryKey(dmpMemberRequest.getUserId());
dmpMemberMapper.deleteByPrimaryKey(userId);
baseResponse.setCode(ResultCode.SUCCESS.val());
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("删除成功");
return baseResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpMemberService#deleteById(com.ycxc.vmts.controller.bean.DmpMemberRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseResponse softDeleteById(Integer userId, HttpServletRequest httpRequest)
throws Exception {
BaseResponse baseResponse = new BaseResponse();
dmpMemberMapper.softDeleteByPrimaryKey(userId);
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("软删除成功");
return baseResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpMemberService#addBatch(com.ycxc.vmts.controller.bean.DmpMemberVo, javax.servlet.http.HttpServletRequest)
*/
......@@ -286,4 +437,47 @@ public class DmpMemberServiceImpl extends BaseService implements DmpMemberServic
return projects.get(0).getId();
}
/**
*用户项目切换
*/
@Override
public BaseBeanResponse<DmpMember> switchProj(Integer projectId, HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DmpMember> baseBeanResponse = new BaseBeanResponse<>();
Authentication authentication = SessionUtils.getAuthentication();
Object principal = authentication.getPrincipal();
if (principal==null) {
baseBeanResponse.setCode(StatuConstant.CODE_NOT_SIGNED);
baseBeanResponse.setCode(StatuConstant.MSG_NOT_SIGNED);
return baseBeanResponse;
}
DmpMember member = (DmpMember)principal;
//设置登录用户默认项目
member.setCurrentProjectId(projectId);
//设置当前默认项目用户所拥有的角色
List<DmpRole> memberProjectRoles = dmpRoleService.findMemberProjRolesByUser(member);
member.setMemberProjectRoleList(memberProjectRoles);
//设置用户在当前默认项目的资源
List<DmpPermission> memberProjPermissions = dmpPermissionService.findPermissionByRoles(memberProjectRoles);
member.setMemberProjectPermissionList(memberProjPermissions);
//修改session上用户信息
//生成当所有授权
List<GrantedAuthority> grantedAuthorities = new ArrayList<GrantedAuthority>(authentication.getAuthorities());
//更改授权
//生成新的认证信息
Authentication newAuthentication = new UsernamePasswordAuthenticationToken(member, authentication.getCredentials(), grantedAuthorities);
//重置认证信息
SessionUtils.setAuthentication(newAuthentication);
baseBeanResponse.setCode(StatuConstant.CODE_SUCCESS);
baseBeanResponse.setMessage(StatuConstant.MSG_SUCCESS);
baseBeanResponse.setData(member);
return baseBeanResponse;
}
}
......@@ -25,12 +25,15 @@ import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.StatuConstant;
import com.jz.common.persistence.BaseService;
import com.jz.common.utils.web.SessionUtils;
import com.jz.dmp.modules.controller.sys.bean.DmpPermissionBatch;
import com.jz.dmp.modules.controller.sys.bean.DmpPermissionDto;
import com.jz.dmp.modules.controller.sys.bean.DmpPermissionRequest;
import com.jz.dmp.modules.controller.sys.bean.MyDmpPermissionConverter;
import com.jz.dmp.modules.dao.sys.DmpPermissionMapper;
import com.jz.dmp.modules.model.DmpMember;
import com.jz.dmp.modules.model.DmpPermission;
import com.jz.dmp.modules.model.DmpRole;
import com.jz.dmp.modules.service.sys.DmpPermissionService;
......@@ -262,8 +265,9 @@ public class DmpPermissionServiceImpl extends BaseService implements DmpPermissi
try {
List<DmpPermission> dmpPermissions = dmpPermissionMapper.findByRoles(dmpRoles);
String parentCode = "0";
//整理资源为树形结构
permissions = permissionArrangeTree(dmpPermissions);
permissions = permissionArrangeTree(parentCode, dmpPermissions);
} catch (Exception e) {
logger.info("根据角色查询资源异常:{}", e);
}
......@@ -280,10 +284,10 @@ public class DmpPermissionServiceImpl extends BaseService implements DmpPermissi
* @return List<DmpPermission> 返回类型
* @throws
*/
private List<DmpPermission> permissionArrangeTree(List<DmpPermission> dmpPermissions)throws Exception{
private List<DmpPermission> permissionArrangeTree(String parentCode,List<DmpPermission> dmpPermissions)throws Exception{
Map<String, List<DmpPermission>> dictMap = dmpPermissions.stream().collect(Collectors.groupingBy(DmpPermission::getParentCode));
List<DmpPermission> permissionTree = dictMap.get("0");//获取顶层资源
List<DmpPermission> permissionTree = dictMap.get(parentCode);//获取顶层资源
if (!CollectionUtils.isEmpty(permissionTree)) {
for (DmpPermission dmpPermission : permissionTree) {
......@@ -340,4 +344,36 @@ public class DmpPermissionServiceImpl extends BaseService implements DmpPermissi
return permissions;
}
/**
*获取父资源编码下当前用户项目所有资源
*/
@Override
public BaseBeanResponse<DmpPermissionDto> findListByParentCode(String parentCode,
HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DmpPermissionDto> baseBeanResponse = new BaseBeanResponse<>();
//获取当前用户拥有的项目角色
DmpMember currentUser = SessionUtils.getSecurityUser();
if (currentUser==null) {
baseBeanResponse.setCode(StatuConstant.CODE_NOT_SIGNED);
baseBeanResponse.setMessage("用户未登录!");
return baseBeanResponse;
}
List<DmpPermission> dmpPermissions = dmpPermissionMapper.findByRoles(currentUser.getMemberProjectRoleList());
//整理资源为树形结构
List<DmpPermission> permissions = permissionArrangeTree(parentCode, dmpPermissions);
List<DmpPermissionDto> list = MyDmpPermissionConverter.INSTANCE().domain2dto(permissions);
baseBeanResponse.setCode(StatuConstant.CODE_SUCCESS);
baseBeanResponse.setMessage("查询成功");
baseBeanResponse.setDatas(list);
return baseBeanResponse;
}
}
......@@ -22,8 +22,8 @@ import com.github.pagehelper.PageInfo;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.constant.ResultCode;
import com.jz.common.constant.StatuConstant;
import com.jz.common.persistence.BaseService;
import com.jz.dmp.modules.controller.sys.bean.DmpRoleBatch;
import com.jz.dmp.modules.controller.sys.bean.DmpRoleDto;
......@@ -31,7 +31,6 @@ import com.jz.dmp.modules.controller.sys.bean.DmpRoleRequest;
import com.jz.dmp.modules.dao.DmpProjectDao;
import com.jz.dmp.modules.dao.sys.DmpRoleMapper;
import com.jz.dmp.modules.model.DmpMember;
import com.jz.dmp.modules.model.DmpProject;
import com.jz.dmp.modules.model.DmpRole;
import com.jz.dmp.modules.service.sys.DmpRoleService;
......@@ -54,7 +53,7 @@ public class DmpRoleServiceImpl extends BaseService implements DmpRoleService {
* @see com.ycxc.vmts.service.DmpRoleService#findList(com.ycxc.vmts.controller.bean.DmpRoleRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public PageInfoResponse<DmpRoleDto> findList(DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest)
public PageInfoResponse<DmpRoleDto> findListWithPage(DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest)
throws Exception {
PageInfoResponse<DmpRoleDto> pageInfoResponse = new PageInfoResponse<>();
......@@ -116,12 +115,82 @@ public class DmpRoleServiceImpl extends BaseService implements DmpRoleService {
List<DmpRoleDto> list = dmpRoleMapper.findList(param);
PageInfo<DmpRoleDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(ResultCode.SUCCESS.val());
pageInfoResponse.setCode(StatuConstant.SUCCESS_CODE);
pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpRoleService#findList(com.ycxc.vmts.controller.bean.DmpRoleRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public BaseBeanResponse<DmpRoleDto> findList(DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest)
throws Exception {
BaseBeanResponse<DmpRoleDto> baseBeanResponse = new BaseBeanResponse<>();
Map<String, Object> param = new HashMap<>();
//角色ID
if (dmpRoleRequest.getRoleId() != null) {
param.put("roleId", dmpRoleRequest.getRoleId());
}
//角色编码
if (!StringUtils.isEmpty(dmpRoleRequest.getRoleCode())) {
param.put("roleCode", dmpRoleRequest.getRoleCode());
}
//角色名称
if (!StringUtils.isEmpty(dmpRoleRequest.getRoleName())) {
param.put("roleName", dmpRoleRequest.getRoleName());
}
//角色描述
if (!StringUtils.isEmpty(dmpRoleRequest.getRoleDesc())) {
param.put("roleDesc", dmpRoleRequest.getRoleDesc());
}
//角色类型
if (!StringUtils.isEmpty(dmpRoleRequest.getRoleType())) {
param.put("roleType", dmpRoleRequest.getRoleType());
}
//备注
if (!StringUtils.isEmpty(dmpRoleRequest.getRemark())) {
param.put("remark", dmpRoleRequest.getRemark());
}
//数据状态(0:删除,1,未删除)
if (!StringUtils.isEmpty(dmpRoleRequest.getDataStatus())) {
param.put("dataStatus", dmpRoleRequest.getDataStatus());
}
//创建用户ID
if (dmpRoleRequest.getCreateUserId() != null) {
param.put("createUserId", dmpRoleRequest.getCreateUserId());
}
//创建时间起
if (dmpRoleRequest.getCreateTimeStart() != null) {
param.put("createTimeStart", dmpRoleRequest.getCreateTimeStart());
}
//创建时间止
if (dmpRoleRequest.getCreateTimeEnd() != null) {
param.put("createTimeEnd", dmpRoleRequest.getCreateTimeEnd());
}
//修改用户ID
if (dmpRoleRequest.getUpdateUserId() != null) {
param.put("updateUserId", dmpRoleRequest.getUpdateUserId());
}
//修改时间起
if (dmpRoleRequest.getUpdateTimeStart() != null) {
param.put("updateTimeStart", dmpRoleRequest.getUpdateTimeStart());
}
//修改时间止
if (dmpRoleRequest.getUpdateTimeEnd() != null) {
param.put("updateTimeEnd", dmpRoleRequest.getUpdateTimeEnd());
}
List<DmpRoleDto> list = dmpRoleMapper.findList(param);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功");
baseBeanResponse.setDatas(list);
return baseBeanResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpRoleService#add(com.ycxc.vmts.entity.DmpRole, javax.servlet.http.HttpServletRequest)
......@@ -172,13 +241,13 @@ public class DmpRoleServiceImpl extends BaseService implements DmpRoleService {
* @see com.ycxc.vmts.service.DmpRoleService#findById(com.ycxc.vmts.controller.bean.DmpRoleRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public BaseBeanResponse<DmpRoleDto> findById(DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest)
public BaseBeanResponse<DmpRoleDto> findById(Integer roleId, HttpServletRequest httpRequest)
throws Exception {
BaseBeanResponse<DmpRoleDto> baseBeanResponse = new BaseBeanResponse<>();
DmpRoleDto dmpRoleDto = dmpRoleMapper.findById(dmpRoleRequest.getRoleId());
DmpRoleDto dmpRoleDto = dmpRoleMapper.findById(roleId);
baseBeanResponse.setCode(ResultCode.SUCCESS.val());
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功");
baseBeanResponse.setData(dmpRoleDto);
......@@ -190,18 +259,35 @@ public class DmpRoleServiceImpl extends BaseService implements DmpRoleService {
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseResponse deleteById(DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest)
public BaseResponse deleteById(Integer roleId, HttpServletRequest httpRequest)
throws Exception {
BaseResponse baseResponse = new BaseResponse();
dmpRoleMapper.deleteByPrimaryKey(dmpRoleRequest.getRoleId());
dmpRoleMapper.deleteByPrimaryKey(roleId);
baseResponse.setCode(ResultCode.SUCCESS.val());
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("删除成功");
return baseResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpRoleService#deleteById(com.ycxc.vmts.controller.bean.DmpRoleRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseResponse softDeleteById(Integer roleId, HttpServletRequest httpRequest)
throws Exception {
BaseResponse baseResponse = new BaseResponse();
dmpRoleMapper.softDeleteByPrimaryKey(roleId);
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("软删除成功");
return baseResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpRoleService#addBatch(com.ycxc.vmts.controller.bean.DmpRoleVo, javax.servlet.http.HttpServletRequest)
*/
......
......@@ -21,6 +21,11 @@
<resultMap id="BaseDtoResultMap" type="com.jz.dmp.modules.controller.sys.bean.DmpMemberDto" extends="BaseResultMap">
<!-- /*$BaseDtoResultMapContent$*/ -->
<collection property="roles" ofType="java.lang.String">
<constructor>
<arg column="role_name" />
</constructor>
</collection>
</resultMap>
<sql id="Base_Column_List">
......@@ -30,8 +35,10 @@
</sql>
<sql id="BaseDto_Column_List">
<include refid="Base_Column_List" />
<!-- /*$BaseDtoColumnListContent$*/ -->
m.user_id, m.user_name, m.user_password, m.real_name, m.user_phone,
m.login_ip, m.login_time, m.login_locked, m.login_errtimes, m.remark,
m.data_status, m.create_user_id, m.create_time, m.update_user_id, m.update_time,
role.role_name
</sql>
<!-- 根据主键查询用户表 -->
......@@ -40,6 +47,7 @@
<include refid="Base_Column_List" />
from dmp_member
where user_id = #{userId,jdbcType=INTEGER}
AND data_status='1'
</select>
<!-- 根据主键删除用户表 -->
......@@ -48,6 +56,15 @@
where user_id = #{userId,jdbcType=INTEGER}
</delete>
<!-- 根据主键软删除用户表 -->
<update id="softDeleteByPrimaryKey" parameterType="java.lang.String">
update dmp_member
<set>
data_status = '0'
</set>
where user_id = #{userId,jdbcType=INTEGER}
</update>
<!-- 插入用户表 -->
<insert id="insert" parameterType="com.jz.dmp.modules.model.DmpMember">
insert into dmp_member (
......@@ -256,7 +273,9 @@
<select id="findList" resultMap="BaseDtoResultMap">
SELECT
<include refid="BaseDto_Column_List"/>
FROM dmp_member
FROM dmp_member m
left join dmp_member_project_role mprole on m.user_id=mprole.user_id
left join dmp_role role on mprole.role_id = role.role_id
<where>
<if test="userId != null" >
AND user_id = #{userId,jdbcType=INTEGER}
......@@ -312,6 +331,13 @@
<if test="updateTimeEnd != null" >
AND update_time <![CDATA[ <= ]]> #{updateTimeEnd,jdbcType=TIMESTAMP}
</if>
<if test="mpRoleCode != null" >
AND role.role_code = #{mpRoleCode,jdbcType=VARCHAR}
</if>
<if test="projectId != null" >
AND mprole.project_id = #{projectId,jdbcType=INTEGER}
</if>
AND m.data_status='1'
</where>
</select>
......@@ -321,6 +347,7 @@
<include refid="BaseDto_Column_List" />
from dmp_member
where user_id = #{userId,jdbcType=INTEGER}
AND data_status='1'
</select>
<!-- 通过用户名获取用户信息 -->
......@@ -329,6 +356,7 @@
<include refid="Base_Column_List" />
from dmp_member
where user_name = #{userName,jdbcType=VARCHAR}
AND data_status='1'
</select>
</mapper>
......@@ -6,6 +6,11 @@
<result column="user_id" property="userId" jdbcType="INTEGER" />
<result column="project_id" property="projectId" jdbcType="INTEGER" />
<result column="role_id" property="roleId" jdbcType="INTEGER" />
<result column="data_status" property="dataStatus" jdbcType="CHAR" />
<result column="create_user_id" property="createUserId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_user_id" property="updateUserId" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<resultMap id="BaseDtoResultMap" type="com.jz.dmp.modules.controller.sys.bean.DmpMemberProjectRoleDto" extends="BaseResultMap">
......@@ -13,7 +18,8 @@
</resultMap>
<sql id="Base_Column_List">
member_project_role_id, user_id, project_id, role_id
member_project_role_id, user_id, project_id, role_id, data_status,
create_user_id, create_time, update_user_id, update_time
</sql>
<sql id="BaseDto_Column_List">
......@@ -27,6 +33,7 @@
<include refid="Base_Column_List" />
from dmp_member_project_role
where member_project_role_id = #{memberProjectRoleId,jdbcType=INTEGER}
AND data_status='1'
</select>
<!-- 根据主键删除用户项目角色表 -->
......@@ -35,25 +42,123 @@
where member_project_role_id = #{memberProjectRoleId,jdbcType=INTEGER}
</delete>
<!-- 根据主键软删除用户项目角色表 -->
<update id="softDeleteByPrimaryKey" parameterType="java.lang.String">
update dmp_member_project_role
<set>
data_status = '0'
</set>
where member_project_role_id = #{memberProjectRoleId,jdbcType=INTEGER}
</update>
<!-- 条件删除用户项目角色表 -->
<delete id="delete" parameterType="java.lang.String">
delete from dmp_member_project_role
<where>
<if test="memberProjectRoleId != null" >
AND member_project_role_id = #{memberProjectRoleId,jdbcType=INTEGER}
</if>
<if test="userId != null" >
AND user_id = #{userId,jdbcType=INTEGER}
</if>
<if test="projectId != null" >
AND project_id = #{projectId,jdbcType=INTEGER}
</if>
<if test="roleId != null" >
AND role_id = #{roleId,jdbcType=INTEGER}
</if>
<if test="dataStatus != null" >
AND data_status = #{dataStatus,jdbcType=CHAR}
</if>
<if test="createUserId != null" >
AND create_user_id = #{createUserId,jdbcType=INTEGER}
</if>
<if test="createTimeStart != null" >
AND create_time >= #{createTimeStart,jdbcType=TIMESTAMP}
</if>
<if test="createTimeEnd != null" >
AND create_time <![CDATA[ <= ]]> #{createTimeEnd,jdbcType=TIMESTAMP}
</if>
<if test="updateUserId != null" >
AND update_user_id = #{updateUserId,jdbcType=INTEGER}
</if>
<if test="updateTimeStart != null" >
AND update_time >= #{updateTimeStart,jdbcType=TIMESTAMP}
</if>
<if test="updateTimeEnd != null" >
AND update_time <![CDATA[ <= ]]> #{updateTimeEnd,jdbcType=TIMESTAMP}
</if>
AND data_status='1'
</where>
</delete>
<!-- 条件软删除用户项目角色表 -->
<update id="softDelete" parameterType="java.lang.String">
update dmp_member_project_role
<set>
data_status = '0'
</set>
<where>
<if test="memberProjectRoleId != null" >
AND member_project_role_id = #{memberProjectRoleId,jdbcType=INTEGER}
</if>
<if test="userId != null" >
AND user_id = #{userId,jdbcType=INTEGER}
</if>
<if test="projectId != null" >
AND project_id = #{projectId,jdbcType=INTEGER}
</if>
<if test="roleId != null" >
AND role_id = #{roleId,jdbcType=INTEGER}
</if>
<if test="dataStatus != null" >
AND data_status = #{dataStatus,jdbcType=CHAR}
</if>
<if test="createUserId != null" >
AND create_user_id = #{createUserId,jdbcType=INTEGER}
</if>
<if test="createTimeStart != null" >
AND create_time >= #{createTimeStart,jdbcType=TIMESTAMP}
</if>
<if test="createTimeEnd != null" >
AND create_time <![CDATA[ <= ]]> #{createTimeEnd,jdbcType=TIMESTAMP}
</if>
<if test="updateUserId != null" >
AND update_user_id = #{updateUserId,jdbcType=INTEGER}
</if>
<if test="updateTimeStart != null" >
AND update_time >= #{updateTimeStart,jdbcType=TIMESTAMP}
</if>
<if test="updateTimeEnd != null" >
AND update_time <![CDATA[ <= ]]> #{updateTimeEnd,jdbcType=TIMESTAMP}
</if>
AND data_status='1'
</where>
</update>
<!-- 插入用户项目角色表 -->
<insert id="insert" parameterType="com.jz.dmp.modules.model.DmpMemberProjectRole">
insert into dmp_member_project_role (
member_project_role_id, user_id, project_id, role_id
member_project_role_id, user_id, project_id, role_id, data_status,
create_user_id, create_time, update_user_id, update_time
)
values (
#{memberProjectRoleId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{projectId,jdbcType=INTEGER}, #{roleId,jdbcType=INTEGER}
#{memberProjectRoleId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{projectId,jdbcType=INTEGER}, #{roleId,jdbcType=INTEGER}, #{dataStatus,jdbcType=CHAR},
#{createUserId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateUserId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<!-- 批量新增用户项目角色表 -->
<insert id="insertBatch" parameterType="com.jz.dmp.modules.model.DmpMemberProjectRole">
insert into dmp_member_project_role (
member_project_role_id, user_id, project_id, role_id
member_project_role_id, user_id, project_id, role_id, data_status,
create_user_id, create_time, update_user_id, update_time
)
values
<foreach collection="list" item="item" separator=",">
(
#{item.memberProjectRoleId,jdbcType=INTEGER}, #{item.userId,jdbcType=INTEGER}, #{item.projectId,jdbcType=INTEGER}, #{item.roleId,jdbcType=INTEGER}
#{item.memberProjectRoleId,jdbcType=INTEGER}, #{item.userId,jdbcType=INTEGER}, #{item.projectId,jdbcType=INTEGER}, #{item.roleId,jdbcType=INTEGER}, #{item.dataStatus,jdbcType=CHAR},
#{item.createUserId,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.updateUserId,jdbcType=INTEGER}, #{item.updateTime,jdbcType=TIMESTAMP}
)
</foreach>
</insert>
......@@ -74,6 +179,21 @@
<if test="roleId != null" >
role_id,
</if>
<if test="dataStatus != null" >
data_status,
</if>
<if test="createUserId != null" >
create_user_id,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateUserId != null" >
update_user_id,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="memberProjectRoleId != null" >
......@@ -88,6 +208,21 @@
<if test="roleId != null" >
#{roleId,jdbcType=INTEGER},
</if>
<if test="dataStatus != null" >
#{dataStatus,jdbcType=CHAR},
</if>
<if test="createUserId != null" >
#{createUserId,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUserId != null" >
#{updateUserId,jdbcType=INTEGER},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
......@@ -97,7 +232,12 @@
member_project_role_id = #{memberProjectRoleId,jdbcType=INTEGER},
user_id = #{userId,jdbcType=INTEGER},
project_id = #{projectId,jdbcType=INTEGER},
role_id = #{roleId,jdbcType=INTEGER}
role_id = #{roleId,jdbcType=INTEGER},
data_status = #{dataStatus,jdbcType=CHAR},
create_user_id = #{createUserId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_user_id = #{updateUserId,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where member_project_role_id = #{memberProjectRoleId,jdbcType=INTEGER}
</update>
......@@ -117,6 +257,21 @@
<if test="roleId != null" >
role_id = #{roleId,jdbcType=INTEGER},
</if>
<if test="dataStatus != null" >
data_status = #{dataStatus,jdbcType=CHAR},
</if>
<if test="createUserId != null" >
create_user_id = #{createUserId,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUserId != null" >
update_user_id = #{updateUserId,jdbcType=INTEGER},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where member_project_role_id = #{memberProjectRoleId,jdbcType=INTEGER}
</update>
......@@ -139,6 +294,28 @@
<if test="roleId != null" >
AND role_id = #{roleId,jdbcType=INTEGER}
</if>
<if test="dataStatus != null" >
AND data_status = #{dataStatus,jdbcType=CHAR}
</if>
<if test="createUserId != null" >
AND create_user_id = #{createUserId,jdbcType=INTEGER}
</if>
<if test="createTimeStart != null" >
AND create_time >= #{createTimeStart,jdbcType=TIMESTAMP}
</if>
<if test="createTimeEnd != null" >
AND create_time <![CDATA[ <= ]]> #{createTimeEnd,jdbcType=TIMESTAMP}
</if>
<if test="updateUserId != null" >
AND update_user_id = #{updateUserId,jdbcType=INTEGER}
</if>
<if test="updateTimeStart != null" >
AND update_time >= #{updateTimeStart,jdbcType=TIMESTAMP}
</if>
<if test="updateTimeEnd != null" >
AND update_time <![CDATA[ <= ]]> #{updateTimeEnd,jdbcType=TIMESTAMP}
</if>
AND data_status='1'
</where>
</select>
......@@ -148,6 +325,7 @@
<include refid="BaseDto_Column_List" />
from dmp_member_project_role
where member_project_role_id = #{memberProjectRoleId,jdbcType=INTEGER}
AND data_status='1'
</select>
</mapper>
......@@ -44,6 +44,15 @@
where role_id = #{roleId,jdbcType=INTEGER}
</delete>
<!-- 根据主键软删除角色表 -->
<update id="softDeleteByPrimaryKey" parameterType="java.lang.String">
update dmp_role
<set>
data_status = '0'
</set>
where role_id = #{roleId,jdbcType=INTEGER}
</update>
<!-- 插入角色表 -->
<insert id="insert" parameterType="com.jz.dmp.modules.model.DmpRole">
insert into dmp_role (
......@@ -289,4 +298,15 @@
and memberProjRole.project_id = #{projectId,jdbcType=INTEGER}
</select>
<!-- 项目角色用户人数统计 -->
<select id="projRoleStat" resultType="map">
select
role.role_code AS roleCode,role.role_name AS roleName,COUNT(1) AS statCount
from dmp_member_project_role mprole
left join dmp_role role on mprole.role_id=role.role_id
left join dmp_member member on mprole.user_id=member.user_id
where member.data_status='1'
group by role.role_code,role.role_name
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment