From 9b91874ff2e7128e65c6f4ba851638dd3548b7f4 Mon Sep 17 00:00:00 2001 From: DirectionOfMind <3182967682@qq.com> Date: Tue, 19 Jan 2021 15:12:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8C=87=E6=A0=87=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/IndicatorTypeController.java | 27 ++++++++++++++++--- .../dao/IndicatorLibraryMapper.java | 2 ++ .../service/IndicatorLibraryService.java | 2 ++ .../impl/IndicatorLibraryServiceImpl.java | 5 ++++ .../performance/IndicatorLibraryMapper.xml | 5 ++++ 5 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java b/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java index dfcd1d06..6a3c863c 100644 --- a/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java +++ b/src/main/java/com/lz/modules/performance/controller/IndicatorTypeController.java @@ -8,15 +8,16 @@ import com.lz.common.utils.StringUtil; import com.lz.modules.performance.dto.IndicatorTypeDto; import com.lz.modules.performance.entity.IndicatorType; import com.lz.modules.performance.req.IndicatorReq; +import com.lz.modules.performance.service.IndicatorLibraryService; import com.lz.modules.performance.service.IndicatorTypeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; +@Slf4j @RestController @RequestMapping("/indicatorType") @Api(value = "指标分类相关接口", tags = { "指标分类相关接口" }) @@ -25,6 +26,8 @@ public class IndicatorTypeController { @Autowired private IndicatorTypeService indicatorTypeService; + @Autowired + private IndicatorLibraryService indicatorLibraryService; @PostMapping("/list") @@ -55,4 +58,20 @@ public class IndicatorTypeController { return success ? R.ok():R.error(); } + + + @GetMapping("/delete") + @ApiOperation("删除指标分类") + public R delete(@RequestParam @ApiParam(value = "删除指标分类id",name = "id") Long id) { + try { + indicatorTypeService.deleteIndicatorTypeById(id); + indicatorLibraryService.deleteIndicatorLibrarysIndicatorType(id.intValue()); + + } catch (Exception e) { + log.error("删除指标异常",e); + return R.error(); + } + return R.ok(); + } + } diff --git a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java index dc3b43e0..13e30455 100644 --- a/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java +++ b/src/main/java/com/lz/modules/performance/dao/IndicatorLibraryMapper.java @@ -43,4 +43,6 @@ public interface IndicatorLibraryMapper extends BaseMapper { void updateIndicatorLibrarysMove(@Param("ids")List ids,@Param("indicatorType")Long indicatorType); List statisticalByIndicatorType(); + + int deleteIndicatorLibrarysByIndicatorType(@Param("indicatorType") Integer indicatorType); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java index 524552c9..97acce4b 100644 --- a/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java +++ b/src/main/java/com/lz/modules/performance/service/IndicatorLibraryService.java @@ -43,5 +43,7 @@ public interface IndicatorLibraryService extends IService { List statisticalByIndicatorType(); + int deleteIndicatorLibrarysIndicatorType(Integer indicatorType); + } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java index 4a510c1b..59f53118 100644 --- a/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java +++ b/src/main/java/com/lz/modules/performance/service/impl/IndicatorLibraryServiceImpl.java @@ -116,4 +116,9 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl + + update lz_indicator_library set is_delete = 1 where indicator_type=#{indicatorType} + + +