|
@ -2,6 +2,8 @@ package com.example.demo.serviceImpl; |
|
|
|
|
|
|
|
|
import com.example.demo.mapper.GeneralMapper; |
|
|
import com.example.demo.mapper.GeneralMapper; |
|
|
import com.example.demo.service.GeneralService; |
|
|
import com.example.demo.service.GeneralService; |
|
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
@ -11,6 +13,8 @@ import java.time.ZoneId; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @program: GOLD |
|
|
* @program: GOLD |
|
|
* @ClassName GeneralServiceImpl |
|
|
* @ClassName GeneralServiceImpl |
|
@ -21,7 +25,7 @@ import java.util.stream.Collectors; |
|
|
**/ |
|
|
**/ |
|
|
@Service |
|
|
@Service |
|
|
public class GeneralServiceImpl implements GeneralService { |
|
|
public class GeneralServiceImpl implements GeneralService { |
|
|
|
|
|
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(GeneralServiceImpl.class); |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private GeneralMapper generalMapper; |
|
|
private GeneralMapper generalMapper; |
|
@ -112,13 +116,20 @@ public class GeneralServiceImpl implements GeneralService { |
|
|
获取角色的地区权限列表 |
|
|
获取角色的地区权限列表 |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public List<String> getRoleMarket(String account) throws Exception { |
|
|
|
|
|
String market = generalMapper.getRoleMarket(account); |
|
|
|
|
|
if (market == null) |
|
|
|
|
|
throw new Exception("没有地区权限"); |
|
|
|
|
|
List<String> list = Arrays.asList(market.split(",")); |
|
|
|
|
|
return list; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public List<String> getRoleMarket(String account){ |
|
|
|
|
|
try { |
|
|
|
|
|
String market = generalMapper.getRoleMarket(account); |
|
|
|
|
|
if (market == null) { |
|
|
|
|
|
throw new Exception("没有地区权限"); |
|
|
|
|
|
} |
|
|
|
|
|
List<String> list = Arrays.asList(market.split(",")); |
|
|
|
|
|
return list; |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
// 记录日志 |
|
|
|
|
|
log.error("获取地区权限失败", e); |
|
|
|
|
|
// 重新抛出异常,或者根据需要返回一个默认值或空列表 |
|
|
|
|
|
throw new RuntimeException("获取地区权限失败", e); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}} |