diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/BizFuncSwitchConfigMapper.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/BizFuncSwitchConfigMapper.java index be26038..0d37a7c 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/BizFuncSwitchConfigMapper.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/BizFuncSwitchConfigMapper.java @@ -9,4 +9,12 @@ import org.springframework.stereotype.Repository; public interface BizFuncSwitchConfigMapper extends BaseMapper { Integer selectByType(String type); + + /** + * 监督角色功能根据是否有次账号控制 + * @param role + * @param account + * @return + */ + String selectByUser(String role,String account); } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/mapper/BizFuncSwitchConfigMapper.xml b/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/mapper/BizFuncSwitchConfigMapper.xml index 6d745e8..2fc0d32 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/mapper/BizFuncSwitchConfigMapper.xml +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/mapper/BizFuncSwitchConfigMapper.xml @@ -13,4 +13,8 @@ resultType="java.lang.Integer"> SELECT active FROM biz_func_switch_config WHERE `type` = #{type} + \ No newline at end of file diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/userswitch/UserSwitchController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/userswitch/UserSwitchController.java new file mode 100644 index 0000000..f1ec2c1 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/userswitch/UserSwitchController.java @@ -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 findUser(@PathVariable String key,@PathVariable String role){ + return BaseResponse.success(userSwitchService.findUser(key,role)); + } +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/userswitch/service/UserSwitchService.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/userswitch/service/UserSwitchService.java new file mode 100644 index 0000000..2256248 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/userswitch/service/UserSwitchService.java @@ -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); +} diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/userswitch/service/impl/UserSwitchServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/userswitch/service/impl/UserSwitchServiceImpl.java new file mode 100644 index 0000000..d70fe91 --- /dev/null +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/userswitch/service/impl/UserSwitchServiceImpl.java @@ -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; + } +}