|
@@ -0,0 +1,183 @@
|
|
|
+package com.gyee.frame.service;
|
|
|
+
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import com.gyee.frame.common.base.BaseService;
|
|
|
+import com.gyee.frame.mapper.auto.WindturbineinfodayMapper;
|
|
|
+import com.gyee.frame.model.auto.Windturbineinfoday;
|
|
|
+import com.gyee.frame.model.auto.WindturbineinfodayExample;
|
|
|
+import com.gyee.frame.model.custom.Tablepar;
|
|
|
+import com.gyee.frame.netty.websocket.util.SocketToolService;
|
|
|
+import com.gyee.frame.util.DateUtils;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * WeatherfdService
|
|
|
+ * @Title: WeatherfdService.java
|
|
|
+ * @Package com.gyee.frame.service
|
|
|
+ * @author Wang Jiawen_自动生成
|
|
|
+ * @email 1@qq.com
|
|
|
+ * @date 2020-01-07 16:13:24
|
|
|
+ **/
|
|
|
+@Service
|
|
|
+public class WindturbineinfodayService extends SocketToolService implements BaseService<Windturbineinfoday, WindturbineinfodayExample>{
|
|
|
+ @Resource
|
|
|
+ private WindturbineinfodayMapper windturbineinfodayMapper;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询
|
|
|
+ * @param windpowerstationid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public PageInfo<Windturbineinfoday> list(Tablepar tablepar,String name,String windpowerstationid) throws ParseException {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date recodedate = sdf.parse(name);
|
|
|
+ WindturbineinfodayExample testExample=new WindturbineinfodayExample();
|
|
|
+ testExample.setOrderByClause("id ASC");
|
|
|
+ if(name!=null&&!"".equals(name)){
|
|
|
+ testExample.createCriteria().andRecorddateEqualTo(recodedate);
|
|
|
+ }
|
|
|
+
|
|
|
+ PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
|
|
|
+ List<Windturbineinfoday> list= windturbineinfodayMapper.selectByExample(testExample);
|
|
|
+ for(Windturbineinfoday windturbineinfoday:list){
|
|
|
+ String windpowerstationid1 = windturbineinfoday.getWindpowerstationid();
|
|
|
+ if(windpowerstationid1.equalsIgnoreCase(windpowerstationid)){
|
|
|
+ list.remove(windturbineinfoday);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ PageInfo<Windturbineinfoday> pageInfo = new PageInfo<Windturbineinfoday>(list);
|
|
|
+ return pageInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ * @throws ParseException
|
|
|
+ */
|
|
|
+ public Windturbineinfoday findListByDate(String wtid,String recorddate) throws ParseException {
|
|
|
+
|
|
|
+ Windturbineinfoday wpi=null;
|
|
|
+
|
|
|
+ if(wtid!=null&&!"".equals(wtid) && recorddate!=null&&!"".equals(recorddate)){
|
|
|
+
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date recodedatebegin =sdf.parse(recorddate);
|
|
|
+ Date recodedateend = DateUtils.addDays(recodedatebegin,1);
|
|
|
+ WindturbineinfodayExample testExample=new WindturbineinfodayExample();
|
|
|
+ testExample.setOrderByClause("id ASC");
|
|
|
+ testExample.createCriteria().andWindturbineidEqualTo(wtid).andRecorddateBetween(recodedatebegin,recodedateend);
|
|
|
+ List<Windturbineinfoday> list= windturbineinfodayMapper.selectByExample(testExample);
|
|
|
+
|
|
|
+ if(!list.isEmpty())
|
|
|
+ {
|
|
|
+ wpi=list.get(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return wpi;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String convertmessage(Object message){
|
|
|
+ return "123456";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int deleteByPrimaryKey(String ids) {
|
|
|
+
|
|
|
+
|
|
|
+ return -1;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Windturbineinfoday selectByPrimaryKey(String id) {
|
|
|
+
|
|
|
+ return windturbineinfodayMapper.selectByPrimaryKey(Integer.valueOf(id));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int updateByPrimaryKeySelective(Windturbineinfoday record) {
|
|
|
+ return windturbineinfodayMapper.updateByPrimaryKeySelective(record);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public int insertSelective(Windturbineinfoday record) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int updateByExampleSelective(Windturbineinfoday record, WindturbineinfodayExample example) {
|
|
|
+
|
|
|
+ return windturbineinfodayMapper.updateByExampleSelective(record, example);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int updateByExample(Windturbineinfoday record, WindturbineinfodayExample example) {
|
|
|
+
|
|
|
+ return windturbineinfodayMapper.updateByExample(record, example);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Windturbineinfoday> selectByExample(WindturbineinfodayExample example) {
|
|
|
+
|
|
|
+ return windturbineinfodayMapper.selectByExample(example);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public long countByExample(WindturbineinfodayExample example) {
|
|
|
+
|
|
|
+ return windturbineinfodayMapper.countByExample(example);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int deleteByExample(WindturbineinfodayExample example) {
|
|
|
+
|
|
|
+ return windturbineinfodayMapper.deleteByExample(example);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查name
|
|
|
+ * @param windturbineinfoday
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public int checkNameUnique(Windturbineinfoday windturbineinfoday){
|
|
|
+ WindturbineinfodayExample example=new WindturbineinfodayExample();
|
|
|
+ example.createCriteria().andRecorddateEqualTo(windturbineinfoday.getRecorddate());
|
|
|
+ List<Windturbineinfoday> list=windturbineinfodayMapper.selectByExample(example);
|
|
|
+ return list.size();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|