This commit is contained in:
wuchunlei
2024-05-27 14:52:55 +08:00
12 changed files with 169 additions and 11 deletions

View File

@@ -1,5 +1,6 @@
package com.peanut.modules.master.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.common.utils.R;
@@ -33,13 +34,10 @@ public class ShopStoreController {
*/
@RequestMapping("/getStoreList")
public R getStoreList(@RequestBody Map params){
MPJLambdaWrapper<ShopStore> wrapper = new MPJLambdaWrapper();
if (params.containsKey("name")&&!"".equals(params.get("name").toString())){
wrapper.like(ShopStore::getName,params.get("name").toString());
}
Page<ShopStore> page = shopStoreService.page(new Page<>(
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
return R.ok().put("result", page);
LambdaQueryWrapper<ShopStore> wrapper = new LambdaQueryWrapper<>();
wrapper.orderByAsc(ShopStore::getSort);
List<ShopStore> shopStores = shopStoreService.getBaseMapper().selectList(wrapper);
return R.ok().put("list",shopStores);
}
@RequestMapping(path = "/getStoreById")
@@ -51,7 +49,7 @@ public class ShopStoreController {
@RequestMapping(path = "/saveOrUpdateStore")
public R saveOrUpdateStore(@RequestBody ShopStore store) {
shopStoreService.saveOrUpdate(store);
return R.ok();
return R.ok().put("result",store);
}
@RequestMapping(path = "/delStore")

View File

@@ -0,0 +1,47 @@
package com.peanut.modules.master.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.peanut.common.utils.R;
import com.peanut.modules.common.entity.TaihuWelfareEntity;
import com.peanut.modules.common.to.ParamTo;
import com.peanut.modules.master.service.TaihuWelfareService;
import lombok.extern.slf4j.Slf4j;
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("masterTaihuWelfare")
@RequestMapping("master/taihuWelfare")
public class TaihuWelfareController {
@Autowired
private TaihuWelfareService taihuWelfareService;
@RequestMapping("/getArticleList")
public R getArticleList(@RequestBody ParamTo param){
Page articleList = taihuWelfareService.getArticleList(param.getPage(), param.getLimit());
return R.ok().put("page",articleList);
}
@RequestMapping("/addArticle")
public R addArticle(@RequestBody TaihuWelfareEntity taihuWelfareEntity){
taihuWelfareService.save(taihuWelfareEntity);
return R.ok().put("result",taihuWelfareEntity);
}
@RequestMapping("/editArticle")
public R editArticle(@RequestBody TaihuWelfareEntity taihuWelfareEntity){
taihuWelfareService.updateById(taihuWelfareEntity);
return R.ok().put("result",taihuWelfareEntity);
}
@RequestMapping("/delArticle")
public R delArticle(@RequestBody Map<String,Integer> map){
int id = map.get("id");
taihuWelfareService.removeById(id);
return R.ok();
}
}

View File

@@ -0,0 +1,10 @@
package com.peanut.modules.master.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.common.entity.TaihuWelfareEntity;
public interface TaihuWelfareService extends IService<TaihuWelfareEntity> {
Page getArticleList(int page,int limit);
}

View File

@@ -44,7 +44,8 @@ public class ShopStoreToProductServiceImpl extends ServiceImpl<ShopStoreToProduc
.stream().map(ShopStoreToProductEntity::getProductId).collect(Collectors.toList());
LambdaQueryWrapper<ShopProduct> shopProductLambdaQueryWrapper = new LambdaQueryWrapper<>();
shopProductLambdaQueryWrapper.like(StringUtils.isNotBlank(param.getKeywords()),ShopProduct::getProductName,param.getKeywords());
shopProductLambdaQueryWrapper.notIn(ShopProduct::getProductId,collect);
shopProductLambdaQueryWrapper.eq(param.getType().equals("00"),ShopProduct::getGoodsType,param.getType());
shopProductLambdaQueryWrapper.notIn(collect.size()>0,ShopProduct::getProductId,collect);
Page<ShopProduct> shopProductPage = shopProductDao.selectPage(new Page<>(param.getPage(), param.getLimit()), shopProductLambdaQueryWrapper);
return shopProductPage;
}
@@ -69,6 +70,9 @@ public class ShopStoreToProductServiceImpl extends ServiceImpl<ShopStoreToProduc
@Override
public R editStoreProductSort(Map<String, Integer> map) {
ShopStoreToProductEntity info = this.getById(map.get("id"));
if (info==null){
return R.error("查找失败!");
}
info.setSort(map.get("sort"));
this.updateById(info);
return R.ok().put("result",info);

View File

@@ -0,0 +1,21 @@
package com.peanut.modules.master.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.common.dao.TaihuWelfareDao;
import com.peanut.modules.common.entity.TaihuWelfareEntity;
import com.peanut.modules.master.service.TaihuWelfareService;
import org.springframework.stereotype.Service;
@Service("masterTaihuWelfareService")
public class TaihuWelfareServiceImpl extends ServiceImpl<TaihuWelfareDao, TaihuWelfareEntity> implements TaihuWelfareService {
@Override
public Page getArticleList(int page, int limit) {
LambdaQueryWrapper<TaihuWelfareEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.orderByAsc(TaihuWelfareEntity::getSort);
Page<TaihuWelfareEntity> taihuWelfareEntityPage = this.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
return taihuWelfareEntityPage;
}
}