Files
nuttyreading-java/src/main/java/com/peanut/modules/book/controller/BuyOrderDetailController.java
2023-09-19 18:24:19 +08:00

138 lines
3.6 KiB
Java

package com.peanut.modules.book.controller;
import java.util.Arrays;
import java.util.Map;
import com.peanut.modules.book.entity.BuyOrderEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.peanut.modules.book.entity.BuyOrderDetailEntity;
import com.peanut.modules.book.service.BuyOrderDetailService;
import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.R;
/**
* 商品订单详情表
*
* @author yl
* @email yl328572838@163.com
* @date 2022-08-29 15:27:44
*/
@RestController
@RequestMapping("book/buyorderdetail")
public class BuyOrderDetailController {
@Autowired
private BuyOrderDetailService buyOrderDetailService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("book:buyorderdetail:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = buyOrderDetailService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 查询已购买书籍
* @param params
* @return
*/
@RequestMapping("/querybuy")
public R querybuy(@RequestParam Map<String, Object> params){
PageUtils page = buyOrderDetailService.querybuy(params);
return R.ok().put("page", page);
}
/**
* 去重查询可打印面单
*
* @param params
* @return
*/
@RequestMapping("/querySheetPage")
public R querySheetPage(@RequestParam Map<String, Object> params){
PageUtils page = buyOrderDetailService.querySheet(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{allOrderId}")
public R info(@PathVariable("allOrderId") Long allOrderId){
BuyOrderDetailEntity buyOrderDetail = buyOrderDetailService.getById(allOrderId);
return R.ok().put("buyOrderDetail", buyOrderDetail);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("book:buyorderdetail:save")
public R save(@RequestBody BuyOrderDetailEntity buyOrderDetail){
buyOrderDetailService.save(buyOrderDetail);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("book:buyorderdetail:update")
public R update(@RequestBody BuyOrderDetailEntity buyOrderDetail){
buyOrderDetailService.updateById(buyOrderDetail);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("book:buyorderdetail:delete")
public R delete(@RequestBody Long[] allOrderIds){
buyOrderDetailService.removeByIds(Arrays.asList(allOrderIds));
return R.ok();
}
@RequestMapping("/updateOrderStatus")
public R updateOrderStatus(@RequestBody BuyOrderDetailEntity buyOrderDetail){
buyOrderDetail.setOrderStatus("2");
buyOrderDetailService.updateById(buyOrderDetail);
return R.ok();
}
/**
* 根据运单号批量修改打印状态
*
* @param shippingSnList
* @return
*/
@RequestMapping("/batchUpdateByShippingSns")
public R batchUpdateByShippingSns(@RequestBody String[] shippingSnList){
buyOrderDetailService.batchUpdateByShippingSns(shippingSnList);
return R.ok();
}
}