This commit is contained in:
wuchunlei
2024-05-24 15:50:32 +08:00
14 changed files with 300 additions and 74 deletions

View File

@@ -1,8 +1,12 @@
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.PageUtils;
import com.peanut.common.utils.R;
import com.peanut.modules.book.service.ShopStoreService;
import com.peanut.modules.common.entity.PayPaymentOrderEntity;
import com.peanut.modules.common.entity.ShopStore;
import com.peanut.modules.master.service.PayPaymentOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

View File

@@ -0,0 +1,91 @@
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.ShopStoreToProductEntity;
import com.peanut.modules.common.to.ParamTo;
import com.peanut.modules.master.service.ShopStoreService;
import com.peanut.modules.common.entity.ShopStore;
import com.peanut.modules.master.service.ShopStoreToProductService;
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.List;
import java.util.Map;
@Slf4j
@RestController("masterShopStore")
@RequestMapping("master/shopStore")
public class ShopStoreController {
@Autowired
private ShopStoreService shopStoreService;
@Autowired
private ShopStoreToProductService shopStoreToProductService;
/**
* 获取小店列表
*/
@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);
}
@RequestMapping(path = "/getStoreById")
public R getStoreById(@RequestBody Map<String,Integer> map) {
int id = map.get("id");
return R.ok().put("result",shopStoreService.getById(id));
}
@RequestMapping(path = "/saveOrUpdateStore")
public R saveOrUpdateStore(@RequestBody ShopStore store) {
shopStoreService.saveOrUpdate(store);
return R.ok();
}
@RequestMapping(path = "/delStore")
public R delStore(@RequestBody Map<String,Integer> map) {
int id = map.get("id");
return shopStoreService.delStore(id);
}
@RequestMapping("/getStoreProductList")
public R getStoreProductList(@RequestBody Map<String,Integer> map){
List<ShopStoreToProductEntity> storeId = shopStoreToProductService.getStoreProductList(map.get("storeId"));
return R.ok().put("list",storeId);
}
@RequestMapping("/getCanBindProductList")
public R getCanBindProductList(@RequestBody ParamTo param){
Page canBindProductList = shopStoreToProductService.getCanBindProductList(param);
return R.ok().put("page",canBindProductList);
}
@RequestMapping("/bindStoreAndProduct")
public R bindStoreAndProduct(@RequestBody Map<String,Integer> map){
return shopStoreToProductService.bindStoreAndProduct(map.get("storeId"),map.get("productId"));
}
@RequestMapping("/unbindStoreAndProduct")
public R unbindStoreAndProduct(@RequestBody Map<String,Integer> map){
shopStoreToProductService.getBaseMapper().deleteById(map.get("id"));
return R.ok();
}
@RequestMapping("/editStoreProductSort")
public R editStoreProductSort(@RequestBody Map<String,Integer> map){
return shopStoreToProductService.editStoreProductSort(map);
}
}