|
@@ -2,15 +2,20 @@ package com.gyee.backconfig.controller;
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.gyee.backconfig.config.MyPage;
|
|
|
import com.gyee.backconfig.config.R;
|
|
|
import com.gyee.backconfig.model.auto.Project;
|
|
|
+import com.gyee.backconfig.model.auto.Windpowerstation;
|
|
|
import com.gyee.backconfig.service.BackConfigService;
|
|
|
+import com.gyee.backconfig.service.auto.IProjectService;
|
|
|
import com.gyee.backconfig.vo.Projectvo;
|
|
|
import com.gyee.common.model.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -26,6 +31,9 @@ public class ProjectController {
|
|
|
@Resource
|
|
|
private BackConfigService backConfigService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IProjectService projectService;
|
|
|
+
|
|
|
@GetMapping("/listByPage")
|
|
|
@ResponseBody
|
|
|
@CrossOrigin(origins = "*", maxAge = 3600)
|
|
@@ -93,4 +101,104 @@ public class ProjectController {
|
|
|
vo.setVersion(version);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询
|
|
|
+ * @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 = "companyid",required = false) String companyid,
|
|
|
+ @RequestParam(value = "pageNum",required = true) String pageNum,
|
|
|
+ @RequestParam(value = "pageSize",required = true) String pageSize){
|
|
|
+ MyPage<Project> list = projectService.getList(id,name,code,companyid,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){
|
|
|
+
|
|
|
+ Project project = projectService.getOne(id);
|
|
|
+ if (StringUtils.isNotNull(project)){
|
|
|
+ return R.ok().data(project);
|
|
|
+ }else {
|
|
|
+ return R.error().data("查询失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 插入(批量)
|
|
|
+ * @param project
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public R addAll(@RequestBody Project project){
|
|
|
+
|
|
|
+ boolean b = projectService.addOrUpdate(project);
|
|
|
+ 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 = projectService.removeByIds(ids);
|
|
|
+ if (b){
|
|
|
+ return R.ok().data(b);
|
|
|
+ }else {
|
|
|
+ return R.error().data("删除失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量修改
|
|
|
+ * @param list
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PutMapping(value = "/editRegions")
|
|
|
+ public R update(@RequestBody List<Project> list){
|
|
|
+ boolean b = projectService.updateBatchById(list);
|
|
|
+ if (b){
|
|
|
+ return R.ok().data(b);
|
|
|
+ }else {
|
|
|
+ return R.error().data("更新失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|