Commit 07d3b95b authored by sml's avatar sml

用户及成员代码提交

parent aa80f0d8
...@@ -7,6 +7,9 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -7,6 +7,9 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; 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.Cipher;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -77,8 +80,12 @@ public class BaseService { ...@@ -77,8 +80,12 @@ public class BaseService {
*/ */
public Integer getHttpRequestUserId(HttpServletRequest httpRequest)throws Exception{ public Integer getHttpRequestUserId(HttpServletRequest httpRequest)throws Exception{
DmpMember dmpMember = SessionUtils.getSecurityUser();
if (dmpMember==null) {
return null; return null;
} }
return dmpMember.getUserId();
}
} }
package com.jz.common.utils.web; 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.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import com.jz.dmp.modules.model.DmpMember;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
...@@ -86,19 +90,6 @@ public class SessionUtils { ...@@ -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 * @Title: getSecurityUser
...@@ -107,22 +98,34 @@ public class SessionUtils { ...@@ -107,22 +98,34 @@ public class SessionUtils {
* @return DspSystemUser 返回类型 * @return DspSystemUser 返回类型
* @throws * @throws
*/ */
/* public static DmpSystemUser getSecurityUser(){ public static DmpMember getSecurityUser(){
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if (principal==null || "anonymousUser".equals(principal)) { if (principal==null || "anonymousUser".equals(principal)) {
return null; return null;
} }
return (DmpMember)principal;
return (DmpSystemUser)principal;
} }
public static DmpSystemUser getSecurityDspUser(){ /**
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); * @Title: getAuthentication
if (principal==null || "anonymousUser".equals(principal)) { * @Description: TODO(获取authentication)
return null; * @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; package com.jz.dmp.modules.controller.sys;
import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.jz.common.bean.BaseBeanResponse; import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse; import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse; import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.ResultCode; 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.DmpMemberBatch;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberDto; import com.jz.dmp.modules.controller.sys.bean.DmpMemberDto;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberRequest; import com.jz.dmp.modules.controller.sys.bean.DmpMemberRequest;
...@@ -19,6 +23,7 @@ import com.jz.dmp.modules.model.DmpMember; ...@@ -19,6 +23,7 @@ import com.jz.dmp.modules.model.DmpMember;
import com.jz.dmp.modules.service.sys.DmpMemberService; import com.jz.dmp.modules.service.sys.DmpMemberService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
/** /**
...@@ -34,23 +39,42 @@ public class DmpMemberController { ...@@ -34,23 +39,42 @@ public class DmpMemberController {
@Autowired @Autowired
private DmpMemberService dmpMemberService; 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 * @param dmpMemberRequest
* @return * @return
*/ */
@RequestMapping(method = RequestMethod.POST, value = "/findList") @RequestMapping(method = RequestMethod.POST, value = "/findList")
@ApiOperation(value = "列表查询用户表", notes = "列表查询用户表") @ApiOperation(value = "列表查询用户表", notes = "列表查询用户表")
public PageInfoResponse<DmpMemberDto> findList(@RequestBody DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest){ public BaseBeanResponse<DmpMemberDto> findList(@RequestBody DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest){
PageInfoResponse<DmpMemberDto> pageInfo = new PageInfoResponse<DmpMemberDto>(); BaseBeanResponse<DmpMemberDto> baseBeanResponse = new BaseBeanResponse<DmpMemberDto>();
try { try {
pageInfo = dmpMemberService.findList(dmpMemberRequest, httpRequest); baseBeanResponse = dmpMemberService.findList(dmpMemberRequest, httpRequest);
} catch (Exception e) { } catch (Exception e) {
pageInfo.setMessage("查询失败"); baseBeanResponse.setMessage("查询失败");
pageInfo.setCode(ResultCode.INTERNAL_SERVER_ERROR.val()); baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace(); e.printStackTrace();
} }
return pageInfo; return baseBeanResponse;
} }
...@@ -58,8 +82,8 @@ public class DmpMemberController { ...@@ -58,8 +82,8 @@ public class DmpMemberController {
* @param dmpMemberRequest * @param dmpMemberRequest
* @return * @return
*/ */
@RequestMapping(method = RequestMethod.POST, value = "/view") //@RequestMapping(method = RequestMethod.POST, value = "/view")
@ApiOperation(value = "主键查询用户表", notes = "主键查询用户表") //@ApiOperation(value = "主键查询用户表", notes = "主键查询用户表")
public BaseBeanResponse<DmpMemberDto> view(@RequestBody DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest){ public BaseBeanResponse<DmpMemberDto> view(@RequestBody DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest){
BaseBeanResponse<DmpMemberDto> baseBeanResponse = new BaseBeanResponse<DmpMemberDto>(); BaseBeanResponse<DmpMemberDto> baseBeanResponse = new BaseBeanResponse<DmpMemberDto>();
try { try {
...@@ -77,15 +101,36 @@ public class DmpMemberController { ...@@ -77,15 +101,36 @@ public class DmpMemberController {
* @param dmpMemberRequest * @param dmpMemberRequest
* @return * @return
*/ */
@RequestMapping(method = RequestMethod.POST, value = "/delete") //@RequestMapping(method = RequestMethod.POST, value = "/delete")
@ApiOperation(value = "删除用户表", notes = "删除用户表") //@ApiOperation(value = "删除用户表", notes = "删除用户表")
public BaseResponse delete(@RequestBody DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest){ //@ApiImplicitParam(name = "userId", value = "用户表主键")
public BaseResponse delete(@RequestParam(name = "userId", required = true ) Integer userId, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse(); BaseResponse baseResponse = new BaseResponse();
try { try {
baseResponse = dmpMemberService.deleteById(dmpMemberRequest, httpRequest); baseResponse = dmpMemberService.deleteById(userId, httpRequest);
} catch (Exception e) { } catch (Exception e) {
baseResponse.setMessage("删除失败"); 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(); e.printStackTrace();
} }
...@@ -115,8 +160,8 @@ public class DmpMemberController { ...@@ -115,8 +160,8 @@ public class DmpMemberController {
* @param dmpMemberRequest * @param dmpMemberRequest
* @return * @return
*/ */
@RequestMapping(method = RequestMethod.POST, value = "/addBatch") //@RequestMapping(method = RequestMethod.POST, value = "/addBatch")
@ApiOperation(value = "批量新增用户表", notes = "批量新增用户表") //@ApiOperation(value = "批量新增用户表", notes = "批量新增用户表")
public BaseBeanResponse<DmpMemberBatch> addBatch(@RequestBody DmpMemberBatch dmpMemberBatch, HttpServletRequest httpRequest){ public BaseBeanResponse<DmpMemberBatch> addBatch(@RequestBody DmpMemberBatch dmpMemberBatch, HttpServletRequest httpRequest){
BaseBeanResponse<DmpMemberBatch> baseBeanResponse = new BaseBeanResponse<DmpMemberBatch>(); BaseBeanResponse<DmpMemberBatch> baseBeanResponse = new BaseBeanResponse<DmpMemberBatch>();
try { try {
...@@ -134,8 +179,8 @@ public class DmpMemberController { ...@@ -134,8 +179,8 @@ public class DmpMemberController {
* @param dmpMemberRequest * @param dmpMemberRequest
* @return * @return
*/ */
@RequestMapping(method = RequestMethod.POST, value = "/edit") //@RequestMapping(method = RequestMethod.POST, value = "/edit")
@ApiOperation(value = "修改用户表", notes = "修改用户表") //@ApiOperation(value = "修改用户表", notes = "修改用户表")
public BaseBeanResponse<DmpMember> edit(@RequestBody DmpMember dmpMember, HttpServletRequest httpRequest){ public BaseBeanResponse<DmpMember> edit(@RequestBody DmpMember dmpMember, HttpServletRequest httpRequest){
BaseBeanResponse<DmpMember> baseBeanResponse = new BaseBeanResponse<DmpMember>(); BaseBeanResponse<DmpMember> baseBeanResponse = new BaseBeanResponse<DmpMember>();
try { try {
...@@ -149,4 +194,24 @@ public class DmpMemberController { ...@@ -149,4 +194,24 @@ public class DmpMemberController {
return baseBeanResponse; 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 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; package com.jz.dmp.modules.controller.sys.bean;
import java.util.List;
import com.jz.dmp.modules.model.DmpMember; import com.jz.dmp.modules.model.DmpMember;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**用户表Dto /**用户表Dto
* @author ybz * @author ybz
* *
*/ */
@Data
@ApiModel(value = "用户表Dto", description = "用户表Dto") @ApiModel(value = "用户表Dto", description = "用户表Dto")
public class DmpMemberDto extends DmpMember { public class DmpMemberDto extends DmpMember {
@ApiModelProperty(value = "项目角色列表")
private List<String> roles;
} }
...@@ -19,12 +19,6 @@ public class DmpMemberRequest extends BasePageBean { ...@@ -19,12 +19,6 @@ public class DmpMemberRequest extends BasePageBean {
@ApiModelProperty(value = "用户ID") @ApiModelProperty(value = "用户ID")
private Integer userId; private Integer userId;
/**
* 登录账号
*/
@ApiModelProperty(value = "登录账号")
private String userAccount;
/** /**
* 用户名称 * 用户名称
*/ */
...@@ -37,6 +31,12 @@ public class DmpMemberRequest extends BasePageBean { ...@@ -37,6 +31,12 @@ public class DmpMemberRequest extends BasePageBean {
@ApiModelProperty(value = "登录密码") @ApiModelProperty(value = "登录密码")
private String userPassword; private String userPassword;
/**
* 真实姓名
*/
@ApiModelProperty(value = "真实姓名")
private String realName;
/** /**
* 联系电话 * 联系电话
*/ */
...@@ -121,6 +121,12 @@ public class DmpMemberRequest extends BasePageBean { ...@@ -121,6 +121,12 @@ public class DmpMemberRequest extends BasePageBean {
@ApiModelProperty(value = "修改时间止") @ApiModelProperty(value = "修改时间止")
private Date updateTimeEnd; private Date updateTimeEnd;
@ApiModelProperty(value = "用户项目角色编码")
private String mpRoleCode;
@ApiModelProperty(value = "项目主键")
private Integer projectId;
public Integer getUserId() { public Integer getUserId() {
return userId; return userId;
} }
...@@ -129,14 +135,6 @@ public class DmpMemberRequest extends BasePageBean { ...@@ -129,14 +135,6 @@ public class DmpMemberRequest extends BasePageBean {
this.userId = userId; this.userId = userId;
} }
public String getUserAccount() {
return userAccount;
}
public void setUserAccount(String userAccount) {
this.userAccount = userAccount;
}
public String getUserName() { public String getUserName() {
return userName; return userName;
} }
...@@ -153,6 +151,14 @@ public class DmpMemberRequest extends BasePageBean { ...@@ -153,6 +151,14 @@ public class DmpMemberRequest extends BasePageBean {
this.userPassword = userPassword; this.userPassword = userPassword;
} }
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getUserPhone() { public String getUserPhone() {
return userPhone; return userPhone;
} }
...@@ -264,4 +270,21 @@ public class DmpMemberRequest extends BasePageBean { ...@@ -264,4 +270,21 @@ public class DmpMemberRequest extends BasePageBean {
public void setUpdateTimeEnd(Date updateTimeEnd) { public void setUpdateTimeEnd(Date updateTimeEnd) {
this.updateTimeEnd = 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 { ...@@ -54,6 +54,13 @@ public interface DmpMemberMapper {
*/ */
public int deleteByPrimaryKey(Integer dmpMemberId)throws Exception; public int deleteByPrimaryKey(Integer dmpMemberId)throws Exception;
/**主键软删除用户表
* @param userId
* @return
* @throws Exception
*/
public int softDeleteByPrimaryKey(Integer userId)throws Exception;
/**条件查询用户表 /**条件查询用户表
* @param param * @param param
* @return * @return
......
...@@ -3,6 +3,8 @@ package com.jz.dmp.modules.dao.sys; ...@@ -3,6 +3,8 @@ package com.jz.dmp.modules.dao.sys;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberProjectRoleDto; import com.jz.dmp.modules.controller.sys.bean.DmpMemberProjectRoleDto;
import com.jz.dmp.modules.model.DmpMemberProjectRole; import com.jz.dmp.modules.model.DmpMemberProjectRole;
...@@ -41,18 +43,25 @@ public interface DmpMemberProjectRoleMapper { ...@@ -41,18 +43,25 @@ public interface DmpMemberProjectRoleMapper {
public int updateByPrimaryKeySelective(DmpMemberProjectRole dmpMemberProjectRole)throws Exception; public int updateByPrimaryKeySelective(DmpMemberProjectRole dmpMemberProjectRole)throws Exception;
/**主键查询用户项目角色表 /**主键查询用户项目角色表
* @param dmpMemberProjectRoleId * @param memberProjectRoleId
* @return * @return
* @throws Exception * @throws Exception
*/ */
public DmpMemberProjectRole selectByPrimaryKey(Integer dmpMemberProjectRoleId)throws Exception; public DmpMemberProjectRole selectByPrimaryKey(Integer memberProjectRoleId)throws Exception;
/**主键删除用户项目角色表 /**主键删除用户项目角色表
* @param dmpMemberProjectRoleId * @param memberProjectRoleId
* @return * @return
* @throws Exception * @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 * @param param
...@@ -62,11 +71,11 @@ public interface DmpMemberProjectRoleMapper { ...@@ -62,11 +71,11 @@ public interface DmpMemberProjectRoleMapper {
public List<DmpMemberProjectRoleDto> findList(Map<String, Object> param)throws Exception; public List<DmpMemberProjectRoleDto> findList(Map<String, Object> param)throws Exception;
/**主键查询用户项目角色表 /**主键查询用户项目角色表
* @param dmpMemberProjectRoleId * @param memberProjectRoleId
* @return * @return
* @throws Exception * @throws Exception
*/ */
public DmpMemberProjectRoleDto findById(Integer dmpMemberProjectRoleId)throws Exception; public DmpMemberProjectRoleDto findById(Integer memberProjectRoleId)throws Exception;
/**批量新增用户项目角色表 /**批量新增用户项目角色表
* @param dmpMemberProjectRoles * @param dmpMemberProjectRoles
...@@ -74,4 +83,18 @@ public interface DmpMemberProjectRoleMapper { ...@@ -74,4 +83,18 @@ public interface DmpMemberProjectRoleMapper {
*/ */
public void insertBatch(List<DmpMemberProjectRole> dmpMemberProjectRoles)throws Exception; 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 { ...@@ -56,6 +56,13 @@ public interface DmpRoleMapper {
*/ */
public int deleteByPrimaryKey(Integer dmpRoleId)throws Exception; public int deleteByPrimaryKey(Integer dmpRoleId)throws Exception;
/**主键软删除角色表
* @param roleId
* @return
* @throws Exception
*/
public int softDeleteByPrimaryKey(Integer roleId)throws Exception;
/**条件查询角色表 /**条件查询角色表
* @param param * @param param
* @return * @return
...@@ -99,4 +106,14 @@ public interface DmpRoleMapper { ...@@ -99,4 +106,14 @@ public interface DmpRoleMapper {
*/ */
public List<DmpRole> findMemberProjRoles(@Param("userId")Integer userId, @Param("projectId")Integer projectId)throws Exception; 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; ...@@ -3,6 +3,7 @@ package com.jz.dmp.modules.model;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**用户项目角色表 /**用户项目角色表
* @author ybz * @author ybz
...@@ -34,6 +35,36 @@ public class DmpMemberProjectRole { ...@@ -34,6 +35,36 @@ public class DmpMemberProjectRole {
@ApiModelProperty(value = "角色ID") @ApiModelProperty(value = "角色ID")
private Integer roleId; 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() { public Integer getMemberProjectRoleId() {
return memberProjectRoleId; return memberProjectRoleId;
} }
...@@ -65,4 +96,44 @@ public class DmpMemberProjectRole { ...@@ -65,4 +96,44 @@ public class DmpMemberProjectRole {
public void setRoleId(Integer roleId) { public void setRoleId(Integer roleId) {
this.roleId = 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; ...@@ -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.DmpMemberProjectRoleBatch;
import com.jz.dmp.modules.controller.sys.bean.DmpMemberProjectRoleDto; 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.DmpMemberProjectRoleRequest;
import com.jz.dmp.modules.controller.sys.bean.MembProjRoleBatchReq;
import com.jz.dmp.modules.model.DmpMemberProjectRole; import com.jz.dmp.modules.model.DmpMemberProjectRole;
/** /**
...@@ -17,13 +18,22 @@ import com.jz.dmp.modules.model.DmpMemberProjectRole; ...@@ -17,13 +18,22 @@ import com.jz.dmp.modules.model.DmpMemberProjectRole;
*/ */
public interface DmpMemberProjectRoleService { public interface DmpMemberProjectRoleService {
/**条件分頁查询所有用户项目角色表
* @param dmpMemberProjectRoleRequest
* @param httpRequest
* @return
* @throws Exception
*/
public PageInfoResponse<DmpMemberProjectRoleDto> findListWithPage(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)throws Exception;
/**条件查询所有用户项目角色表 /**条件查询所有用户项目角色表
* @param dmpMemberProjectRoleRequest * @param dmpMemberProjectRoleRequest
* @param httpRequest * @param httpRequest
* @return * @return
* @throws Exception * @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 { ...@@ -35,12 +45,12 @@ public interface DmpMemberProjectRoleService {
public BaseBeanResponse<DmpMemberProjectRole> add(DmpMemberProjectRole dmpMemberProjectRole, HttpServletRequest httpRequest)throws Exception; public BaseBeanResponse<DmpMemberProjectRole> add(DmpMemberProjectRole dmpMemberProjectRole, HttpServletRequest httpRequest)throws Exception;
/**主键查询用户项目角色表 /**主键查询用户项目角色表
* @param dmpMemberProjectRoleRequest * @param memberProjectRoleId
* @param httpRequest * @param httpRequest
* @return * @return
* @throws Exception * @throws Exception
*/ */
public BaseBeanResponse<DmpMemberProjectRoleDto> findById(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)throws Exception; public BaseBeanResponse<DmpMemberProjectRoleDto> findById(Integer memberProjectRoleId, HttpServletRequest httpRequest)throws Exception;
/**修改用户项目角色表 /**修改用户项目角色表
* @param dmpMemberProjectRole * @param dmpMemberProjectRole
...@@ -51,12 +61,20 @@ public interface DmpMemberProjectRoleService { ...@@ -51,12 +61,20 @@ public interface DmpMemberProjectRoleService {
public BaseBeanResponse<DmpMemberProjectRole> edit(DmpMemberProjectRole dmpMemberProjectRole, HttpServletRequest httpRequest)throws Exception; 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 * @param httpRequest
* @return * @return
* @throws Exception * @throws Exception
*/ */
public BaseResponse deleteById(DmpMemberProjectRoleRequest dmpMemberProjectRoleRequest, HttpServletRequest httpRequest)throws Exception; public BaseResponse softDeleteById(Integer memberProjectRoleId, HttpServletRequest httpRequest)throws Exception;
/**批量新增用户项目角色表 /**批量新增用户项目角色表
* @param dmpMemberProjectRoleVo * @param dmpMemberProjectRoleVo
...@@ -66,4 +84,33 @@ public interface DmpMemberProjectRoleService { ...@@ -66,4 +84,33 @@ public interface DmpMemberProjectRoleService {
*/ */
public BaseBeanResponse<DmpMemberProjectRoleBatch> addBatch(DmpMemberProjectRoleBatch dmpMemberProjectRoleBatch, HttpServletRequest httpRequest)throws Exception; 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; package com.jz.dmp.modules.service.sys;
import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.jz.common.bean.BaseBeanResponse; import com.jz.common.bean.BaseBeanResponse;
...@@ -17,14 +19,21 @@ import com.jz.dmp.modules.model.DmpMember; ...@@ -17,14 +19,21 @@ import com.jz.dmp.modules.model.DmpMember;
*/ */
public interface DmpMemberService { public interface DmpMemberService {
/**条件查询所有用户表 /**条件分頁查询所有用户表
* @param dmpMemberRequest * @param dmpMemberRequest
* @param httpRequest * @param httpRequest
* @return * @return
* @throws Exception * @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 * @param dmpMember
...@@ -51,12 +60,21 @@ public interface DmpMemberService { ...@@ -51,12 +60,21 @@ public interface DmpMemberService {
public BaseBeanResponse<DmpMember> edit(DmpMember dmpMember, HttpServletRequest httpRequest)throws Exception; 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 * @param httpRequest
* @return * @return
* @throws Exception * @throws Exception
*/ */
public BaseResponse deleteById(DmpMemberRequest dmpMemberRequest, HttpServletRequest httpRequest)throws Exception; public BaseResponse softDeleteById(Integer userId, HttpServletRequest httpRequest)throws Exception;
/**批量新增用户表 /**批量新增用户表
* @param dmpMemberVo * @param dmpMemberVo
...@@ -89,4 +107,17 @@ public interface DmpMemberService { ...@@ -89,4 +107,17 @@ public interface DmpMemberService {
*/ */
public Integer getDefProjectByUserName(String username); 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 { ...@@ -89,4 +89,18 @@ public interface DmpPermissionService {
*/ */
public List<DmpPermission> findAllList(); 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; package com.jz.dmp.modules.service.sys;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -20,14 +21,21 @@ import com.jz.dmp.modules.model.DmpRole; ...@@ -20,14 +21,21 @@ import com.jz.dmp.modules.model.DmpRole;
*/ */
public interface DmpRoleService { public interface DmpRoleService {
/**条件查询所有角色表 /**条件分頁查询所有角色表
* @param dmpRoleRequest * @param dmpRoleRequest
* @param httpRequest * @param httpRequest
* @return * @return
* @throws Exception * @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 * @param dmpRole
...@@ -38,12 +46,12 @@ public interface DmpRoleService { ...@@ -38,12 +46,12 @@ public interface DmpRoleService {
public BaseBeanResponse<DmpRole> add(DmpRole dmpRole, HttpServletRequest httpRequest)throws Exception; public BaseBeanResponse<DmpRole> add(DmpRole dmpRole, HttpServletRequest httpRequest)throws Exception;
/**主键查询角色表 /**主键查询角色表
* @param dmpRoleRequest * @param roleId
* @param httpRequest * @param httpRequest
* @return * @return
* @throws Exception * @throws Exception
*/ */
public BaseBeanResponse<DmpRoleDto> findById(DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest)throws Exception; public BaseBeanResponse<DmpRoleDto> findById(Integer roleId, HttpServletRequest httpRequest)throws Exception;
/**修改角色表 /**修改角色表
* @param dmpRole * @param dmpRole
...@@ -54,12 +62,20 @@ public interface DmpRoleService { ...@@ -54,12 +62,20 @@ public interface DmpRoleService {
public BaseBeanResponse<DmpRole> edit(DmpRole dmpRole, HttpServletRequest httpRequest)throws Exception; public BaseBeanResponse<DmpRole> edit(DmpRole dmpRole, HttpServletRequest httpRequest)throws Exception;
/**主键删除角色表 /**主键删除角色表
* @param dmpRoleRequest * @param roleId
* @param httpRequest * @param httpRequest
* @return * @return
* @throws Exception * @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 * @param dmpRoleVo
...@@ -91,4 +107,5 @@ public interface DmpRoleService { ...@@ -91,4 +107,5 @@ public interface DmpRoleService {
*/ */
public List<DmpRole> findMemberProjRolesByUser(DmpMember user); public List<DmpRole> findMemberProjRolesByUser(DmpMember user);
} }
...@@ -25,12 +25,15 @@ import com.jz.common.bean.BaseResponse; ...@@ -25,12 +25,15 @@ import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse; import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants; import com.jz.common.constant.Constants;
import com.jz.common.constant.ResultCode; import com.jz.common.constant.ResultCode;
import com.jz.common.constant.StatuConstant;
import com.jz.common.persistence.BaseService; 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.DmpPermissionBatch;
import com.jz.dmp.modules.controller.sys.bean.DmpPermissionDto; 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.DmpPermissionRequest;
import com.jz.dmp.modules.controller.sys.bean.MyDmpPermissionConverter; import com.jz.dmp.modules.controller.sys.bean.MyDmpPermissionConverter;
import com.jz.dmp.modules.dao.sys.DmpPermissionMapper; 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.DmpPermission;
import com.jz.dmp.modules.model.DmpRole; import com.jz.dmp.modules.model.DmpRole;
import com.jz.dmp.modules.service.sys.DmpPermissionService; import com.jz.dmp.modules.service.sys.DmpPermissionService;
...@@ -262,8 +265,9 @@ public class DmpPermissionServiceImpl extends BaseService implements DmpPermissi ...@@ -262,8 +265,9 @@ public class DmpPermissionServiceImpl extends BaseService implements DmpPermissi
try { try {
List<DmpPermission> dmpPermissions = dmpPermissionMapper.findByRoles(dmpRoles); List<DmpPermission> dmpPermissions = dmpPermissionMapper.findByRoles(dmpRoles);
String parentCode = "0";
//整理资源为树形结构 //整理资源为树形结构
permissions = permissionArrangeTree(dmpPermissions); permissions = permissionArrangeTree(parentCode, dmpPermissions);
} catch (Exception e) { } catch (Exception e) {
logger.info("根据角色查询资源异常:{}", e); logger.info("根据角色查询资源异常:{}", e);
} }
...@@ -280,10 +284,10 @@ public class DmpPermissionServiceImpl extends BaseService implements DmpPermissi ...@@ -280,10 +284,10 @@ public class DmpPermissionServiceImpl extends BaseService implements DmpPermissi
* @return List<DmpPermission> 返回类型 * @return List<DmpPermission> 返回类型
* @throws * @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)); 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)) { if (!CollectionUtils.isEmpty(permissionTree)) {
for (DmpPermission dmpPermission : permissionTree) { for (DmpPermission dmpPermission : permissionTree) {
...@@ -340,4 +344,36 @@ public class DmpPermissionServiceImpl extends BaseService implements DmpPermissi ...@@ -340,4 +344,36 @@ public class DmpPermissionServiceImpl extends BaseService implements DmpPermissi
return permissions; 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; ...@@ -22,8 +22,8 @@ import com.github.pagehelper.PageInfo;
import com.jz.common.bean.BaseBeanResponse; import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse; import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse; import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.constant.ResultCode; import com.jz.common.constant.ResultCode;
import com.jz.common.constant.StatuConstant;
import com.jz.common.persistence.BaseService; import com.jz.common.persistence.BaseService;
import com.jz.dmp.modules.controller.sys.bean.DmpRoleBatch; 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.DmpRoleDto;
...@@ -31,7 +31,6 @@ import com.jz.dmp.modules.controller.sys.bean.DmpRoleRequest; ...@@ -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.DmpProjectDao;
import com.jz.dmp.modules.dao.sys.DmpRoleMapper; import com.jz.dmp.modules.dao.sys.DmpRoleMapper;
import com.jz.dmp.modules.model.DmpMember; 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.model.DmpRole;
import com.jz.dmp.modules.service.sys.DmpRoleService; import com.jz.dmp.modules.service.sys.DmpRoleService;
...@@ -54,7 +53,7 @@ public class DmpRoleServiceImpl extends BaseService implements 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) * @see com.ycxc.vmts.service.DmpRoleService#findList(com.ycxc.vmts.controller.bean.DmpRoleRequest, javax.servlet.http.HttpServletRequest)
*/ */
@Override @Override
public PageInfoResponse<DmpRoleDto> findList(DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest) public PageInfoResponse<DmpRoleDto> findListWithPage(DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest)
throws Exception { throws Exception {
PageInfoResponse<DmpRoleDto> pageInfoResponse = new PageInfoResponse<>(); PageInfoResponse<DmpRoleDto> pageInfoResponse = new PageInfoResponse<>();
...@@ -116,12 +115,82 @@ public class DmpRoleServiceImpl extends BaseService implements DmpRoleService { ...@@ -116,12 +115,82 @@ public class DmpRoleServiceImpl extends BaseService implements DmpRoleService {
List<DmpRoleDto> list = dmpRoleMapper.findList(param); List<DmpRoleDto> list = dmpRoleMapper.findList(param);
PageInfo<DmpRoleDto> pageInfo = new PageInfo<>(list); PageInfo<DmpRoleDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(ResultCode.SUCCESS.val()); pageInfoResponse.setCode(StatuConstant.SUCCESS_CODE);
pageInfoResponse.setMessage("查询成功"); pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo); pageInfoResponse.setData(pageInfo);
return pageInfoResponse; 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) /* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpRoleService#add(com.ycxc.vmts.entity.DmpRole, javax.servlet.http.HttpServletRequest) * @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 { ...@@ -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) * @see com.ycxc.vmts.service.DmpRoleService#findById(com.ycxc.vmts.controller.bean.DmpRoleRequest, javax.servlet.http.HttpServletRequest)
*/ */
@Override @Override
public BaseBeanResponse<DmpRoleDto> findById(DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest) public BaseBeanResponse<DmpRoleDto> findById(Integer roleId, HttpServletRequest httpRequest)
throws Exception { throws Exception {
BaseBeanResponse<DmpRoleDto> baseBeanResponse = new BaseBeanResponse<>(); 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.setMessage("查询成功");
baseBeanResponse.setData(dmpRoleDto); baseBeanResponse.setData(dmpRoleDto);
...@@ -190,18 +259,35 @@ public class DmpRoleServiceImpl extends BaseService implements DmpRoleService { ...@@ -190,18 +259,35 @@ public class DmpRoleServiceImpl extends BaseService implements DmpRoleService {
*/ */
@Override @Override
@Transactional(rollbackFor=Exception.class) @Transactional(rollbackFor=Exception.class)
public BaseResponse deleteById(DmpRoleRequest dmpRoleRequest, HttpServletRequest httpRequest) public BaseResponse deleteById(Integer roleId, HttpServletRequest httpRequest)
throws Exception { throws Exception {
BaseResponse baseResponse = new BaseResponse(); BaseResponse baseResponse = new BaseResponse();
dmpRoleMapper.deleteByPrimaryKey(dmpRoleRequest.getRoleId()); dmpRoleMapper.deleteByPrimaryKey(roleId);
baseResponse.setCode(ResultCode.SUCCESS.val()); baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("删除成功"); baseResponse.setMessage("删除成功");
return baseResponse; 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) /* (non-Javadoc)
* @see com.ycxc.vmts.service.DmpRoleService#addBatch(com.ycxc.vmts.controller.bean.DmpRoleVo, javax.servlet.http.HttpServletRequest) * @see com.ycxc.vmts.service.DmpRoleService#addBatch(com.ycxc.vmts.controller.bean.DmpRoleVo, javax.servlet.http.HttpServletRequest)
*/ */
......
...@@ -21,6 +21,11 @@ ...@@ -21,6 +21,11 @@
<resultMap id="BaseDtoResultMap" type="com.jz.dmp.modules.controller.sys.bean.DmpMemberDto" extends="BaseResultMap"> <resultMap id="BaseDtoResultMap" type="com.jz.dmp.modules.controller.sys.bean.DmpMemberDto" extends="BaseResultMap">
<!-- /*$BaseDtoResultMapContent$*/ --> <!-- /*$BaseDtoResultMapContent$*/ -->
<collection property="roles" ofType="java.lang.String">
<constructor>
<arg column="role_name" />
</constructor>
</collection>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
...@@ -30,8 +35,10 @@ ...@@ -30,8 +35,10 @@
</sql> </sql>
<sql id="BaseDto_Column_List"> <sql id="BaseDto_Column_List">
<include refid="Base_Column_List" /> m.user_id, m.user_name, m.user_password, m.real_name, m.user_phone,
<!-- /*$BaseDtoColumnListContent$*/ --> 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> </sql>
<!-- 根据主键查询用户表 --> <!-- 根据主键查询用户表 -->
...@@ -40,6 +47,7 @@ ...@@ -40,6 +47,7 @@
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from dmp_member from dmp_member
where user_id = #{userId,jdbcType=INTEGER} where user_id = #{userId,jdbcType=INTEGER}
AND data_status='1'
</select> </select>
<!-- 根据主键删除用户表 --> <!-- 根据主键删除用户表 -->
...@@ -48,6 +56,15 @@ ...@@ -48,6 +56,15 @@
where user_id = #{userId,jdbcType=INTEGER} where user_id = #{userId,jdbcType=INTEGER}
</delete> </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 id="insert" parameterType="com.jz.dmp.modules.model.DmpMember">
insert into dmp_member ( insert into dmp_member (
...@@ -256,7 +273,9 @@ ...@@ -256,7 +273,9 @@
<select id="findList" resultMap="BaseDtoResultMap"> <select id="findList" resultMap="BaseDtoResultMap">
SELECT SELECT
<include refid="BaseDto_Column_List"/> <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> <where>
<if test="userId != null" > <if test="userId != null" >
AND user_id = #{userId,jdbcType=INTEGER} AND user_id = #{userId,jdbcType=INTEGER}
...@@ -312,6 +331,13 @@ ...@@ -312,6 +331,13 @@
<if test="updateTimeEnd != null" > <if test="updateTimeEnd != null" >
AND update_time <![CDATA[ <= ]]> #{updateTimeEnd,jdbcType=TIMESTAMP} AND update_time <![CDATA[ <= ]]> #{updateTimeEnd,jdbcType=TIMESTAMP}
</if> </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> </where>
</select> </select>
...@@ -321,6 +347,7 @@ ...@@ -321,6 +347,7 @@
<include refid="BaseDto_Column_List" /> <include refid="BaseDto_Column_List" />
from dmp_member from dmp_member
where user_id = #{userId,jdbcType=INTEGER} where user_id = #{userId,jdbcType=INTEGER}
AND data_status='1'
</select> </select>
<!-- 通过用户名获取用户信息 --> <!-- 通过用户名获取用户信息 -->
...@@ -329,6 +356,7 @@ ...@@ -329,6 +356,7 @@
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from dmp_member from dmp_member
where user_name = #{userName,jdbcType=VARCHAR} where user_name = #{userName,jdbcType=VARCHAR}
AND data_status='1'
</select> </select>
</mapper> </mapper>
...@@ -44,6 +44,15 @@ ...@@ -44,6 +44,15 @@
where role_id = #{roleId,jdbcType=INTEGER} where role_id = #{roleId,jdbcType=INTEGER}
</delete> </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 id="insert" parameterType="com.jz.dmp.modules.model.DmpRole">
insert into dmp_role ( insert into dmp_role (
...@@ -289,4 +298,15 @@ ...@@ -289,4 +298,15 @@
and memberProjRole.project_id = #{projectId,jdbcType=INTEGER} and memberProjRole.project_id = #{projectId,jdbcType=INTEGER}
</select> </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> </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