getRolesByNamesAndSource
This commit is contained in:
@@ -136,4 +136,6 @@ public interface SysRoleMapper {
|
||||
*/
|
||||
List<SysRoleDO> selectBySynDingRoleIdAndSource( @Param("source") String source, @Param("synDingRoleId") Long synDingRoleId);
|
||||
|
||||
List<SysRoleDO> getRolesByNamesAndSource(@Param("roleNames") List<String> roleNames, @Param("source") String source);
|
||||
|
||||
}
|
||||
|
||||
@@ -347,4 +347,16 @@
|
||||
ORDER BY priority
|
||||
</select>
|
||||
|
||||
<select id="getRolesByNamesAndSource" resultType="com.coolcollege.intelligent.model.system.SysRoleDO">
|
||||
select
|
||||
id as id,
|
||||
role_name as roleName,
|
||||
role_auth as roleAuth
|
||||
from sys_role_${enterpriseId}
|
||||
where source = #{source} and role_name in
|
||||
<foreach item="roleName" collection="roleNames" open="(" separator="," close=")">
|
||||
#{roleName}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface SysRoleService {
|
||||
|
||||
Boolean checkIsAdmin(String userId);
|
||||
|
||||
Map<String, Long> getXfsgRoles();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class LinePayServiceImpl implements LinePayService {
|
||||
fillLinePay(false, linePayDO, request, partnerUser);
|
||||
linePayDAO.updateLinePay(linePayDO);
|
||||
}
|
||||
|
||||
|
||||
lineInfo.setWorkflowSubStage(WorkflowSubStageEnum.PAY_DEPOSIT.getCode());
|
||||
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.PAY_DEPOSIT_50.getCode());
|
||||
lineInfoMapper.insertOrUpdate(lineInfo);
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.cool.store.service.impl;
|
||||
|
||||
import com.cool.store.entity.SysRoleDO;
|
||||
import com.cool.store.enums.Role;
|
||||
import com.cool.store.enums.RoleSourceEnum;
|
||||
import com.cool.store.enums.UserRoleEnum;
|
||||
import com.cool.store.mapper.SysRoleMapper;
|
||||
import com.cool.store.service.SysRoleService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -10,7 +12,10 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 角色service
|
||||
@@ -33,5 +38,15 @@ public class SysRoleServiceImpl implements SysRoleService {
|
||||
.anyMatch(role-> StringUtils.equals(Role.MASTER.getRoleEnum(),role.getRoleEnum()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Long> getXfsgRoles() {
|
||||
List<String> xfsgRoleNames = Arrays.stream(UserRoleEnum.values())
|
||||
.map(UserRoleEnum::getDesc)
|
||||
.collect(Collectors.toList());
|
||||
List<SysRoleDO> sysRoleDOList = sysRoleMapper.getRolesByNamesAndSource(xfsgRoleNames, RoleSourceEnum.CREATE.getCode());
|
||||
Map<String, Long> sysRoleDOMap = sysRoleDOList.stream().collect(Collectors.toMap(k -> k.getRoleName(), v -> v.getId(), (k1, k2) -> k1));
|
||||
return sysRoleDOMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.cool.store.controller.webb;
|
||||
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.SysRoleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/pc/sysRole")
|
||||
@Api(tags = "角色信息")
|
||||
@Slf4j
|
||||
public class SysRoleController {
|
||||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@GetMapping(path = "/getXfsgRoles")
|
||||
public ResponseResult<Map<String, Long>> getXfsgRoles() {
|
||||
return ResponseResult.success(sysRoleService.getXfsgRoles());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user