Merge remote-tracking branch 'origin/master'
commit
a995347b54
|
@ -23,6 +23,12 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-common</artifactId>
|
||||
<version>2.0.4</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
|
||||
package com.muyu.market.domian.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分页参数
|
||||
* @author yami
|
||||
*/
|
||||
@Schema
|
||||
@ParameterObject
|
||||
public class PageParam<T> extends PageDTO<T> {
|
||||
|
||||
private static final int PAGE_LIMIT = 100;
|
||||
/**
|
||||
* 每页显示条数,默认 10
|
||||
*/
|
||||
@Schema(description = "每页大小,默认10")
|
||||
private long size = 10;
|
||||
|
||||
/**
|
||||
* 当前页
|
||||
*/
|
||||
@Schema(description = "当前页,默认1")
|
||||
private long current = 1;
|
||||
|
||||
/**
|
||||
* 查询数据列表
|
||||
*/
|
||||
@Hidden
|
||||
private List<T> records;
|
||||
/**
|
||||
* 总数
|
||||
*/
|
||||
@Hidden
|
||||
private long total = 0;
|
||||
|
||||
|
||||
/**
|
||||
* 是否进行 count 查询
|
||||
*/
|
||||
@Hidden
|
||||
private boolean searchCount = true;
|
||||
|
||||
@Hidden
|
||||
private String countId;
|
||||
@Hidden
|
||||
private Long maxLimit;
|
||||
@Hidden
|
||||
private boolean optimizeCountSql;
|
||||
@Hidden
|
||||
private List<OrderItem> orders;
|
||||
|
||||
@Override
|
||||
public List<T> getRecords() {
|
||||
return this.records;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<T> setRecords(List<T> records) {
|
||||
this.records = records;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotal() {
|
||||
return this.total;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<T> setTotal(long total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Hidden
|
||||
public boolean searchCount() {
|
||||
if (total < 0) {
|
||||
return false;
|
||||
}
|
||||
return searchCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<T> setSearchCount(boolean searchCount) {
|
||||
this.searchCount = searchCount;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<T> setSize(long size) {
|
||||
if (size > PAGE_LIMIT) {
|
||||
this.size = PAGE_LIMIT;
|
||||
} else {
|
||||
this.size = size;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCurrent() {
|
||||
return this.current;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<T> setCurrent(long current) {
|
||||
this.current = current;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrders(List<OrderItem> orders) {
|
||||
super.setOrders(Collections.emptyList());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,22 +1,22 @@
|
|||
package com.muyu.master.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
|
||||
import com.muyu.market.domian.Defined;
|
||||
import com.muyu.market.domian.config.PageParam;
|
||||
import com.muyu.market.domian.req.DefinedReq;
|
||||
import com.muyu.master.service.DefinedService;
|
||||
import io.micrometer.common.util.StringUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:2112-cloud-market
|
||||
|
@ -42,16 +42,32 @@ public class DefinedController {
|
|||
@Autowired
|
||||
private DefinedService definedService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 接口列表
|
||||
* 接口列表 分页
|
||||
*/
|
||||
@RequestMapping(path = "/list",method = RequestMethod.POST)
|
||||
@Operation(summary = "查询",description = "根据接口的名称、编码,是否开启等可以进行筛选")
|
||||
public Result<List<Defined>> selectList(
|
||||
@Operation(summary = "查询",description = "根据接口的名称 有效期 等可以进行筛选")
|
||||
public Result<PageParam<Defined>> selectList(PageParam<Defined> page,
|
||||
@Validated @RequestBody DefinedReq definedReq) {
|
||||
return Result.success(
|
||||
definedService.selectList(definedReq)
|
||||
|
||||
/**模糊查询 名称**/
|
||||
LambdaQueryWrapper<Defined> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(
|
||||
StringUtils.isNotEmpty(definedReq.getDefinedName()),
|
||||
Defined::getDefinedName,definedReq.getDefinedName()
|
||||
);
|
||||
|
||||
/**模糊查询 有效期**/
|
||||
queryWrapper.like(
|
||||
StringUtils.isNotEmpty(String.valueOf(definedReq.getDefinedDateValidity())),
|
||||
Defined::getDefinedDataValidity,
|
||||
definedReq.getDefinedDateValidity()
|
||||
);
|
||||
|
||||
PageParam<Defined>pageDTO=definedService.page(page,queryWrapper);
|
||||
return Result.success(pageDTO);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package com.muyu.master.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.market.domian.Defined;
|
||||
import com.muyu.market.domian.Logs;
|
||||
import com.muyu.market.domian.config.PageParam;
|
||||
import com.muyu.master.service.LogsService;
|
||||
import io.micrometer.common.util.StringUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
|
@ -26,9 +30,13 @@ public class LogsController {
|
|||
*/
|
||||
@Operation(summary = "查询日志列表",description = "查询用户操作日志列表")
|
||||
@GetMapping("/list")
|
||||
public Result<List<Logs>> show(){
|
||||
List<Logs> list=service.showList();
|
||||
return Result.success(list);
|
||||
public Result<PageParam<Logs>> show(PageParam<Logs>page,String getLogsId){
|
||||
LambdaQueryWrapper<Logs> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotEmpty(getLogsId)){
|
||||
queryWrapper.select(Logs::getLogsId);//根据用户id查询
|
||||
}
|
||||
PageParam<Logs> pageDTO=service.page(page,queryWrapper);
|
||||
return Result.success(pageDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,9 +2,7 @@ package com.muyu.master.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.market.domian.Defined;
|
||||
import com.muyu.market.domian.req.DefinedReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
|
@ -16,7 +14,6 @@ import java.util.List;
|
|||
*/
|
||||
public interface DefinedService extends IService<Defined> {
|
||||
|
||||
List<Defined> selectList(DefinedReq definedReq);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,5 @@ import java.util.List;
|
|||
|
||||
public interface LogsService extends IService<Logs> {
|
||||
|
||||
List<Logs> showList();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
package com.muyu.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.market.domian.Defined;
|
||||
import com.muyu.market.domian.req.DefinedReq;
|
||||
|
||||
import com.muyu.master.mapper.DefinedMapper;
|
||||
|
||||
import com.muyu.master.service.DefinedService;
|
||||
import io.micrometer.common.util.StringUtils;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
|
@ -32,25 +31,4 @@ public class DefinedServiceImpl
|
|||
|
||||
|
||||
|
||||
@Override
|
||||
public List<Defined> selectList(DefinedReq definedReq) {
|
||||
|
||||
/**模糊查询 名称**/
|
||||
LambdaQueryWrapper<Defined> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(
|
||||
StringUtils.isNotEmpty(definedReq.getDefinedName()),
|
||||
Defined::getDefinedName,definedReq.getDefinedName()
|
||||
);
|
||||
|
||||
/**模糊查询 有效期**/
|
||||
queryWrapper.like(
|
||||
StringUtils.isNotEmpty(String.valueOf(definedReq.getDefinedDateValidity())),
|
||||
Defined::getDefinedDataValidity,
|
||||
definedReq.getDefinedDateValidity()
|
||||
);
|
||||
|
||||
List<Defined> list = this.list(queryWrapper);
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,16 +19,5 @@ public class LogsServiceImpl
|
|||
@Autowired
|
||||
private LogsMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<Logs> showList() {
|
||||
|
||||
LambdaQueryWrapper<Logs> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.select(Logs::getLogsId);//根据用户id查询
|
||||
List<Logs> list = this.list();
|
||||
|
||||
list.stream().map(Logs::getLogsId).collect(Collectors.toSet());
|
||||
return this.list(queryWrapper)
|
||||
.stream()
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue