浏览代码

添加分配角色和菜单

LiTaohong 7 年之前
父节点
当前提交
db0c9e2137

+ 4 - 4
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseUserRequestMapping.java

@ -28,7 +28,7 @@ public class BaseUserRequestMapping {
        public static final String message_fail_saasid_no_exist = "saasId no exist";
        public static final String message_fail_role_no_exist = "baseRole no exist";
        public static final String message_param_id_is_null = "baseRole id param cannot be null";
        public static final String message_fail_params_not_present = "baseRole id param cannot be null";
        public static final String message_param_saasid_is_null = "baseRole saasId param cannot be null";
        public static final String message_param_name_is_null = "baseRole name param cannot be null";
    }
@ -44,7 +44,7 @@ public class BaseUserRequestMapping {
        public static final String api_getByPhone = "/employee";
        public static final String api_getList="/employee/list";
        public static final String api_getListNoPage="/employee/listNoPage";
        public static final String api_getByEmployId = "/employee/{employId}";
        public static final String api_getRolesByEmployId = "/employee/{employId}";
        public static final String message_success_create="Employee create success";
@ -52,12 +52,12 @@ public class BaseUserRequestMapping {
        public static final String message_success_delete="Employee delete success";
        public static final String message_success_find="Employee find success";
        public static final String message_fail_name_exist = "baseRole name exist";
        public static final String message_fail_params_not_present = "employee all params must be present ";
        public static final String message_fail_name_is_null = "baseRole is null";
        public static final String message_fail_id_is_null = "id is null";
        public static final String message_fail_id_no_exist = "id no exist";
        public static final String message_fail_saasid_is_null = "saasId is null";
        public static final String message_param_saasid_is_null = "baseRole saasId param cannot be null";
        public static final String message_param_saasid_is_null = "employee saasId param cannot be null";
        public static final String message_fail_saasid_no_exist = "saasId no exist";
    }

+ 175 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/user/BaseEmployVO.java

@ -0,0 +1,175 @@
package com.yihu.jw.restmodel.base.user;
public class BaseEmployVO {
    private String id; //id
    private String saasId; //saasIDF
    private String name; //名字
    private String pyCode; //拼音
    private String sex; //性别
    private String photo; //头像
    private String skill;//专长
    private String workPortal;//医生门户首页
    private String email;//邮箱
    private String phone;//联系电话
    private String secondPhone;//备用电话
    private String familyTel;//家庭电话(固)
    private String officeTel;//办公电话(固)
    private String introduction;//简介
    private String jxzc;//教学职称
    private String lczc;//临床职称
    private String xlzc;//学历职称
    private String xzzc;//行政职称
    private Integer status;//-1 删除 0 禁用 1可用
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPyCode() {
        return pyCode;
    }
    public void setPyCode(String pyCode) {
        this.pyCode = pyCode;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    public String getSkill() {
        return skill;
    }
    public void setSkill(String skill) {
        this.skill = skill;
    }
    public String getWorkPortal() {
        return workPortal;
    }
    public void setWorkPortal(String workPortal) {
        this.workPortal = workPortal;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getSecondPhone() {
        return secondPhone;
    }
    public void setSecondPhone(String secondPhone) {
        this.secondPhone = secondPhone;
    }
    public String getFamilyTel() {
        return familyTel;
    }
    public void setFamilyTel(String familyTel) {
        this.familyTel = familyTel;
    }
    public String getOfficeTel() {
        return officeTel;
    }
    public void setOfficeTel(String officeTel) {
        this.officeTel = officeTel;
    }
    public String getIntroduction() {
        return introduction;
    }
    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }
    public String getJxzc() {
        return jxzc;
    }
    public void setJxzc(String jxzc) {
        this.jxzc = jxzc;
    }
    public String getLczc() {
        return lczc;
    }
    public void setLczc(String lczc) {
        this.lczc = lczc;
    }
    public String getXlzc() {
        return xlzc;
    }
    public void setXlzc(String xlzc) {
        this.xlzc = xlzc;
    }
    public String getXzzc() {
        return xzzc;
    }
    public void setXzzc(String xzzc) {
        this.xzzc = xzzc;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

+ 85 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/user/BaseMenuVO.java

@ -0,0 +1,85 @@
package com.yihu.jw.restmodel.base.user;
public class BaseMenuVO {
    private String id;
    private String url;//请求路径
    private String method;//请求方式 get post
    private String saasId;
    private String parentId;
    private String name;
    private Integer sort;
    private Integer status;
    private String remark;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public String getMethod() {
        return method;
    }
    public void setMethod(String method) {
        this.method = method;
    }
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getParentId() {
        return parentId;
    }
    public void setParentId(String parentId) {
        this.parentId = parentId;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 50 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/user/BaseRoleVO.java

@ -0,0 +1,50 @@
package com.yihu.jw.restmodel.base.user;
public class BaseRoleVO {
    private String id;
    private String saasId;
    private String name;
    private Integer status;
    private String remark;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 67 - 2
svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/BaseRoleController.java

@ -1,20 +1,29 @@
package com.yihu.jw.business.user.contorller;
import com.yihu.jw.base.user.BaseEmployRoleDO;
import com.yihu.jw.base.user.BaseMenuDO;
import com.yihu.jw.base.user.BaseRoleDO;
import com.yihu.jw.base.user.BaseRoleMenuDO;
import com.yihu.jw.business.user.service.BaseRoleMenuService;
import com.yihu.jw.business.user.service.BaseRoleService;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.exception.code.ExceptionCode;
import com.yihu.jw.restmodel.base.user.BaseEmployVO;
import com.yihu.jw.restmodel.base.user.BaseRoleVO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.rm.base.BaseUserRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
@ -77,16 +86,47 @@ public class BaseRoleController extends EnvelopRestController {
    }
    @PostMapping(value = BaseUserRequestMapping.BaseRole.api_getList, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "查询多个角色", notes = "根据平台id查询所有角色信息")
    @ApiOperation(value = "查询多个角色", notes = "根据平台id查询所有角色信息,不分页")
    public Envelop getRoleListBySaasId(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
        try{
            BaseRoleDO baseRoleDO = toEntity(jsonData,BaseRoleDO.class);
            return Envelop.getSuccess(BaseUserRequestMapping.BaseRole.message_success_find,baseRoleService.findAllBySaasId(baseRoleDO.getSaasId()));
            return Envelop.getSuccessList(BaseUserRequestMapping.BaseRole.message_success_find,baseRoleService.findAllBySaasId(baseRoleDO.getSaasId()));
        } catch (ApiException e){
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @ApiOperation(value = "根据指定条件查询所有角色列表,分页")
    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_getList)
    public Envelop getRoleListPage(@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,name,remark") @RequestParam(value = "fields", required = false) String fields,
                                              @ApiParam(name = "filters", value = "过滤器,为空检索所有条件") @RequestParam(value = "filters", required = false) String filters,
                                              @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime") @RequestParam(value = "sorts", required = false) String sorts,
                                              @ApiParam(name = "size", value = "分页大小", defaultValue = "15") @RequestParam(value = "size", required = false) int size,
                                              @ApiParam(name = "page", value = "页码", defaultValue = "1") @RequestParam(value = "page", required = false) int page,
                                              HttpServletRequest request, HttpServletResponse response) throws ParseException {
        if (StringUtils.isBlank(filters)) {
            return Envelop.getError(BaseUserRequestMapping.BaseRole.message_fail_params_not_present, ExceptionCode.common_error_params_code);
        } else {
            filters = "status<>-1;" + filters;
        }
        if (StringUtils.isBlank(sorts)) {
            sorts = "-updateTime";
        }
        //得到list数据
        List<BaseRoleVO> list = baseRoleService.search(fields, filters, sorts, page, size);
        //获取总数
        long count = baseRoleService.getCount(filters);
        //封装头信息
        pagedResponse(request, response, count, page, size);
        //封装返回格式
        List<BaseRoleVO> mFunctions = convertToModels(list, new ArrayList<>(list.size()), BaseRoleVO.class, fields);
        return Envelop.getSuccessListWithPage(BaseUserRequestMapping.BaseRole.message_success_find, mFunctions, page, size, count);
    }
    @PostMapping(value = BaseUserRequestMapping.BaseRole.api_delete, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "删除角色", notes = "根据角色id删除角色")
    public Envelop deleteRole(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
@ -134,6 +174,31 @@ public class BaseRoleController extends EnvelopRestController {
    }
    @ApiOperation(value = "修改角色菜单")
    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_update)
    public Envelop updateMenuForRole(@ApiParam(name = "employId", value = "employId", required = true) @RequestParam(value = "employId", required = true) String id,
                                    @ApiParam(name = "newMenuId", value = "newMenuId", required = true) @RequestParam(value = "roleId", required = true) String newMenuId) {
        try {
            BaseRoleMenuDO baseEmployRoleDO = new BaseRoleMenuDO();
            baseEmployRoleDO.setId(id);
            baseEmployRoleDO.setMenuId(newMenuId);
            return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_delete, this.baseRoleMenuService.updateBaseEmployRoleDO(baseEmployRoleDO));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @ApiOperation(value = "查看角色菜单列表,不分页")
    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_getRolesByEmployId)
    public Envelop findMenuListForRole(@ApiParam(name = "roleId", value = "roleId", required = true) @RequestParam(value = "roleId", required = true) String roleId) {
        try {
            return Envelop.getSuccessList(BaseUserRequestMapping.BaseEmploy.message_success_delete, this.baseRoleMenuService.findAllByRoleId(roleId));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @ApiOperation(value = "删除角色菜单", notes = "删除角色菜单")
    @PostMapping(value = BaseUserRequestMapping.BaseRole.api_delete, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Envelop deleteMenuForRole(@ApiParam(name = "roleId", value = "", defaultValue = "") @RequestBody String roleId,

+ 66 - 19
svr/svr-base/src/main/java/com/yihu/jw/business/user/contorller/EmployController.java

@ -1,20 +1,29 @@
package com.yihu.jw.business.user.contorller;
import com.yihu.jw.base.base.FunctionDO;
import com.yihu.jw.base.user.BaseEmployDO;
import com.yihu.jw.base.user.BaseEmployRoleDO;
import com.yihu.jw.business.user.service.EmployRoleService;
import com.yihu.jw.business.user.service.EmployService;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.exception.code.ExceptionCode;
import com.yihu.jw.restmodel.base.base.FunctionVO;
import com.yihu.jw.restmodel.base.user.BaseEmployVO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.base.BaseUserRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
@ -67,18 +76,19 @@ public class EmployController extends EnvelopRestController {
    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_getList)
    public Envelop getAllEmployeeBySaasId(@ApiParam(name = "saasId", value = "saasId", required = true) @RequestParam(value = "saasId", required = true) String saasId) {
        try{
            return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_find,this.employService.findAllBySaasId(saasId));
            return Envelop.getSuccessList(BaseUserRequestMapping.BaseEmploy.message_success_find,this.employService.findAllBySaasId(saasId));
        } catch (ApiException e){
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @ApiOperation(value = "根据手机号和saasId查找用户")
    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_getList)
    public Envelop getEmployeeByPhoneAndSaasId(@ApiParam(name = "phone", value = "phone", required = true) @RequestParam(value = "phone", required = true) String phone,
                                               @ApiParam(name = "saasId", value = "saasId", required = true) @RequestParam(value = "saasId", required = true) String saasId) {
        try {
            return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_find, this.employService.findAllBySaasId(saasId));
            return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_find, this.employService.findByPhoneAndSaasId(phone,saasId));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
@ -89,12 +99,42 @@ public class EmployController extends EnvelopRestController {
    public Envelop getListByNameAndSaasId(@ApiParam(name = "saasId", value = "saasId", required = true) @RequestParam(value = "saasId", required = true) String saasId,
                                          @ApiParam(name = "name", value = "name", required = true) @RequestParam(value = "name", required = true) String name) {
        try{
            return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_find,this.employService.findAllByNameAndSaasId(name,saasId));
            return Envelop.getSuccessList(BaseUserRequestMapping.BaseEmploy.message_success_find,this.employService.findAllByNameAndSaasId(name,saasId));
        } catch (ApiException e){
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @ApiOperation(value = "根据指定条件查询用户列表,分页")
    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_getList)
    public Envelop getListPageByNameAndSaasId(@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,name,sex,photo,skill,email,phone,family_tel,introduction,jxzc,lczc,xlzc,xzzc") @RequestParam(value = "fields", required = false) String fields,
                                              @ApiParam(name = "filters", value = "过滤器,为空检索所有条件") @RequestParam(value = "filters", required = false) String filters,
                                              @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime") @RequestParam(value = "sorts", required = false) String sorts,
                                              @ApiParam(name = "size", value = "分页大小", defaultValue = "15") @RequestParam(value = "size", required = false) int size,
                                              @ApiParam(name = "page", value = "页码", defaultValue = "1") @RequestParam(value = "page", required = false) int page,
                                              HttpServletRequest request, HttpServletResponse response) throws ParseException {
        if (StringUtils.isBlank(filters)) {
            return Envelop.getError(BaseUserRequestMapping.BaseEmploy.message_fail_params_not_present, ExceptionCode.common_error_params_code);
        } else {
            filters = "status<>-1;" + filters;
        }
        if (StringUtils.isBlank(sorts)) {
            sorts = "-updateTime";
        }
        //得到list数据
        List<BaseEmployVO> list = employService.search(fields, filters, sorts, page, size);
        //获取总数
        long count = employService.getCount(filters);
        //封装头信息
        pagedResponse(request, response, count, page, size);
        //封装返回格式
        List<BaseEmployVO> mFunctions = convertToModels(list, new ArrayList<>(list.size()), BaseEmployVO.class, fields);
        return Envelop.getSuccessListWithPage(BaseUserRequestMapping.BaseEmploy.message_success_find, mFunctions, page, size, count);
    }
    @ApiOperation(value = "给某一用户新增角色")
    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_create)
@ -119,6 +159,29 @@ public class EmployController extends EnvelopRestController {
        }
    }
    @ApiOperation(value = "修改用户角色")
    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_update)
    public Envelop updateEmployRole(@ApiParam(name = "employId", value = "employId", required = true) @RequestParam(value = "employId", required = true) String id,
                                    @ApiParam(name = "roleId", value = "roleId", required = true) @RequestParam(value = "roleId", required = true) String newRoleId) {
        try {
            BaseEmployRoleDO baseEmployRoleDO = new BaseEmployRoleDO();
            baseEmployRoleDO.setId(id);
            baseEmployRoleDO.setRoleId(newRoleId);
            return Envelop.getSuccess(BaseUserRequestMapping.BaseEmploy.message_success_delete, this.employRoleService.updateBaseEmployRoleDO(baseEmployRoleDO));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @ApiOperation(value = "查看用户角色列表,不分页")
    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_getRolesByEmployId)
    public Envelop findEmployRoleList(@ApiParam(name = "employId", value = "employId", required = true) @RequestParam(value = "employId", required = true) String employId) {
        try {
            return Envelop.getSuccessList(BaseUserRequestMapping.BaseEmploy.message_success_delete, this.employRoleService.findAllByEmployId(employId));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @ApiOperation(value = "删除用户角色")
    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_delete)
@ -137,20 +200,4 @@ public class EmployController extends EnvelopRestController {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
}

+ 15 - 2
svr/svr-base/src/main/java/com/yihu/jw/business/user/service/BaseRoleMenuService.java

@ -1,7 +1,9 @@
package com.yihu.jw.business.user.service;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.jw.base.user.BaseMenuDO;
import com.yihu.jw.base.user.BaseRoleMenuDO;
import com.yihu.jw.business.user.dao.BaseMenuDao;
import com.yihu.jw.business.user.dao.BaseRoleMenuDao;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.exception.code.ExceptionCode;
@ -11,6 +13,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
@ -23,6 +26,9 @@ public class BaseRoleMenuService extends BaseJpaService<BaseRoleMenuDO,BaseRoleM
    @Autowired
    private BaseRoleMenuDao baseRoleMenuDao;
    @Autowired
    private BaseMenuDao baseMenuDao;
    /**
     * 新增角色菜单
     * @param baseRoleMenuDO
@ -61,6 +67,7 @@ public class BaseRoleMenuService extends BaseJpaService<BaseRoleMenuDO,BaseRoleM
        if (baseRoleMenuDO.getMenuId().equals(OldbaseRoleMenuDO.getMenuId())) {
            throw new ApiException(BaseUserRequestMapping.BaseRoleMenu.message_fail_same_menuId, ExceptionCode.common_error_params_code);
        }
        baseRoleMenuDO.setRoleId(OldbaseRoleMenuDO.getRoleId());
        return this.baseRoleMenuDao.save(baseRoleMenuDO);
    }
@ -70,7 +77,7 @@ public class BaseRoleMenuService extends BaseJpaService<BaseRoleMenuDO,BaseRoleM
     * @param roleId
     * @return
     */
    public List<BaseRoleMenuDO> findAllByRoleId(String roleId){
    public List<BaseMenuDO> findAllByRoleId(String roleId){
        if (StringUtils.isEmpty(roleId)) {
            throw new ApiException(BaseUserRequestMapping.BaseRoleMenu.message_fail_roleId_is_null, ExceptionCode.common_error_params_code);
        }
@ -78,7 +85,13 @@ public class BaseRoleMenuService extends BaseJpaService<BaseRoleMenuDO,BaseRoleM
        if (null == list || list.size() == 0) {
            throw new ApiException(BaseUserRequestMapping.BaseRoleMenu.message_fail_baseRoleMenu_no_exist,ExceptionCode.common_error_params_code);
        }
        return list;
        List<String> ids = new ArrayList<>();
        for(BaseRoleMenuDO baseRoleMenuDO:list){
            ids.add(baseRoleMenuDO.getMenuId());
        }
        Iterable<String> iterable = (Iterable<String>)ids.iterator();
        List<BaseMenuDO> result = (List<BaseMenuDO>)baseMenuDao.findAll(iterable);
        return result;
    }

+ 15 - 2
svr/svr-base/src/main/java/com/yihu/jw/business/user/service/EmployRoleService.java

@ -3,6 +3,8 @@ package com.yihu.jw.business.user.service;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.jw.base.user.BaseEmployDO;
import com.yihu.jw.base.user.BaseEmployRoleDO;
import com.yihu.jw.base.user.BaseRoleDO;
import com.yihu.jw.business.user.dao.BaseRoleDao;
import com.yihu.jw.business.user.dao.EmployRoleDao;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.exception.code.ExceptionCode;
@ -13,6 +15,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
@ -25,6 +28,9 @@ public class EmployRoleService extends BaseJpaService<BaseEmployRoleDO,EmployRol
    @Autowired
    private EmployRoleDao employRoleDao;
    @Autowired
    private BaseRoleDao baseRoleDao;
    /**
     * 新增用户角色
     * @param baseEmployRoleDO
@ -65,6 +71,7 @@ public class EmployRoleService extends BaseJpaService<BaseEmployRoleDO,EmployRol
        if (baseEmployRoleDO.getRoleId().equals(OldbaseEmployRoleDO.getRoleId())) {
            throw new ApiException(BaseUserRequestMapping.BaseEmployRole.message_fail_same_roleId, ExceptionCode.common_error_params_code);
        }
        baseEmployRoleDO.setEmployId(OldbaseEmployRoleDO.getEmployId());
        return this.employRoleDao.save(baseEmployRoleDO);
    }
@ -74,7 +81,7 @@ public class EmployRoleService extends BaseJpaService<BaseEmployRoleDO,EmployRol
     * @param employId
     * @return
     */
    public List<BaseEmployRoleDO> findAllByEmployId(String employId){
    public List<BaseRoleDO> findAllByEmployId(String employId){
        if (StringUtils.isEmpty(employId)) {
            throw new ApiException(BaseUserRequestMapping.BaseEmployRole.message_fail_employId_is_null, ExceptionCode.common_error_params_code);
        }
@ -82,7 +89,13 @@ public class EmployRoleService extends BaseJpaService<BaseEmployRoleDO,EmployRol
        if (null == list || list.size() == 0) {
            throw new ApiException(BaseUserRequestMapping.BaseEmployRole.message_fail_employeeRole_no_exist,ExceptionCode.common_error_params_code);
        }
        return list;
        List ids = new ArrayList<>();
        for(BaseEmployRoleDO baseEmployRoleDO:list){
            ids.add(baseEmployRoleDO.getRoleId());
        }
        Iterable iterable = (Iterable)ids.iterator();
        List<BaseRoleDO> result = (List<BaseRoleDO>)baseRoleDao.findAll(iterable);
        return result;
    }

+ 60 - 3
web-gateway/src/main/java/com/yihu/jw/controller/base/user/EmployController.java

@ -113,9 +113,9 @@ public class EmployController extends EnvelopRestController {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    @GetMapping(value = BaseUserContants.BaseRole.api_getListNoPage)
    @GetMapping(value = BaseUserContants.Employee.api_getListNoPage)
    @ApiOperation(value = "获取功能列表,不分页")
    public Envelop getListNoPage(
    public Envelop getRolesListNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,name,saasId,sex,phone,email,jxzc,lczcn,xlzc,xzzc,createUser,remark")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
@ -129,7 +129,64 @@ public class EmployController extends EnvelopRestController {
                filterStr+="saasId="+jsonResult.get("saasId")+";";
            }
        }
        return fegin.getListNoPage(fields, filterStr, sorts);
        return fegin.getRoleList(fields);
    }
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    @PostMapping(value = BaseUserContants.Employee.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "新增用戶角色", notes = "新增用戶角色")
    public Envelop createEmployRoles(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) throws JiWeiException {
        return fegin.create(jsonData);
    }
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    @PostMapping(value = BaseUserContants.Employee.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "新增用戶角色", notes = "新增用戶角色")
    public Envelop updateEmployRoles(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) throws JiWeiException {
        return fegin.create(jsonData);
    }
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    @PostMapping(value = BaseUserContants.Employee.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "新增用戶角色", notes = "新增用戶角色")
    public Envelop deleteEmployRoles(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) throws JiWeiException {
        return fegin.create(jsonData);
    }
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    @PostMapping(value = BaseUserContants.Employee.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "新增用戶角色", notes = "新增用戶角色")
    public Envelop getRoleList(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) throws JiWeiException {
        return fegin.create(jsonData);
    }
}

+ 20 - 6
web-gateway/src/main/java/com/yihu/jw/feign/base/user/EmployFeign.java

@ -20,19 +20,19 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping(value = BaseRequestMapping.api_base_common)
public interface EmployFeign {
    @RequestMapping(value = BaseUserRequestMapping.BaseRole.api_create,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,method = RequestMethod.POST)
    @RequestMapping(value = BaseUserRequestMapping.BaseEmploy.api_create,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,method = RequestMethod.POST)
    Envelop create(@RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value =  BaseUserRequestMapping.BaseRole.api_update,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,method = RequestMethod.PUT)
    @RequestMapping(value =  BaseUserRequestMapping.BaseEmploy.api_update,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,method = RequestMethod.PUT)
    Envelop update(@RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value =  BaseUserRequestMapping.BaseRole.api_delete,method = RequestMethod.DELETE)
    @RequestMapping(value =  BaseUserRequestMapping.BaseEmploy.api_delete,method = RequestMethod.DELETE)
    Envelop delete(@PathVariable String id) throws JiWeiException;
    @GetMapping(value = BaseUserRequestMapping.BaseRole.api_getById)
    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_getById)
    Envelop findById(@PathVariable(value = "id", required = true) String id) throws JiWeiException;
    @RequestMapping(value = BaseUserRequestMapping.BaseRole.api_getList, method = RequestMethod.GET)
    @RequestMapping(value = BaseUserRequestMapping.BaseEmploy.api_getList, method = RequestMethod.GET)
    Envelop getList(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
@ -40,9 +40,23 @@ public interface EmployFeign {
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page) throws JiWeiException;
    @GetMapping(value = BaseUserRequestMapping.BaseRole.api_getListNoPage)
    @GetMapping(value = BaseUserRequestMapping.BaseEmploy.api_getListNoPage)
    Envelop getListNoPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts) throws JiWeiException;
    @RequestMapping(value = BaseUserRequestMapping.BaseEmployRole.api_create,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,method = RequestMethod.POST)
    Envelop createEmployRoles(@RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value = BaseUserRequestMapping.BaseEmployRole.api_update,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,method = RequestMethod.POST)
    Envelop updateEmployRoles(@RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value = BaseUserRequestMapping.BaseEmployRole.api_delete,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,method = RequestMethod.POST)
    Envelop deleteEmployRoles(@RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value = BaseUserRequestMapping.BaseEmployRole.api_getListNoPage,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,method = RequestMethod.POST)
    Envelop getRoleList(@RequestBody String jsonData) throws JiWeiException;
}