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} + + +