监督角色功能控制
This commit is contained in:
@ -9,4 +9,12 @@ import org.springframework.stereotype.Repository;
|
||||
public interface BizFuncSwitchConfigMapper extends BaseMapper<BizFuncSwitchConfig> {
|
||||
|
||||
Integer selectByType(String type);
|
||||
|
||||
/**
|
||||
* 监督角色功能根据是否有次账号控制
|
||||
* @param role
|
||||
* @param account
|
||||
* @return
|
||||
*/
|
||||
String selectByUser(String role,String account);
|
||||
}
|
||||
|
@ -13,4 +13,8 @@
|
||||
resultType="java.lang.Integer">
|
||||
SELECT active FROM biz_func_switch_config WHERE `type` = #{type}
|
||||
</select>
|
||||
<select id="selectByUser"
|
||||
resultType="java.lang.String ">
|
||||
SELECT account FROM maint_base_user WHERE `role` = #{role} and account=#{account}
|
||||
</select>
|
||||
</mapper>
|
@ -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));
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user