parent
aba833895e
commit
fcd0049022
|
@ -12,21 +12,21 @@ import org.hibernate.validator.constraints.Range;
|
|||
* @author 阿沐 babamu@126.com
|
||||
* <a href="https://maku.net">MAKU</a>
|
||||
*/
|
||||
@Data
|
||||
public class Query {
|
||||
@NotNull(message = "页码不能为空")
|
||||
@Min(value = 1, message = "页码最小值为 1")
|
||||
@Schema(description = "当前页码", required = true)
|
||||
Integer page;
|
||||
@Data
|
||||
public class Query {
|
||||
@NotNull(message = "页码不能为空")
|
||||
@Min(value = 1, message = "页码最小值为 1")
|
||||
@Schema(description = "当前页码", required = true)
|
||||
Integer page;
|
||||
|
||||
@NotNull(message = "每页条数不能为空")
|
||||
@Range(min = 1, max = 1000, message = "每页条数,取值范围 1-1000")
|
||||
@Schema(description = "每页条数", required = true)
|
||||
Integer limit;
|
||||
@NotNull(message = "每页条数不能为空")
|
||||
@Range(min = 1, max = 1000, message = "每页条数,取值范围 1-1000")
|
||||
@Schema(description = "每页条数", required = true)
|
||||
Integer limit;
|
||||
|
||||
@Schema(description = "排序字段")
|
||||
String order;
|
||||
@Schema(description = "排序字段")
|
||||
String order;
|
||||
|
||||
@Schema(description = "是否升序")
|
||||
boolean asc;
|
||||
}
|
||||
@Schema(description = "是否升序")
|
||||
boolean asc;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ public class TBookController {
|
|||
@PreAuthorize("hasAuthority('maku:t_book:page')")
|
||||
public Result<PageResult<TBookVO>> page(@ParameterObject @Valid TBookQuery query){
|
||||
PageResult<TBookVO> page = tBookService.page(query);
|
||||
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.maku.maku.convert;
|
||||
|
||||
|
||||
import net.maku.maku.entity.TBookEntity;
|
||||
import net.maku.maku.vo.TBookVO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
@ -22,8 +21,6 @@ public interface TBookConvert {
|
|||
|
||||
TBookVO convert(TBookEntity entity);
|
||||
|
||||
|
||||
|
||||
List<TBookVO> convertList(List<TBookEntity> list);
|
||||
|
||||
}
|
|
@ -19,6 +19,4 @@ import java.util.Date;
|
|||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "查询")
|
||||
public class TBookQuery extends Query {
|
||||
private String author;
|
||||
private String bookName;
|
||||
}
|
|
@ -19,6 +19,4 @@ import java.util.Date;
|
|||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "查询")
|
||||
public class TPurchaseQuery extends Query {
|
||||
private Integer id;
|
||||
private BigDecimal totalPrice;
|
||||
}
|
|
@ -18,7 +18,4 @@ import java.util.Date;
|
|||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "查询")
|
||||
public class TShoppingTrolleyQuery extends Query {
|
||||
private Integer userId;
|
||||
|
||||
private Integer bookId;
|
||||
}
|
|
@ -19,9 +19,4 @@ import java.util.Date;
|
|||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "查询")
|
||||
public class TUserQuery extends Query {
|
||||
|
||||
private String username;
|
||||
private Integer status;
|
||||
|
||||
|
||||
}
|
|
@ -36,8 +36,6 @@ public class TBookServiceImpl extends BaseServiceImpl<TBookDao, TBookEntity> imp
|
|||
|
||||
private LambdaQueryWrapper<TBookEntity> getWrapper(TBookQuery query){
|
||||
LambdaQueryWrapper<TBookEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(TBookEntity::getBookName, query.getBookName());
|
||||
wrapper.eq(TBookEntity::getAuthor, query.getAuthor());
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.maku.maku.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
@ -37,8 +36,6 @@ public class TPurchaseServiceImpl extends BaseServiceImpl<TPurchaseDao, TPurchas
|
|||
|
||||
private LambdaQueryWrapper<TPurchaseEntity> getWrapper(TPurchaseQuery query){
|
||||
LambdaQueryWrapper<TPurchaseEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(ObjectUtils.isNotNull(query.getId()),TPurchaseEntity::getId,query.getId());
|
||||
wrapper.eq(ObjectUtils.isNotNull(query.getTotalPrice()),TPurchaseEntity::getTotalPrice, query.getTotalPrice());
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.maku.maku.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
@ -8,7 +7,6 @@ import lombok.AllArgsConstructor;
|
|||
import net.maku.framework.common.utils.PageResult;
|
||||
import net.maku.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.maku.maku.convert.TShoppingTrolleyConvert;
|
||||
import net.maku.maku.entity.TPurchaseEntity;
|
||||
import net.maku.maku.entity.TShoppingTrolleyEntity;
|
||||
import net.maku.maku.query.TShoppingTrolleyQuery;
|
||||
import net.maku.maku.vo.TShoppingTrolleyVO;
|
||||
|
@ -38,8 +36,7 @@ public class TShoppingTrolleyServiceImpl extends BaseServiceImpl<TShoppingTrolle
|
|||
|
||||
private LambdaQueryWrapper<TShoppingTrolleyEntity> getWrapper(TShoppingTrolleyQuery query){
|
||||
LambdaQueryWrapper<TShoppingTrolleyEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(ObjectUtils.isNotNull(query.getUserId()), TShoppingTrolleyEntity::getUserId,query.getUserId());
|
||||
wrapper.eq(ObjectUtils.isNotNull(query.getBookId()),TShoppingTrolleyEntity::getBookId, query.getBookId());
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.maku.maku.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
@ -37,8 +36,6 @@ public class TUserServiceImpl extends BaseServiceImpl<TUserDao, TUserEntity> imp
|
|||
|
||||
private LambdaQueryWrapper<TUserEntity> getWrapper(TUserQuery query){
|
||||
LambdaQueryWrapper<TUserEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(TUserEntity::getUsername, query.getUsername());
|
||||
wrapper.eq(ObjectUtils.isNotNull(query.getStatus()),TUserEntity::getStatus, query.getStatus());
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user