Commit 5b9f64b1 authored by zjy's avatar zjy

8.20

parent 74429c28
......@@ -3,6 +3,7 @@ package com.pangding.web.authority.controller;
import com.pangding.web.authority.vo.RoleVo;
import com.pangding.web.authority.vo.UserVo;
import com.pangding.web.authority.vo.reqvo.AddReqVo;
import com.pangding.web.authority.vo.reqvo.CountByRoleReqVo;
import com.pangding.web.authority.vo.reqvo.ListRoleReqVo;
import com.pangding.web.authority.vo.reqvo.WebRoleReqVo;
......@@ -111,4 +112,19 @@ public class RoleController {
roleServiceImpl.delete(webRoleReqVo);
return new ResponseResult();
}
/**
* 给指定角色添加权限
* @param reqVo
* @return
*/
@RequestMapping(value = "/add",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseResult add(@RequestBody AddReqVo reqVo){
CheckerHelper.newInstance()
.notBlankCheck("roleId",reqVo.getRoleId())
.notBlankCheck("authorityId",reqVo.getAuthorityId())
.checkException();
roleServiceImpl.add(reqVo);
return new ResponseResult();
}
}
......@@ -2,6 +2,7 @@ package com.pangding.web.authority.service;
import com.pangding.web.authority.vo.AuthorityVo;
import com.pangding.web.authority.vo.UserVo;
import com.pangding.web.authority.vo.reqvo.AddReqVo;
import com.pangding.web.authority.vo.reqvo.CountByRoleReqVo;
import com.pangding.web.authority.vo.reqvo.ListRoleReqVo;
import com.pangding.web.authority.vo.reqvo.WebRoleReqVo;
......@@ -108,4 +109,5 @@ public interface RoleService {
*/
PageSizeData<UserVo> countByRole(CountByRoleReqVo reqVo);
void add(AddReqVo reqVo);
}
......@@ -310,4 +310,12 @@ public class RoleServiceImpl implements RoleService {
public PageSizeData<UserVo> countByRole(CountByRoleReqVo reqVo) {
return userDaoImpl.countByRole(reqVo);
}
@Override
public void add(AddReqVo reqVo) {
RoleAuthorityVo roleAuthorityVo = new RoleAuthorityVo();
ObjectHelper.writeWithFrom(roleAuthorityVo,reqVo);
roleAuthorityVo.setId(StringHelper.getNewID());
roleAuthorityDaoImpl.create(roleAuthorityVo);
}
}
package com.pangding.web.authority.vo.reqvo;
/**
* @Author zhangjinyao
* @create 2019/8/20 16:54
*/
public class AddReqVo {
private String reqId;
private String roleId;
private String authorityId;
public String getReqId() {
return reqId;
}
public void setReqId(String reqId) {
this.reqId = reqId;
}
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
public String getAuthorityId() {
return authorityId;
}
public void setAuthorityId(String authorityId) {
this.authorityId = authorityId;
}
}
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