监督角色功能控制

This commit is contained in:
yss
2023-04-23 14:21:16 +08:00
parent 36b1aca3ed
commit b28d4651ee
5 changed files with 88 additions and 0 deletions

View File

@ -9,4 +9,12 @@ import org.springframework.stereotype.Repository;
public interface BizFuncSwitchConfigMapper extends BaseMapper<BizFuncSwitchConfig> { public interface BizFuncSwitchConfigMapper extends BaseMapper<BizFuncSwitchConfig> {
Integer selectByType(String type); Integer selectByType(String type);
/**
* 监督角色功能根据是否有次账号控制
* @param role
* @param account
* @return
*/
String selectByUser(String role,String account);
} }

View File

@ -13,4 +13,8 @@
resultType="java.lang.Integer"> resultType="java.lang.Integer">
SELECT active FROM biz_func_switch_config WHERE `type` = #{type} SELECT active FROM biz_func_switch_config WHERE `type` = #{type}
</select> </select>
<select id="selectByUser"
resultType="java.lang.String ">
SELECT account FROM maint_base_user WHERE `role` = #{role} and account=#{account}
</select>
</mapper> </mapper>

View File

@ -0,0 +1,28 @@
package com.chinaunicom.mall.ebtp.extend.userswitch;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
import com.chinaunicom.mall.ebtp.extend.userswitch.service.UserSwitchService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
@Api(tags = "用户控制")
@RequestMapping("/v1/userswitch")
public class UserSwitchController {
@Resource
private UserSwitchService userSwitchService;
/**
* 监督角色功能控制
* @param key
* @param role
* @return
*/
@PostMapping({"/findUser/{key}/{role}"})
public BaseResponse<Boolean> findUser(@PathVariable String key,@PathVariable String role){
return BaseResponse.success(userSwitchService.findUser(key,role));
}
}

View File

@ -0,0 +1,17 @@
package com.chinaunicom.mall.ebtp.extend.userswitch.service;
/**
* 监督角色控制
* @author yanss
* @date 2023/04/23
*/
public interface UserSwitchService {
/**
*
* @param key
* @param role
* @return
*/
Boolean findUser(String key, String role);
}

View File

@ -0,0 +1,31 @@
package com.chinaunicom.mall.ebtp.extend.userswitch.service.impl;
import com.chinaunicom.mall.ebtp.extend.funcswitch.dao.BizFuncSwitchConfigMapper;
import com.chinaunicom.mall.ebtp.extend.userswitch.service.UserSwitchService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 风险管控接口实现
* @author daixc
* @date 2021/08/19
*/
@Slf4j
@Service
public class UserSwitchServiceImpl implements UserSwitchService {
@Resource
private BizFuncSwitchConfigMapper funcSwitchConfigMapper;
@Override
public Boolean findUser(String key, String role) {
String accout=funcSwitchConfigMapper.selectByUser(role,key);
if(accout!=null && StringUtils.isNotBlank(accout)){
return Boolean.TRUE;
}
return Boolean.FALSE;
}
}