|
@@ -0,0 +1,56 @@
|
|
|
+package com.sky.ioc.controller.scene;
|
|
|
+
|
|
|
+import com.sky.ioc.entity.domain.scene.Strategy;
|
|
|
+import com.sky.ioc.service.scene.StrategyService;
|
|
|
+import com.sky.ioc.tool.ReturnMsg;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Api(tags ="智慧场景----智能策略")
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("/strategy")
|
|
|
+public class StrategyController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ StrategyService strategyService;
|
|
|
+
|
|
|
+ @ApiOperation("创建策略")
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public ReturnMsg addStrategy(@RequestBody Strategy strategy){
|
|
|
+ return strategyService.addStrategy(strategy);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("删除策略")
|
|
|
+ @PostMapping(value = "/delById")
|
|
|
+ public ReturnMsg delById(@RequestParam(value = "id")Integer id){
|
|
|
+ return strategyService.delStrategyById(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("修改策略")
|
|
|
+ @PostMapping(value = "/update")
|
|
|
+ public ReturnMsg updateStrategy(@RequestBody Strategy strategy){
|
|
|
+ return strategyService.editStrategy(strategy);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("策略列表")
|
|
|
+ @PostMapping(value = "/getStrategyList")
|
|
|
+ public ReturnMsg getStrategyList(@RequestParam(value = "type", required=false)Integer type,
|
|
|
+ @RequestParam(value = "status", required=false)Integer status,
|
|
|
+ @RequestParam(value = "name", required=false)String name){
|
|
|
+
|
|
|
+ return strategyService.getListByNameAndType(type, status,name);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("批量删除策略")
|
|
|
+ @PostMapping(value = "/batchDelByIds")
|
|
|
+ public ReturnMsg batchDelByIds(@RequestBody List<Integer> ids){
|
|
|
+ return strategyService.delBatchById(ids);
|
|
|
+ }
|
|
|
+}
|