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 create(@Validated @RequestBody CreateDistrictTengxunDTO dto) { return returnData(R.SUCCESS.getCode(), districtTengxunService.createDistrict(dto)); } @PutMapping("/{id}") @ApiOperation(value = "修改", notes = "修改") public ResponseEntity 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 delete(@PathVariable String id) { return returnData(R.SUCCESS.getCode(), districtTengxunService.deleteDistrict(id)); } @GetMapping("/{id}") @ApiOperation(value = "详情", notes = "详情") public ResponseEntity get(@PathVariable String id) { return returnData(R.SUCCESS.getCode(), districtTengxunService.getById(id)); } @GetMapping("/page") @ApiOperation(value = "查询-分页", notes = "查询-分页") public ResponseEntity>> page(Page page, QueryDistrictTengxunDTO dto ) { // return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(resultPage, CouponTemplateActivyVO.class)); return null; } @GetMapping("/list") @ApiOperation(value = "查询-全部", notes = "查询-全部") public ResponseEntity>> list(QueryDistrictTengxunDTO dto) { return returnData(R.SUCCESS.getCode(), districtTengxunService.getDistrictTreeList()); } }