| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- package com.study.mall.controller;
- import com.study.mall.common.utils.CommonResult;
- import com.study.mall.common.utils.PageParam;
- import com.study.mall.common.utils.PageUtils;
- import com.study.mall.entity.ExpressCompanyEntity;
- import com.study.mall.service.ExpressCompanyService;
- import org.springframework.validation.annotation.Validated;
- import org.springframework.web.bind.annotation.DeleteMapping;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.PutMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.Arrays;
- /**
- * 快递公司
- *
- * @author codingliang
- * @email codingliang@gmail.com
- * @date 2023-09-04 22:14:38
- */
- @RestController
- @RequestMapping("expressCompany")
- public class ExpressCompanyController {
- private final ExpressCompanyService expressCompanyService;
- public ExpressCompanyController(ExpressCompanyService expressCompanyService) {
- this.expressCompanyService = expressCompanyService;
- }
- /**
- * 快递公司列表
- */
- @GetMapping("open/list")
- public CommonResult<PageUtils<ExpressCompanyEntity>> list(PageParam pageParam){
- PageUtils page = expressCompanyService.queryPage(pageParam);
- return CommonResult.ok().setResult(page);
- }
- /**
- * 新增快递公司
- * @apiNote 快递公司编码不能随便乱填,具体参考快递100,参考链接:https://api.kuaidi100.com/document/5f0ffb5ebc8da837cbd8aefc#section_1
- */
- @PostMapping("admin/add")
- public CommonResult<Void> add(@RequestBody @Validated ExpressCompanyEntity expressCompany){
- expressCompanyService.add(expressCompany);
- return CommonResult.ok();
- }
- /**
- * 修改快递公司
- */
- @PutMapping("admin/update")
- public CommonResult<Void> update(@RequestBody @Validated ExpressCompanyEntity expressCompany){
- expressCompanyService.update(expressCompany);
- return CommonResult.ok();
- }
- /**
- * 删除快递公司
- * @param ids id集合
- */
- @DeleteMapping("admin/delete")
- public CommonResult<Void> deleteByIds(@RequestBody Long[] ids){
- expressCompanyService.deleteByIds(Arrays.asList(ids));
- return CommonResult.ok();
- }
- }
|