Commit d351b736 authored by zjy's avatar zjy

user/role/tright 6.15

parent afe32438
...@@ -5,6 +5,7 @@ import com.pangding.web.authority.service.AuthorityService; ...@@ -5,6 +5,7 @@ import com.pangding.web.authority.service.AuthorityService;
import com.pangding.web.authority.vo.AuthorityVo; import com.pangding.web.authority.vo.AuthorityVo;
import com.pangding.web.authority.vo.reqvo.*; import com.pangding.web.authority.vo.reqvo.*;
import com.pangding.web.authority.vo.resvo.AuthorityListByLevelResVo; import com.pangding.web.authority.vo.resvo.AuthorityListByLevelResVo;
import com.pangding.web.authority.vo.resvo.AuthorityListResVo;
import com.pangding.web.authority.vo.resvo.AuthorityResVo; import com.pangding.web.authority.vo.resvo.AuthorityResVo;
import com.pangding.web.authority.vo.resvo.WebAuthorityResVo; import com.pangding.web.authority.vo.resvo.WebAuthorityResVo;
import com.yanzuoguang.util.helper.CheckerHelper; import com.yanzuoguang.util.helper.CheckerHelper;
...@@ -34,7 +35,7 @@ public class AuthorityController { ...@@ -34,7 +35,7 @@ public class AuthorityController {
* @return * @return
*/ */
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseResult<List<AuthorityListByLevelResVo>> saveAuthority(@RequestBody AuthorityVo authorityVo){ public ResponseResult<AuthorityListResVo> saveAuthority(@RequestBody AuthorityVo authorityVo){
CheckerHelper.newInstance() CheckerHelper.newInstance()
.notBlankCheck("authorityName",authorityVo.getName()) .notBlankCheck("authorityName",authorityVo.getName())
.notBlankCheck("type",authorityVo.getType()) .notBlankCheck("type",authorityVo.getType())
...@@ -53,7 +54,7 @@ public class AuthorityController { ...@@ -53,7 +54,7 @@ public class AuthorityController {
* @return * @return
*/ */
@RequestMapping(value = "/update", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/update", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseResult<List<AuthorityListByLevelResVo>> updateAuthority(@RequestBody AuthorityVo authorityVo){ public ResponseResult<AuthorityListResVo> updateAuthority(@RequestBody AuthorityVo authorityVo){
CheckerHelper.newInstance() CheckerHelper.newInstance()
.notBlankCheck("authorityName",authorityVo.getName()) .notBlankCheck("authorityName",authorityVo.getName())
.notBlankCheck("type",authorityVo.getType()) .notBlankCheck("type",authorityVo.getType())
...@@ -89,7 +90,7 @@ public class AuthorityController { ...@@ -89,7 +90,7 @@ public class AuthorityController {
* @return * @return
*/ */
@RequestMapping(value = "/listByLevel", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/listByLevel", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseResult<List<AuthorityListByLevelResVo>> listByLevel(@RequestBody AuthorityListReqVo reqVo){ public ResponseResult<AuthorityListResVo> listByLevel(@RequestBody AuthorityListReqVo reqVo){
return ResponseResult.result(authorityServiceImpl.getListByLevel(reqVo)); return ResponseResult.result(authorityServiceImpl.getListByLevel(reqVo));
} }
......
...@@ -3,6 +3,7 @@ package com.pangding.web.authority.service; ...@@ -3,6 +3,7 @@ package com.pangding.web.authority.service;
import com.pangding.web.authority.vo.AuthorityVo; import com.pangding.web.authority.vo.AuthorityVo;
import com.pangding.web.authority.vo.reqvo.*; import com.pangding.web.authority.vo.reqvo.*;
import com.pangding.web.authority.vo.resvo.AuthorityListByLevelResVo; import com.pangding.web.authority.vo.resvo.AuthorityListByLevelResVo;
import com.pangding.web.authority.vo.resvo.AuthorityListResVo;
import com.pangding.web.authority.vo.resvo.AuthorityResVo; import com.pangding.web.authority.vo.resvo.AuthorityResVo;
import com.pangding.web.authority.vo.resvo.WebAuthorityResVo; import com.pangding.web.authority.vo.resvo.WebAuthorityResVo;
import com.yanzuoguang.util.vo.PageSizeData; import com.yanzuoguang.util.vo.PageSizeData;
...@@ -19,7 +20,7 @@ public interface AuthorityService { ...@@ -19,7 +20,7 @@ public interface AuthorityService {
* @param authorityVo authorityVo对象 * @param authorityVo authorityVo对象
* @return 用户id * @return 用户id
*/ */
List<AuthorityListByLevelResVo> save(AuthorityVo authorityVo); AuthorityListResVo save(AuthorityVo authorityVo);
/** /**
* 更新authorityVo对象数据 * 更新authorityVo对象数据
...@@ -27,7 +28,7 @@ public interface AuthorityService { ...@@ -27,7 +28,7 @@ public interface AuthorityService {
* @param authorityVo authorityVo对象 * @param authorityVo authorityVo对象
* @return 用户id * @return 用户id
*/ */
List<AuthorityListByLevelResVo> update(AuthorityVo authorityVo); AuthorityListResVo update(AuthorityVo authorityVo);
/** /**
* 通过权限表主键获取authorityVo对象 * 通过权限表主键获取authorityVo对象
...@@ -68,7 +69,7 @@ public interface AuthorityService { ...@@ -68,7 +69,7 @@ public interface AuthorityService {
*/ */
List<AuthorityVo> getAuthorityList(AuthorityListReqVo reqVo); List<AuthorityVo> getAuthorityList(AuthorityListReqVo reqVo);
List<AuthorityListByLevelResVo> getListByLevel(AuthorityListReqVo reqVo); AuthorityListResVo getListByLevel(AuthorityListReqVo reqVo);
List<AuthorityListByLevelResVo> getCompanyAuthority(CompanyAuthorityReqVo reqVo); List<AuthorityListByLevelResVo> getCompanyAuthority(CompanyAuthorityReqVo reqVo);
......
...@@ -9,6 +9,7 @@ import com.pangding.web.authority.vo.reqvo.*; ...@@ -9,6 +9,7 @@ import com.pangding.web.authority.vo.reqvo.*;
import com.pangding.web.authority.service.AuthorityService; import com.pangding.web.authority.service.AuthorityService;
import com.pangding.web.authority.vo.*; import com.pangding.web.authority.vo.*;
import com.pangding.web.authority.vo.resvo.AuthorityListByLevelResVo; import com.pangding.web.authority.vo.resvo.AuthorityListByLevelResVo;
import com.pangding.web.authority.vo.resvo.AuthorityListResVo;
import com.pangding.web.authority.vo.resvo.AuthorityResVo; import com.pangding.web.authority.vo.resvo.AuthorityResVo;
import com.pangding.web.authority.vo.resvo.WebAuthorityResVo; import com.pangding.web.authority.vo.resvo.WebAuthorityResVo;
import com.yanzuoguang.util.base.ObjectHelper; import com.yanzuoguang.util.base.ObjectHelper;
...@@ -45,7 +46,7 @@ public class AuthorityServiceImpl implements AuthorityService { ...@@ -45,7 +46,7 @@ public class AuthorityServiceImpl implements AuthorityService {
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public List<AuthorityListByLevelResVo> save(AuthorityVo authorityVo) { public AuthorityListResVo save(AuthorityVo authorityVo) {
/*this.checkValid(authorityVo);*/ /*this.checkValid(authorityVo);*/
if (null == authorityVo.getPid() || authorityVo.getPid().isEmpty()){ if (null == authorityVo.getPid() || authorityVo.getPid().isEmpty()){
authorityVo.setPid(""); authorityVo.setPid("");
...@@ -106,7 +107,7 @@ public class AuthorityServiceImpl implements AuthorityService { ...@@ -106,7 +107,7 @@ public class AuthorityServiceImpl implements AuthorityService {
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public List<AuthorityListByLevelResVo> update(AuthorityVo authorityVo) { public AuthorityListResVo update(AuthorityVo authorityVo) {
/*this.checkValid(authorityVo);*/ /*this.checkValid(authorityVo);*/
if (null == authorityVo.getPid() || authorityVo.getPid().isEmpty()){ if (null == authorityVo.getPid() || authorityVo.getPid().isEmpty()){
authorityVo.setPid(""); authorityVo.setPid("");
...@@ -246,7 +247,7 @@ public class AuthorityServiceImpl implements AuthorityService { ...@@ -246,7 +247,7 @@ public class AuthorityServiceImpl implements AuthorityService {
} }
@Override @Override
public List<AuthorityListByLevelResVo> getListByLevel(AuthorityListReqVo reqVo) { public AuthorityListResVo getListByLevel(AuthorityListReqVo reqVo) {
List<AuthorityVo> parentList = authorityDao.getLevelOne(reqVo); List<AuthorityVo> parentList = authorityDao.getLevelOne(reqVo);
if (null == parentList || parentList.isEmpty()){ if (null == parentList || parentList.isEmpty()){
throw new CodeException("暂无一级权限,请添加"); throw new CodeException("暂无一级权限,请添加");
...@@ -259,7 +260,26 @@ public class AuthorityServiceImpl implements AuthorityService { ...@@ -259,7 +260,26 @@ public class AuthorityServiceImpl implements AuthorityService {
resVo.setChildList(childList); resVo.setChildList(childList);
resVoList.add(resVo); resVoList.add(resVo);
} }
return resVoList;
/*返回对象*/
AuthorityListResVo authorityListResVo = new AuthorityListResVo();
authorityListResVo.setAuthorityListByLevel(resVoList);
/*若roleId存在,则需要返回该角色拥有的权限列表*/
if (null != reqVo.getRoleId() && !reqVo.getRoleId().isEmpty()){
RoleAuthorityGetReqVo roleAuthorityGetReqVo = new RoleAuthorityGetReqVo();
roleAuthorityGetReqVo.setRoleId(reqVo.getRoleId());
List<RoleAuthorityVo> roleAuthorityVoList = roleAuthorityDao.loadList(roleAuthorityGetReqVo,RoleAuthorityVo.class);
List<String> authorityIdList = new ArrayList<>();
if (null != roleAuthorityVoList && !roleAuthorityVoList.isEmpty()){
for (RoleAuthorityVo roleAuthorityVo:roleAuthorityVoList) {
authorityIdList.add(roleAuthorityVo.getAuthorityId());
}
}
authorityListResVo.setAuthorityListByRole(authorityIdList);
}
return authorityListResVo;
} }
private List<AuthorityListByLevelResVo> getChildList(String id){ private List<AuthorityListByLevelResVo> getChildList(String id){
......
...@@ -9,6 +9,16 @@ public class AuthorityListReqVo { ...@@ -9,6 +9,16 @@ public class AuthorityListReqVo {
private String levelOne; private String levelOne;
private String roleId;
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
public String getLevelOne() { public String getLevelOne() {
return levelOne; return levelOne;
} }
......
package com.pangding.web.authority.vo.resvo;
import java.util.List;
/**
* @Author zhangjinyao
* @create 2019/6/15 17:43
*/
public class AuthorityListResVo {
private List<AuthorityListByLevelResVo> authorityListByLevel;
private List<String> authorityListByRole;
public List<AuthorityListByLevelResVo> getAuthorityListByLevel() {
return authorityListByLevel;
}
public void setAuthorityListByLevel(List<AuthorityListByLevelResVo> authorityListByLevel) {
this.authorityListByLevel = authorityListByLevel;
}
public List<String> getAuthorityListByRole() {
return authorityListByRole;
}
public void setAuthorityListByRole(List<String> authorityListByRole) {
this.authorityListByRole = authorityListByRole;
}
}
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