1、Controller
@GetMapping(\"/queryNewProduct\")
public ProductDTO queryNewProduct(@RequestParam(\"type\") String type) {
return opProductService.queryNewProduct(type);
}
2、Service
@Override
public ProductDTO queryNewProduct(String type) {
//以下出现的第一个入参boolean condition表示该条件是否加入最后生成的sql中,
// 例如:query.like(StringUtils.isNotBlank(name), Entity::getName, name)
// .eq(age!=null && age >= 0, Entity::getAge, age)
OpProduct one = this.getOne(new LambdaQueryWrapper<OpProduct>()
.eq(OpProduct::getType, type)
.orderBy(true, false, OpProduct::getId)
.last(\"limit 1\")
);
ProductDTO productDTO = BeanUtil.copyProperties(one, ProductDTO.class);
return productDTO;
}
做猪小侠源码的代理,提供一站式服务
如果你不懂得搭建网站或者服务器,小程序,源码之类的怎么办? 第一通过本站学习各种互联网的技术 第二就是联系客服,我帮帮你搭建(当然要收取部分的费用) 第三成为我们的代理,我们提供整套的服务。