| | |
| | | package org.springblade.system.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.system.entity.Strategy; |
| | | import org.springblade.system.service.IStrategyService; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 密码策略(PlSysStrategy)表控制层 |
| | | * 密码策略(Strategy)表控制层 |
| | | * |
| | | * @author makejava |
| | | * @since 2023-03-20 16:45:31 |
| | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param strategy 筛选条件 |
| | | * @param query 分页对象 |
| | | * @param query 分页对象 |
| | | * @return 查询结果 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "分页查询", notes = "传入combination,分页参数query") |
| | | public R<IPage<Strategy>> queryByPage(Strategy strategy, Query query) { |
| | | IPage<Strategy> pages = strategyService.page(Condition.getPage(query), Condition.getQueryWrapper(strategy)); |
| | | return R.data(pages); |
| | | @ApiOperation(value = "分页查询", notes = "传入分页参数query") |
| | | public R<Page<Strategy>> queryByPage(Query query) { |
| | | Page<Strategy> strategyPage = strategyService.queryAllByPage(query); |
| | | return R.data(strategyPage); |
| | | } |
| | | |
| | | /** |
| | | * 查询默认密码策略 |
| | | * |
| | | * @return 查询结果 |
| | | */ |
| | | @GetMapping("/default") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "查询默认密码策略") |
| | | public R<Strategy> queryByIsDefault() { |
| | | Strategy strategy = strategyService.queryByIsDefault(); |
| | | return R.data(strategy); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "删除", notes = "传入ids") |
| | | public ResponseEntity<Boolean> deleteById(List<String> ids) { |
| | | public ResponseEntity<Boolean> deleteById(@ApiParam(value = "主键集合", required = true) @RequestParam List<String> ids) { |
| | | return ResponseEntity.ok(this.strategyService.deleteByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户id查询密码策略 |
| | | * |
| | | * @param userId 实体 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("/query-userid") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "根据用户id查询密码策略", notes = "传入userId") |
| | | public R<Strategy> queryByUserId(@Valid @RequestParam Long userId) { |
| | | return R.data(this.strategyService.queryByUserId(userId)); |
| | | } |
| | | |
| | | } |
| | | |