xiangpei
2025-06-12 baa730b5518b5f73c14d0af5868641299b3fe2e4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package cn.lili.controller.other;
 
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.system.entity.dos.Logistics;
import cn.lili.modules.system.service.LogisticsService;
import cn.lili.mybatis.util.PageUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
 
/**
 * 管理端,物流公司接口
 *
 * @author Chopper
 * @since 2020/11/17 7:56 下午
 */
@RestController
@Api(tags = "管理端,物流公司接口")
@RequestMapping("/manager/other/logistics")
public class LogisticsManagerController {
    @Autowired
    private LogisticsService logisticsService;
 
    @ApiOperation(value = "通过id获取物流公司")
    @GetMapping(value = "/get/{id}")
    public ResultMessage<Logistics> get(@PathVariable String id) {
        return ResultUtil.data(logisticsService.getById(id));
    }
 
    @ApiOperation(value = "分页获取物流公司")
    @GetMapping(value = "/getByPage")
    public ResultMessage<IPage<Logistics>> getByPage(PageVO page) {
        return ResultUtil.data(logisticsService.page(PageUtil.initPage(page)));
    }
 
    @ApiOperation(value = "编辑物流公司")
    @ApiImplicitParam(name = "id", value = "物流公司ID", required = true, paramType = "path", dataType = "string")
    @PutMapping(value = "/{id}")
    public ResultMessage<Logistics> update(@NotNull @PathVariable String id, @Valid Logistics logistics) {
        logistics.setId(id);
        logisticsService.updateById(logistics);
        return ResultUtil.data(logistics);
    }
 
    @ApiOperation(value = "添加物流公司")
    @PostMapping(value = "/save")
    public ResultMessage<Logistics> save(@Valid Logistics logistics) {
        logisticsService.save(logistics);
        return ResultUtil.data(logistics);
    }
 
    @ApiOperation(value = "删除物流公司")
    @ApiImplicitParam(name = "id", value = "物流公司ID", required = true, dataType = "String", paramType = "path")
    @DeleteMapping(value = "/delete/{id}")
    public ResultMessage<Object> delAllByIds(@PathVariable String id) {
        logisticsService.removeById(id);
        return ResultUtil.success();
    }
}