Browse Source

查角色

master
sunyuchao 3 years ago
parent
commit
fba0a7772b
  1. 49
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/GovRoleListDTO.java
  2. 9
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/GovAccessFeignClient.java
  3. 11
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallBack.java
  4. 6
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovRoleController.java
  5. 2
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovRoleDao.java
  6. 3
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/GovRoleService.java
  7. 6
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovRoleServiceImpl.java
  8. 12
      epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovRoleDao.xml

49
epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/GovRoleListDTO.java

@ -0,0 +1,49 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 角色管理
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-18
*/
@Data
public class GovRoleListDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 角色名称
*/
private String name;
}

9
epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/GovAccessFeignClient.java

@ -2,10 +2,8 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.GetStaffExistRoleFormDTO; import com.epmet.dto.GovRoleDTO;
import com.epmet.dto.form.InitDefaultOperationsFormDTO; import com.epmet.dto.form.*;
import com.epmet.dto.form.ListOpePermsFormDTO;
import com.epmet.dto.form.RoleUserFormDTO;
import com.epmet.dto.result.NewUserRoleResultDTO; import com.epmet.dto.result.NewUserRoleResultDTO;
import com.epmet.feign.fallback.GovAccessFeignClientFallBackFactory; import com.epmet.feign.fallback.GovAccessFeignClientFallBackFactory;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
@ -52,4 +50,7 @@ public interface GovAccessFeignClient {
@PostMapping("/gov/access/govroleuser/getStaffExistRole") @PostMapping("/gov/access/govroleuser/getStaffExistRole")
Result<List<NewUserRoleResultDTO>> getStaffExistRole(@RequestBody GetStaffExistRoleFormDTO formDTO); Result<List<NewUserRoleResultDTO>> getStaffExistRole(@RequestBody GetStaffExistRoleFormDTO formDTO);
@PostMapping("/gov/access/govrole/getgovrole")
Result<GovRoleDTO> getGovRole(@RequestBody GovRoleListDTO formDTO);
} }

11
epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallBack.java

@ -3,10 +3,8 @@ package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.GetStaffExistRoleFormDTO; import com.epmet.dto.GovRoleDTO;
import com.epmet.dto.form.InitDefaultOperationsFormDTO; import com.epmet.dto.form.*;
import com.epmet.dto.form.ListOpePermsFormDTO;
import com.epmet.dto.form.RoleUserFormDTO;
import com.epmet.dto.result.NewUserRoleResultDTO; import com.epmet.dto.result.NewUserRoleResultDTO;
import com.epmet.feign.GovAccessFeignClient; import com.epmet.feign.GovAccessFeignClient;
@ -40,4 +38,9 @@ public class GovAccessFeignClientFallBack implements GovAccessFeignClient {
public Result<List<NewUserRoleResultDTO>> getStaffExistRole(GetStaffExistRoleFormDTO formDTO) { public Result<List<NewUserRoleResultDTO>> getStaffExistRole(GetStaffExistRoleFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "getStaffExistRole", formDTO); return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "getStaffExistRole", formDTO);
} }
@Override
public Result<GovRoleDTO> getGovRole(GovRoleListDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "getGovRole", formDTO);
}
} }

6
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovRoleController.java

@ -27,6 +27,7 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.GovRoleDTO; import com.epmet.dto.GovRoleDTO;
import com.epmet.dto.form.GovRoleListDTO;
import com.epmet.service.GovRoleMenuService; import com.epmet.service.GovRoleMenuService;
import com.epmet.service.GovRoleService; import com.epmet.service.GovRoleService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -102,4 +103,9 @@ public class GovRoleController {
return new Result<List<GovRoleDTO>>().ok(data); return new Result<List<GovRoleDTO>>().ok(data);
} }
@PostMapping("getgovrole")
public Result<GovRoleDTO> getGovRole(@RequestBody GovRoleListDTO fromDTO){
return new Result<GovRoleDTO>().ok(govRoleService.getGovRole(fromDTO));
}
} }

2
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovRoleDao.java

@ -9,6 +9,7 @@
package com.epmet.dao; package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.GovRoleDTO;
import com.epmet.dto.result.NewUserRoleResultDTO; import com.epmet.dto.result.NewUserRoleResultDTO;
import com.epmet.entity.GovRoleEntity; import com.epmet.entity.GovRoleEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -33,4 +34,5 @@ public interface GovRoleDao extends BaseDao<GovRoleEntity> {
*/ */
List<NewUserRoleResultDTO> getCustomerRoles(@Param("customerId")String customerId); List<NewUserRoleResultDTO> getCustomerRoles(@Param("customerId")String customerId);
GovRoleDTO selectGovRole(@Param("customerId") String customerId, @Param("name") String name);
} }

3
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/GovRoleService.java

@ -20,6 +20,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.GovRoleDTO; import com.epmet.dto.GovRoleDTO;
import com.epmet.dto.form.GovRoleListDTO;
import com.epmet.entity.GovRoleEntity; import com.epmet.entity.GovRoleEntity;
import java.util.List; import java.util.List;
@ -92,4 +93,6 @@ public interface GovRoleService extends BaseService<GovRoleEntity> {
* @date 2020-03-18 * @date 2020-03-18
*/ */
void delete(String[] ids); void delete(String[] ids);
GovRoleDTO getGovRole(GovRoleListDTO fromDTO);
} }

6
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovRoleServiceImpl.java

@ -28,6 +28,7 @@ import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.GovRoleDao; import com.epmet.dao.GovRoleDao;
import com.epmet.dto.GovRoleDTO; import com.epmet.dto.GovRoleDTO;
import com.epmet.dto.form.GovRoleListDTO;
import com.epmet.entity.GovRoleEntity; import com.epmet.entity.GovRoleEntity;
import com.epmet.redis.GovRoleRedis; import com.epmet.redis.GovRoleRedis;
import com.epmet.service.GovRoleMenuService; import com.epmet.service.GovRoleMenuService;
@ -122,4 +123,9 @@ public class GovRoleServiceImpl extends BaseServiceImpl<GovRoleDao, GovRoleEntit
govRoleUserService.deleteByRoleIds(ids); govRoleUserService.deleteByRoleIds(ids);
} }
@Override
public GovRoleDTO getGovRole(GovRoleListDTO fromDTO) {
return baseDao.selectGovRole(fromDTO.getCustomerId(), fromDTO.getName());
}
} }

12
epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovRoleDao.xml

@ -12,4 +12,16 @@
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId} AND CUSTOMER_ID = #{customerId}
</select> </select>
<select id="selectGovRole" resultType="com.epmet.dto.GovRoleDTO">
SELECT
*
FROM gov_role
WHERE
del_flag = 0
AND customer_id = #{customerId}
AND `name` = #{name}
LIMIT 1
</select>
</mapper> </mapper>

Loading…
Cancel
Save