陶杰
2024-12-24 5b275c38c82bd54496dc2b2d268cde1ec9ec2b29
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
68
69
70
71
72
73
74
75
76
package com.mzl.flower.web.v2.district;
 
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mzl.flower.base.BaseController;
import com.mzl.flower.base.R;
import com.mzl.flower.base.ReturnDataDTO;
import com.mzl.flower.dto.request.district.CreateDistrictTengxunDTO;
import com.mzl.flower.dto.request.district.QueryDistrictTengxunDTO;
import com.mzl.flower.dto.response.district.DistrictTengxunVO;
import com.mzl.flower.entity.district.DistrictDO;
import com.mzl.flower.entity.district.DistrictTengxunDO;
import com.mzl.flower.service.district.DistrictTengxunService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
/**
 * 对接腾讯地图行政区划前端控制器
 *
* @author @TaoJie
* @since 2024-12-19
*/
@RestController
@RequestMapping("/v2/district-tengxun")
public class DistrictTengxunController extends BaseController {
 
    @Autowired
    private DistrictTengxunService districtTengxunService;
 
    @PostMapping("")
    @ApiOperation(value = "新增", notes = "新增")
    public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateDistrictTengxunDTO dto) {
        return returnData(R.SUCCESS.getCode(), districtTengxunService.createDistrict(dto));
    }
 
    @PutMapping("/{id}")
    @ApiOperation(value = "修改", notes = "修改")
    public  ResponseEntity<ReturnDataDTO>  update(@PathVariable String id,@Validated @RequestBody CreateDistrictTengxunDTO dto) {
        dto.setId(id);
        return returnData(R.SUCCESS.getCode(), districtTengxunService.updateDistrict(dto));
    }
 
    @DeleteMapping("/{id}")
    @ApiOperation(value = "删除", notes = "删除")
    public ResponseEntity<ReturnDataDTO> delete(@PathVariable String id) {
        return returnData(R.SUCCESS.getCode(), districtTengxunService.deleteDistrict(id));
    }
 
    @GetMapping("/{id}")
    @ApiOperation(value = "详情", notes = "详情")
    public ResponseEntity<DistrictTengxunDO> get(@PathVariable String id) {
        return returnData(R.SUCCESS.getCode(), districtTengxunService.getById(id));
    }
 
    @GetMapping("/page")
    @ApiOperation(value = "查询-分页", notes = "查询-分页")
    public ResponseEntity<ReturnDataDTO<Page<DistrictDO>>>  page(Page page, QueryDistrictTengxunDTO dto
    ) {
//        return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(resultPage, CouponTemplateActivyVO.class));
        return null;
    }
 
    @GetMapping("/list")
    @ApiOperation(value = "查询-全部", notes = "查询-全部")
    public ResponseEntity<ReturnDataDTO<Page<DistrictTengxunVO>>> list(QueryDistrictTengxunDTO dto) {
 
        return returnData(R.SUCCESS.getCode(), districtTengxunService.getDistrictTreeList());
 
    }
 
 
 
}