|
@@ -4,6 +4,7 @@ package com.gyee.backconfig.controller;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.gyee.backconfig.config.R;
|
|
|
import com.gyee.backconfig.model.auto.Companys;
|
|
@@ -38,38 +39,58 @@ public class CompanysController {
|
|
|
|
|
|
/**
|
|
|
* 查询
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @param name
|
|
|
+ * @param aname
|
|
|
+ * @param capacity
|
|
|
* @param pageNum
|
|
|
* @param pageSize
|
|
|
* @return
|
|
|
*/
|
|
|
-// @GetMapping(value = "/companys")
|
|
|
-// public R findList(@RequestParam(value = "id",required = true) String id,
|
|
|
-// @RequestParam(value = "name",required = true) String name,
|
|
|
-// @RequestParam(value = "pageNum",required = true) String pageNum,
|
|
|
-// @RequestParam(value = "pageSize",required = true) String pageSize){
|
|
|
-// List<Companys> list = companysService.list(id,name,pageNum,pageSize);
|
|
|
-// if (StringUtils.isNotEmpty(list)){
|
|
|
-// return R.ok(list.size()).data(list);
|
|
|
-// }else {
|
|
|
-// return R.error().data("查询失败!");
|
|
|
-// }
|
|
|
-// }
|
|
|
+ @GetMapping(value = "/listByPage")
|
|
|
+ public R findList(@RequestParam(value = "id", required = false) String id,
|
|
|
+ @RequestParam(value = "name", required = false) String name,
|
|
|
+ @RequestParam(value = "aname", required = false) String aname,
|
|
|
+ @RequestParam(value = "windcapacity", required = false) Integer windcapacity,
|
|
|
+ @RequestParam(value = "windcapacityunit", required = false) String windcapacityunit,
|
|
|
+ @RequestParam(value = "windquantity", required = false) Integer windquantity,
|
|
|
+ @RequestParam(value = "capacity", required = false) Integer capacity,
|
|
|
+ @RequestParam(value = "capacityunit", required = false) String capacityunit,
|
|
|
+ @RequestParam(value = "quantityjz", required = false) Integer quantityjz,
|
|
|
+ @RequestParam(value = "quantityzc", required = false) Integer quantityzc,
|
|
|
+ @RequestParam(value = "jrwindcapacity", required = false) Integer jrwindcapacity,
|
|
|
+ @RequestParam(value = "jrwindcapacityunit", required = false) String jrwindcapacityunit,
|
|
|
+ @RequestParam(value = "jrwindquantity", required = false) Integer jrwindquantity,
|
|
|
+ @RequestParam(value = "jrcapacity", required = false) Integer jrcapacity,
|
|
|
+ @RequestParam(value = "jrcapacityunit", required = false) String jrcapacityunit,
|
|
|
+ @RequestParam(value = "jrquantityjz", required = false) Integer jrquantityjz,
|
|
|
+ @RequestParam(value = "jrquantityzc", required = false) Integer jrquantityzc,
|
|
|
+ @RequestParam(value = "ordernum", required = false) Integer ordernum,
|
|
|
+ @RequestParam(value = "pageNum", required = true) String pageNum,
|
|
|
+ @RequestParam(value = "pageSize", required = true) String pageSize) {
|
|
|
+ IPage<Companys> list = companysService.list(id, name, aname,windcapacity, windcapacityunit, windquantity, capacity, capacityunit, quantityjz, quantityzc, jrwindcapacity, jrwindcapacityunit, jrwindquantity, jrcapacity, jrcapacityunit, jrquantityjz, jrquantityzc, ordernum, pageNum, pageSize);
|
|
|
+ if (null != list) {
|
|
|
+ return R.ok().data(list);
|
|
|
+ } else {
|
|
|
+ return R.error().data("查询失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 根据id查询
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping(value = "/companys/{id}")
|
|
|
- public R findOne(@PathVariable("id") String id){
|
|
|
+ public R findOne(@PathVariable("id") String id) {
|
|
|
QueryWrapper<Companys> qw = new QueryWrapper<>();
|
|
|
- qw.eq("id",id);
|
|
|
+ qw.eq("id", id);
|
|
|
Companys companys = companysService.getOne(qw);
|
|
|
- if (StringUtils.isNotNull(companys)){
|
|
|
+ if (StringUtils.isNotNull(companys)) {
|
|
|
return R.ok().data(companys);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return R.error().data("查询失败!");
|
|
|
}
|
|
|
|
|
@@ -77,16 +98,17 @@ public class CompanysController {
|
|
|
|
|
|
/**
|
|
|
* 插入(批量)
|
|
|
+ *
|
|
|
* @param company
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping(value = "/companys")
|
|
|
- public R addAll(@RequestBody Companys company){
|
|
|
+ public R addAll(@RequestBody Companys company) {
|
|
|
|
|
|
boolean b = companysService.saveOrUpdate(company);
|
|
|
- if (b){
|
|
|
+ if (b) {
|
|
|
return R.ok().data(b);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return R.error().data("保存失败!");
|
|
|
}
|
|
|
|
|
@@ -94,14 +116,15 @@ public class CompanysController {
|
|
|
|
|
|
/**
|
|
|
* 批量删除
|
|
|
+ *
|
|
|
* @param ids
|
|
|
* @return
|
|
|
*/
|
|
|
@DeleteMapping(value = "/remove-companys/{ids}")
|
|
|
- public R deleteAll(@PathVariable("ids") String ids) {
|
|
|
+ public R deleteAll(@PathVariable("ids") String ids) {
|
|
|
String[] strings = ids.split(",");
|
|
|
|
|
|
- boolean b = companysService.removeByIds(Arrays.asList(strings));
|
|
|
+ boolean b = companysService.removeByIds(Arrays.asList(strings));
|
|
|
|
|
|
|
|
|
if (b) {
|
|
@@ -113,52 +136,53 @@ public class CompanysController {
|
|
|
|
|
|
/**
|
|
|
* 批量修改
|
|
|
+ *
|
|
|
* @param list
|
|
|
* @return
|
|
|
*/
|
|
|
@PutMapping(value = "/companys")
|
|
|
- public R update(@RequestBody List<Companys> list){
|
|
|
+ public R update(@RequestBody List<Companys> list) {
|
|
|
boolean b = companysService.updateBatchById(list);
|
|
|
- if (b){
|
|
|
+ if (b) {
|
|
|
return R.ok().data(b);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return R.error().data("更新失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//分页查询
|
|
|
- @GetMapping("/listByPage")
|
|
|
- @ResponseBody
|
|
|
- @CrossOrigin(origins = "*", maxAge = 3600)
|
|
|
- public R ListByPage(
|
|
|
- @RequestParam(value = "pagenum",required = true) Integer pageNum,
|
|
|
- @RequestParam(value = "pagesize",required = true) Integer pageSize,
|
|
|
- @RequestParam(value = "id", required = false) String id,
|
|
|
- @RequestParam(value = "rid", required = false) String rid,
|
|
|
- @RequestParam(value = "name", required = false) String name,
|
|
|
- @RequestParam(value = "version", required = false) Integer version){
|
|
|
- Companysvo vo=new Companysvo();
|
|
|
- setVOTemplate(pageNum, pageSize, id, rid, name,version, vo);
|
|
|
-
|
|
|
- Page<Companys> CompanysPage = backConfigService.CompanysBypage(vo);
|
|
|
- if (StringUtils.isNotNull(CompanysPage)) {
|
|
|
- return R.ok().data(CompanysPage);
|
|
|
- }else{
|
|
|
- return R.error().message("访问失败");
|
|
|
- }
|
|
|
- }
|
|
|
- private void setVOTemplate(@RequestParam(value = "pagenum", required = true) Integer pageNum,
|
|
|
- @RequestParam(value = "pagesize", required = true) Integer pageSize,
|
|
|
- @RequestParam(value = "id", required = false) String id,
|
|
|
- @RequestParam(value = "rid", required = false) String rid,
|
|
|
- @RequestParam(value = "name", required = false) String name,
|
|
|
- @RequestParam(value = "version", required = false) Integer version, Companysvo vo) {
|
|
|
- vo.setId(id);
|
|
|
- vo.setRid(rid);
|
|
|
- vo.setName(name);
|
|
|
- vo.setVersion(version);
|
|
|
- vo.setCurrent(pageNum);
|
|
|
- vo.setPageSize(pageSize);
|
|
|
- }
|
|
|
+// @GetMapping("/listByPage")
|
|
|
+// @ResponseBody
|
|
|
+// @CrossOrigin(origins = "*", maxAge = 3600)
|
|
|
+// public R ListByPage(
|
|
|
+// @RequestParam(value = "pagenum", required = true) Integer pageNum,
|
|
|
+// @RequestParam(value = "pagesize", required = true) Integer pageSize,
|
|
|
+// @RequestParam(value = "id", required = false) String id,
|
|
|
+// @RequestParam(value = "rid", required = false) String rid,
|
|
|
+// @RequestParam(value = "name", required = false) String name,
|
|
|
+// @RequestParam(value = "version", required = false) Integer version) {
|
|
|
+// Companysvo vo = new Companysvo();
|
|
|
+// setVOTemplate(pageNum, pageSize, id, rid, name, version, vo);
|
|
|
+//
|
|
|
+// Page<Companys> CompanysPage = backConfigService.CompanysBypage(vo);
|
|
|
+// if (StringUtils.isNotNull(CompanysPage)) {
|
|
|
+// return R.ok().data(CompanysPage);
|
|
|
+// } else {
|
|
|
+// return R.error().message("访问失败");
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// private void setVOTemplate(@RequestParam(value = "pagenum", required = true) Integer pageNum,
|
|
|
+// @RequestParam(value = "pagesize", required = true) Integer pageSize,
|
|
|
+// @RequestParam(value = "id", required = false) String id,
|
|
|
+// @RequestParam(value = "rid", required = false) String rid,
|
|
|
+// @RequestParam(value = "name", required = false) String name,
|
|
|
+// @RequestParam(value = "version", required = false) Integer version, Companysvo vo) {
|
|
|
+// vo.setId(id);
|
|
|
+// vo.setName(name);
|
|
|
+// vo.setVersion(version);
|
|
|
+// vo.setCurrent(pageNum);
|
|
|
+// vo.setPageSize(pageSize);
|
|
|
+// }
|
|
|
|
|
|
}
|