|  |  |  | 
|---|
|  |  |  | package com.dy.pipIrrBase.district; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.dy.common.aop.SsoAop; | 
|---|
|  |  |  | import com.dy.common.mybatis.envm.Deleted; | 
|---|
|  |  |  | import com.dy.common.webUtil.BaseResponse; | 
|---|
|  |  |  | import com.dy.common.webUtil.BaseResponseUtils; | 
|---|
|  |  |  | import com.dy.common.webUtil.ResultCodeMsg; | 
|---|
|  |  |  | 
|---|
|  |  |  | schema = @Schema(implementation = BaDistrict.class))} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @GetMapping(path = "one") | 
|---|
|  |  |  | @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) | 
|---|
|  |  |  | @SsoAop("-1") | 
|---|
|  |  |  | public BaseResponse<BaDistrict> one(@Parameter(description = "实体id", required = true) Long id){ | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); | 
|---|
|  |  |  | 
|---|
|  |  |  | schema = @Schema(implementation = Boolean.class))} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @PostMapping(path = "save", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | 
|---|
|  |  |  | @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @SsoAop("-1")//@SsoAop(power = "-1") | 
|---|
|  |  |  | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单数据", required = true) @Valid DistrictVo vo, @Parameter(hidden = true) BindingResult bindingResult){ | 
|---|
|  |  |  | public BaseResponse<Boolean> save(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DistrictVo vo, @Parameter(hidden = true) BindingResult bindingResult){ | 
|---|
|  |  |  | if(bindingResult != null && bindingResult.hasErrors()){ | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | BaDistrict po = DistrictVoMapper.INSTANCT.convert(vo); | 
|---|
|  |  |  | int count; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | BaDistrict supperPo = this.sv.selectById(po.supperId) ; | 
|---|
|  |  |  | if(supperPo == null){ | 
|---|
|  |  |  | return BaseResponseUtils.buildFail("出错,未得到上级行政区") ; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | po.level = DistrictLevel.get((byte)(supperPo.level.code + 1)) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | po.deleted = Deleted.NO ; | 
|---|
|  |  |  | count = this.sv.save(po); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("保存行政区异常", e); | 
|---|
|  |  |  | 
|---|
|  |  |  | schema = @Schema(implementation = Boolean.class))} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @PostMapping(path = "update", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) | 
|---|
|  |  |  | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @SsoAop("-1")//@SsoAop(power = "-1") | 
|---|
|  |  |  | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单数据", required = true) @Valid DistrictVo vo, @Parameter(hidden = true) BindingResult bindingResult){ | 
|---|
|  |  |  | public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DistrictVo vo, @Parameter(hidden = true) BindingResult bindingResult){ | 
|---|
|  |  |  | if(bindingResult != null && bindingResult.hasErrors()){ | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|