113 lines
3.6 KiB
Java
113 lines
3.6 KiB
Java
package com.gxwebsoft.shop.controller;
|
|
|
|
import com.gxwebsoft.common.core.web.BaseController;
|
|
import com.gxwebsoft.shop.service.OrderInfoLogService;
|
|
import com.gxwebsoft.shop.entity.OrderInfoLog;
|
|
import com.gxwebsoft.shop.param.OrderInfoLogParam;
|
|
import com.gxwebsoft.common.core.web.ApiResult;
|
|
import com.gxwebsoft.common.core.web.PageResult;
|
|
import com.gxwebsoft.common.core.web.BatchParam;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 订单核销控制器
|
|
*
|
|
* @author 科技小王子
|
|
* @since 2024-05-14 13:20:04
|
|
*/
|
|
@Api(tags = "订单核销管理")
|
|
@RestController
|
|
@RequestMapping("/api/shop/order-info-log")
|
|
public class OrderInfoLogController extends BaseController {
|
|
@Resource
|
|
private OrderInfoLogService orderInfoLogService;
|
|
|
|
@ApiOperation("分页查询订单核销")
|
|
@GetMapping("/page")
|
|
public ApiResult<PageResult<OrderInfoLog>> page(OrderInfoLogParam param) {
|
|
// 使用关联查询
|
|
return success(orderInfoLogService.pageRel(param));
|
|
}
|
|
|
|
@ApiOperation("查询全部订单核销")
|
|
@GetMapping()
|
|
public ApiResult<List<OrderInfoLog>> list(OrderInfoLogParam param) {
|
|
// 使用关联查询
|
|
return success(orderInfoLogService.listRel(param));
|
|
}
|
|
|
|
@PreAuthorize("hasAuthority('shop:orderInfoLog:list')")
|
|
@ApiOperation("根据id查询订单核销")
|
|
@GetMapping("/{id}")
|
|
public ApiResult<OrderInfoLog> get(@PathVariable("id") Integer id) {
|
|
// 使用关联查询
|
|
return success(orderInfoLogService.getByIdRel(id));
|
|
}
|
|
|
|
@ApiOperation("添加订单核销")
|
|
@PostMapping()
|
|
public ApiResult<?> save(@RequestBody OrderInfoLog orderInfoLog) {
|
|
// 记录当前登录用户id
|
|
// User loginUser = getLoginUser();
|
|
// if (loginUser != null) {
|
|
// orderInfoLog.setUserId(loginUser.getUserId());
|
|
// }
|
|
if (orderInfoLogService.save(orderInfoLog)) {
|
|
return success("添加成功");
|
|
}
|
|
return fail("添加失败");
|
|
}
|
|
|
|
@ApiOperation("修改订单核销")
|
|
@PutMapping()
|
|
public ApiResult<?> update(@RequestBody OrderInfoLog orderInfoLog) {
|
|
if (orderInfoLogService.updateById(orderInfoLog)) {
|
|
return success("修改成功");
|
|
}
|
|
return fail("修改失败");
|
|
}
|
|
|
|
@ApiOperation("删除订单核销")
|
|
@DeleteMapping("/{id}")
|
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
|
if (orderInfoLogService.removeById(id)) {
|
|
return success("删除成功");
|
|
}
|
|
return fail("删除失败");
|
|
}
|
|
|
|
@ApiOperation("批量添加订单核销")
|
|
@PostMapping("/batch")
|
|
public ApiResult<?> saveBatch(@RequestBody List<OrderInfoLog> list) {
|
|
if (orderInfoLogService.saveBatch(list)) {
|
|
return success("添加成功");
|
|
}
|
|
return fail("添加失败");
|
|
}
|
|
|
|
@ApiOperation("批量修改订单核销")
|
|
@PutMapping("/batch")
|
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<OrderInfoLog> batchParam) {
|
|
if (batchParam.update(orderInfoLogService, "id")) {
|
|
return success("修改成功");
|
|
}
|
|
return fail("修改失败");
|
|
}
|
|
|
|
@ApiOperation("批量删除订单核销")
|
|
@DeleteMapping("/batch")
|
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
|
if (orderInfoLogService.removeByIds(ids)) {
|
|
return success("删除成功");
|
|
}
|
|
return fail("删除失败");
|
|
}
|
|
|
|
}
|