修改图书标签方法

This commit is contained in:
wuchunlei
2024-03-21 18:05:22 +08:00
parent 6aa20d72b7
commit e53b954769
5 changed files with 83 additions and 41 deletions

View File

@@ -1,4 +1,40 @@
package com.peanut.modules.master.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.ShopProduct;
import com.peanut.modules.master.service.ShopProductService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@Slf4j
@RestController("masterShopProduct")
@RequestMapping("master/shopProduct")
public class ShopProductController {
@Autowired
private ShopProductService shopProductService;
/**
* 列表
*/
@RequestMapping("/listByPage")
public R listByPage(@RequestBody Map<String, Object> params) {
MPJLambdaWrapper<ShopProduct> wrapper = new MPJLambdaWrapper();
if (StringUtils.isNotEmpty(params.get("productName").toString())) {
wrapper.like(ShopProduct::getProductName, params.get("productName"));
}
wrapper.orderByAsc(ShopProduct::getSort);
wrapper.orderByAsc(ShopProduct::getCreateTime);
Page<ShopProduct> res = shopProductService.page(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())), wrapper);
return R.ok().put("result", res);
}
}

View File

@@ -1,4 +1,7 @@
package com.peanut.modules.master.service;
public interface ShopProductService {
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.ShopProduct;
public interface ShopProductService extends IService<ShopProduct> {
}

View File

@@ -0,0 +1,13 @@
package com.peanut.modules.master.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.ShopProductDao;
import com.peanut.modules.common.entity.ShopProduct;
import com.peanut.modules.master.service.ShopProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service("masterShopProductService")
public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProduct> implements ShopProductService {
}