|
@@ -1,9 +1,15 @@
|
|
|
package com.gyee.backconfig.controller;
|
|
|
|
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.gyee.backconfig.config.R;
|
|
|
+import com.gyee.backconfig.model.auto.Indicators;
|
|
|
+import com.gyee.backconfig.service.auto.IIndicatorsService;
|
|
|
+import com.gyee.common.model.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -17,4 +23,100 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@RequestMapping("//indicators")
|
|
|
public class IndicatorsController {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IIndicatorsService iIndicatorsService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询
|
|
|
+ * @param id
|
|
|
+ * @param name
|
|
|
+ * @param pageNum
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/List")
|
|
|
+ public R findList(@RequestParam(value = "id",required = false) String id,
|
|
|
+ @RequestParam(value = "name",required = false) String name,
|
|
|
+ @RequestParam(value = "code",required = false) String code,
|
|
|
+ @RequestParam(value = "windpowerstationid",required = false) String windpowerstationid,
|
|
|
+ @RequestParam(value = "pageNum",required = true) String pageNum,
|
|
|
+ @RequestParam(value = "pageSize",required = true) String pageSize){
|
|
|
+ IPage<Indicators> list = iIndicatorsService.getList(id,name,code,windpowerstationid,pageNum,pageSize);
|
|
|
+ if (null != list){
|
|
|
+ return R.ok().data(list);
|
|
|
+ }else {
|
|
|
+ return R.error().data("查询失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据id查询
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/{id}")
|
|
|
+ public R findOne(@PathVariable("id") String id){
|
|
|
+
|
|
|
+ Indicators indicators = iIndicatorsService.getOne(id);
|
|
|
+ if (StringUtils.isNotNull(indicators)){
|
|
|
+ return R.ok().data(indicators);
|
|
|
+ }else {
|
|
|
+ return R.error().data("查询失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 插入(批量)
|
|
|
+ * @param indicators
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public R addAll(@RequestBody Indicators indicators){
|
|
|
+
|
|
|
+ boolean b = iIndicatorsService.addOrUpdate(indicators);
|
|
|
+ if (b){
|
|
|
+ return R.ok().data(b);
|
|
|
+ }else {
|
|
|
+ return R.error().data("保存失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @DeleteMapping(value = "/{ids}")
|
|
|
+ public R deleteAll(@PathVariable("ids") String ids){
|
|
|
+ boolean b = iIndicatorsService.removeByIds(ids);
|
|
|
+ if (b){
|
|
|
+ return R.ok().data(b);
|
|
|
+ }else {
|
|
|
+ return R.error().data("删除失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量修改
|
|
|
+ * @param list
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PutMapping(value = "/editIndicators")
|
|
|
+ public R update(@RequestBody List<Indicators> list){
|
|
|
+ boolean b = iIndicatorsService.updateBatchById(list);
|
|
|
+ if (b){
|
|
|
+ return R.ok().data(b);
|
|
|
+ }else {
|
|
|
+ return R.error().data("更新失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|