增加指标分类删除

This commit is contained in:
DirectionOfMind 2021-01-19 15:12:59 +08:00
parent 3b261f2d6d
commit 9b91874ff2
5 changed files with 37 additions and 4 deletions

View File

@ -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();
}
}

View File

@ -43,4 +43,6 @@ public interface IndicatorLibraryMapper extends BaseMapper<IndicatorLibrary> {
void updateIndicatorLibrarysMove(@Param("ids")List<Long> ids,@Param("indicatorType")Long indicatorType);
List<StatisticalIndicatorTypeDto> statisticalByIndicatorType();
int deleteIndicatorLibrarysByIndicatorType(@Param("indicatorType") Integer indicatorType);
}

View File

@ -43,5 +43,7 @@ public interface IndicatorLibraryService extends IService<IndicatorLibrary> {
List<StatisticalIndicatorTypeDto> statisticalByIndicatorType();
int deleteIndicatorLibrarysIndicatorType(Integer indicatorType);
}

View File

@ -116,4 +116,9 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl<IndicatorLibraryMap
dtos.add(0,dto);
return dtos;
}
@Override
public int deleteIndicatorLibrarysIndicatorType(Integer indicatorType) {
return indicatorLibraryMapper.deleteIndicatorLibrarysByIndicatorType(indicatorType);
}
}

View File

@ -131,5 +131,10 @@
</select>
<update id="deleteIndicatorLibrarysByIndicatorType" parameterType="java.lang.Integer">
update lz_indicator_library set is_delete = 1 where indicator_type=#{indicatorType}
</update>
</mapper>