|
@@ -3,13 +3,13 @@ package com.gyee.backconfig.service;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.gyee.backconfig.common.requst.vo.ProjectPlanQueryVo;
|
|
|
import com.gyee.backconfig.model.auto.XrpProjectplan;
|
|
|
import com.gyee.backconfig.service.auto.IXrpProjectplanService;
|
|
|
-import com.gyee.backconfig.vo.Projectplanvo;
|
|
|
+import com.gyee.common.model.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.Currency;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -27,18 +27,17 @@ public class BackConfigService {
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
- //返回总查询
|
|
|
- public List<XrpProjectplan> backConfigList() {
|
|
|
+ public List<XrpProjectplan> backConfigList(){
|
|
|
List<XrpProjectplan> xrpProjectplanList = xrpProjectplanService.list();
|
|
|
|
|
|
return xrpProjectplanList;
|
|
|
}
|
|
|
|
|
|
//根据id返回
|
|
|
- public XrpProjectplan projectplanById(String id) {
|
|
|
+ public XrpProjectplan projectplanById(String id){
|
|
|
QueryWrapper<XrpProjectplan> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("id", id);
|
|
|
XrpProjectplan xrpProjectplan = xrpProjectplanService.getOne(queryWrapper);
|
|
|
+ queryWrapper.eq("id",id);
|
|
|
return xrpProjectplan;
|
|
|
}
|
|
|
|
|
@@ -47,6 +46,7 @@ public class BackConfigService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
public Boolean saveSingle(XrpProjectplan xrpProjectplan) {
|
|
|
return xrpProjectplanService.saveOrUpdate(xrpProjectplan);
|
|
|
}
|
|
@@ -57,45 +57,93 @@ public class BackConfigService {
|
|
|
//增加
|
|
|
|
|
|
//分页查询
|
|
|
- public Page<XrpProjectplan> Page(Projectplanvo projectplanvo) {
|
|
|
- Page<XrpProjectplan> Bypage = new Page<XrpProjectplan>(projectplanvo.getCurrent(), projectplanvo.getPagesize());
|
|
|
- QueryWrapper<XrpProjectplan> queryWrapper=new QueryWrapper<XrpProjectplan>();
|
|
|
-
|
|
|
- String id = projectplanvo.getId();
|
|
|
- if (id.isEmpty()&id==null)
|
|
|
- queryWrapper.eq("id",projectplanvo.getId());
|
|
|
|
|
|
- String projectid = projectplanvo.getProjectid();
|
|
|
- if (projectid.isEmpty()&projectid==null)
|
|
|
- queryWrapper.eq("id",projectplanvo.getProjectid());
|
|
|
-
|
|
|
- String generatingcapacity = projectplanvo.getGeneratingcapacity();
|
|
|
- if (generatingcapacity.isEmpty()&generatingcapacity==null)
|
|
|
- queryWrapper.eq("id",projectplanvo.getGeneratingcapacity());
|
|
|
-
|
|
|
- String month = projectplanvo.getMonth();
|
|
|
- if (month.isEmpty()&month==null)
|
|
|
- queryWrapper.eq("id",projectplanvo.getMonth());
|
|
|
+ public Page<XrpProjectplan> listBypage(ProjectPlanQueryVo vo){
|
|
|
+ Page<XrpProjectplan> page=new Page<XrpProjectplan>(vo.getCurrent(),vo.getPageSize());
|
|
|
+
|
|
|
+ QueryWrapper<XrpProjectplan> queryWrapper=new QueryWrapper<>();
|
|
|
+ String id=vo.getId();;
|
|
|
+ String projectid=vo.getProjectid();
|
|
|
+ String generatingcapacity=vo.getGeneratingcapacity();
|
|
|
+ Double outagehours=vo.getOutagehours();
|
|
|
+ String year=vo.getYear();
|
|
|
+ String month=vo.getMonth();
|
|
|
+ String windpower=vo.getWindpower();
|
|
|
+
|
|
|
+
|
|
|
+ if(StringUtils.isNotNull(id)&&!id.equals("")){
|
|
|
+ queryWrapper.eq("id",id);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotNull(projectid)&&!projectid.equals("")){
|
|
|
+ queryWrapper.eq("projectid",projectid);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotNull(generatingcapacity)&&!generatingcapacity.equals("")){
|
|
|
+ queryWrapper.eq("generatingcapacity",generatingcapacity);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotNull(outagehours)&&outagehours!=0.0){
|
|
|
+ queryWrapper.eq("outagehours",outagehours);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotNull(year)&&!year.equals("")){
|
|
|
+ queryWrapper.eq("year",year);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotNull(month)&&!month.equals("")){
|
|
|
+ queryWrapper.eq("month",month);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotNull(windpower)&&!windpower.equals("")){
|
|
|
+ queryWrapper.eq("windpower",windpower);
|
|
|
+ }
|
|
|
+
|
|
|
+ Page<XrpProjectplan> page1 = xrpProjectplanService.page(page, queryWrapper);
|
|
|
+ return page1;
|
|
|
+ }
|
|
|
|
|
|
- String year = projectplanvo.getYear();
|
|
|
- if (year.isEmpty()&year==null)
|
|
|
- queryWrapper.eq("id",projectplanvo.getYear());
|
|
|
|
|
|
- Double outagehours = projectplanvo.getOutagehours();
|
|
|
- if (outagehours.isNaN()&outagehours==null)
|
|
|
- queryWrapper.eq("id",projectplanvo.getOutagehours());
|
|
|
+ public boolean saveOrUpdate(XrpProjectplan xrpProjectplan) {
|
|
|
+ return xrpProjectplanService.saveOrUpdate(xrpProjectplan);
|
|
|
+ }
|
|
|
|
|
|
- String windpower = projectplanvo.getWindpower();
|
|
|
- if (windpower.isEmpty()&windpower==null)
|
|
|
- queryWrapper.eq("id",projectplanvo.getWindpower());
|
|
|
- queryWrapper.eq("id",projectplanvo.getIsdeleted());
|
|
|
- queryWrapper.eq("id",projectplanvo.getCurrent());
|
|
|
- queryWrapper.eq("id",projectplanvo.getPagesize());
|
|
|
+ public boolean removeWapper(XrpProjectplan xrpProjectplan) {
|
|
|
|
|
|
- Page<XrpProjectplan> page = xrpProjectplanService.page(Bypage, queryWrapper);
|
|
|
|
|
|
- return page;
|
|
|
+ QueryWrapper<XrpProjectplan> queryWrapper=new QueryWrapper<XrpProjectplan>();
|
|
|
+ conditionJudge(xrpProjectplan, queryWrapper);
|
|
|
+ return xrpProjectplanService.remove(queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ private void conditionJudge(XrpProjectplan xrpProjectplan, QueryWrapper<XrpProjectplan> queryWrapper) {
|
|
|
+ String id=xrpProjectplan.getId();
|
|
|
+ String projectid=xrpProjectplan.getProjectid();
|
|
|
+ String generatingcapacity=xrpProjectplan.getGeneratingcapacity();
|
|
|
+ Double outagehours=xrpProjectplan.getOutagehours();
|
|
|
+ String year=xrpProjectplan.getYear();
|
|
|
+ String month=xrpProjectplan.getMonth();
|
|
|
+ String windpower=xrpProjectplan.getWindpower();
|
|
|
+ if(StringUtils.isNotNull(id)&&!id.equals("")){
|
|
|
+ queryWrapper.eq("id",id);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotNull(projectid)&&!projectid.equals("")){
|
|
|
+ queryWrapper.eq("projectid",projectid);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotNull(generatingcapacity)&&!generatingcapacity.equals("")){
|
|
|
+ queryWrapper.eq("generatingcapacity",generatingcapacity);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotNull(outagehours)&&outagehours!=0.0){
|
|
|
+ queryWrapper.eq("outagehours",outagehours);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotNull(year)&&!year.equals("")){
|
|
|
+ queryWrapper.eq("year",year);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotNull(month)&&!month.equals("")){
|
|
|
+ queryWrapper.eq("month",month);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotNull(windpower)&&!windpower.equals("")){
|
|
|
+ queryWrapper.eq("windpower",windpower);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ public boolean removeWapperById(String id) {
|
|
|
+ QueryWrapper<XrpProjectplan> queryWrapper=new QueryWrapper<XrpProjectplan>();
|
|
|
+ queryWrapper.eq("id",id);
|
|
|
+ return xrpProjectplanService.remove(queryWrapper);
|
|
|
+ }
|
|
|
}
|