package com.oying.modules.fee.rest;
|
|
import com.oying.annotation.Log;
|
import com.oying.modules.fee.domain.BaseFees;
|
import com.oying.modules.fee.service.BaseFeesService;
|
import com.oying.modules.fee.domain.dto.BaseFeesQueryCriteria;
|
import lombok.RequiredArgsConstructor;
|
import java.util.List;
|
import org.springframework.http.HttpStatus;
|
import org.springframework.http.ResponseEntity;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.*;
|
import io.swagger.annotations.*;
|
import java.io.IOException;
|
import javax.servlet.http.HttpServletResponse;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.oying.utils.PageResult;
|
|
/**
|
* @author lixin
|
* @date 2025-10-07
|
**/
|
@RestController
|
@RequiredArgsConstructor
|
@Api(tags = "基础运费")
|
@RequestMapping("/api/baseFees")
|
public class BaseFeesController {
|
|
private final BaseFeesService baseFeesService;
|
|
@ApiOperation("导出数据")
|
@GetMapping(value = "/download")
|
@PreAuthorize("@el.check('baseFees:list')")
|
public void exportBaseFees(HttpServletResponse response, BaseFeesQueryCriteria criteria) throws IOException {
|
baseFeesService.download(baseFeesService.queryAll(criteria), response);
|
}
|
|
@GetMapping
|
@ApiOperation("查询基础运费")
|
@PreAuthorize("@el.check('baseFees:list')")
|
public ResponseEntity<PageResult<BaseFees>> queryBaseFees(BaseFeesQueryCriteria criteria){
|
Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
|
return new ResponseEntity<>(baseFeesService.queryAll(criteria,page),HttpStatus.OK);
|
}
|
|
@PostMapping
|
@Log("新增基础运费")
|
@ApiOperation("新增基础运费")
|
@PreAuthorize("@el.check('baseFees:add')")
|
public ResponseEntity<Object> createBaseFees(@Validated @RequestBody BaseFees resources){
|
baseFeesService.create(resources);
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
}
|
|
@PutMapping
|
@Log("修改基础运费")
|
@ApiOperation("修改基础运费")
|
@PreAuthorize("@el.check('baseFees:edit')")
|
public ResponseEntity<Object> updateBaseFees(@Validated @RequestBody BaseFees resources){
|
baseFeesService.update(resources);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
}
|
|
@DeleteMapping
|
@Log("删除基础运费")
|
@ApiOperation("删除基础运费")
|
@PreAuthorize("@el.check('baseFees:del')")
|
public ResponseEntity<Object> deleteBaseFees(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) {
|
baseFeesService.deleteAll(ids);
|
return new ResponseEntity<>(HttpStatus.OK);
|
}
|
}
|