Commit c705dc51 authored by dxw's avatar dxw

热泵、水泵

parent d22e9d88
......@@ -32,17 +32,24 @@ public class InitRunner implements CommandLineRunner {
public void run(String... args) throws Exception {
try {
SysSystemParams sysSystemParams = sysSystemParamsService.getOne(new LambdaQueryWrapper<SysSystemParams>().last("limit 1"));
if(sysSystemParams.getType() == 1){
// 获取定时任务信息
List<TimedTask> timedTasks = timedTaskService.list(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus,Constants.INT_1));
if(timedTasks != null && timedTasks.size() > 0){
for(TimedTask timedTask : timedTasks){
R r = equipmentController.timedTask(timedTask.getId(),timedTask.getStartTime(),timedTask.getEndTime(),Constants.INT_1,
timedTask.getBusinessType(),timedTask.getType(),Constants.STRING_1);
// 获取定时任务信息
List<TimedTask> timedTasks = timedTaskService.list(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus,Constants.INT_1));
if(timedTasks != null && timedTasks.size() > 0){
for(TimedTask timedTask : timedTasks){
if(sysSystemParams.getType() == 1 && timedTask.getBusinessType() != Constants.INT_3) {
R r = equipmentController.timedTask(timedTask.getId(), timedTask.getStartTime(), timedTask.getEndTime(), Constants.INT_1,
timedTask.getBusinessType(), timedTask.getType(), Constants.STRING_1);
if (!Constants.STRING_0.equals(r.get(Constants.CODE_WORD).toString())) {
System.err.println("定时任务启动失败!!");
}
}
// else if(sysSystemParams.getType() == 2 && timedTask.getBusinessType() == Constants.INT_3) {
// R r = equipmentController.timedTask(timedTask.getId(), timedTask.getStartTime(), timedTask.getEndTime(), Constants.INT_1,
// timedTask.getBusinessType(), timedTask.getType(), Constants.STRING_1);
// if (!Constants.STRING_0.equals(r.get(Constants.CODE_WORD).toString())) {
// System.err.println("定时任务启动失败!!");
// }
// }
}
}
} catch (Exception e) {
......
package com.devplatform.admin.common.scheduling;
import org.springframework.stereotype.Component;
/**
* 执行设备预警消息
* @author Administrator
*/
@Component
public class ScheduledTasks {
}
......@@ -36,6 +36,8 @@ public class SimpleJob implements Job {
}else {
}
}else if(businessType == Constants.INT_3){
LOG.info("执行节能任务");
}
}
}
package com.devplatform.admin.common.scheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* @Author: jzj
* @Date: 2020/10/30 17:21
*/
@Component
//@Component
public class SyncFileTasks {
// @Resource
......@@ -19,35 +18,6 @@ public class SyncFileTasks {
*/
@Scheduled(cron = "0 */5 * * * ?")
public void scheduled() throws Exception {
// List<SysSynchFilelog> listData = sysSynchFilelogService.queryAll();
// for (SysSynchFilelog sysSynchFilelog: listData) {
// if(StringUtils.isNotBlank(sysSynchFilelog.getRealbasePath()) &&
// StringUtils.isNotBlank(sysSynchFilelog.getChildrenPath()) &&
// StringUtils.isNotBlank(sysSynchFilelog.getFileName()) ){
// InputStream inputStream = null;
// try{
// String savePath = sysSynchFilelog.getRealbasePath()+sysSynchFilelog.getChildrenPath()+"/"+sysSynchFilelog.getFileName();
// File fileNew = new File(savePath);
// inputStream = new FileInputStream(fileNew);
// SftpUtil.uploadFile(
// sysSynchFilelog.getUsername(),
// sysSynchFilelog.getPassword(),
// sysSynchFilelog.getIp(),
// 22,
// sysSynchFilelog.getRealbasePath(),
// sysSynchFilelog.getChildrenPath(),
// fileNew.getName(),
// null,
// inputStream);
// }catch (Exception e){
// continue;
// }finally {
// if(inputStream!=null){
// inputStream.close();
// }
// }
// sysSynchFilelogService.removeById(sysSynchFilelog.getId());
// }
// }
System.out.println("11111111111111111111");
}
}
package com.devplatform.admin.common.scheduling;
import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.TriggerContext;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.support.PeriodicTrigger;
import org.springframework.stereotype.Component;
import java.util.Date;
/** 设备拓扑监测定时任务,生成报警信息(站点) @Author: jzj @Date: 2020/9/18 15:02 */
@Component
public class TopologyTasks implements SchedulingConfigurer {
private Long timer;
public Long getTimer() {
return timer;
}
public void setTimer(Long timer) {
this.timer = timer;
}
private String cron;
public String getCron() {
return cron;
}
public void setCron(String cron) {
this.cron = cron;
}
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
taskRegistrar.addTriggerTask(
new Runnable() {
@Override
public void run() {
// try {
// if (sysSystem == null) {
// sysSystem = sysSystemService.getOne(null);
//
// // 站点
// if (Constants.STRING_1.equals(sysSystem.getType())) {
// SysParams bean = new SysParams();
// bean =
// sysParamsService.getOne(
// new QueryWrapper<SysParams>()
// .eq("name", "topology")
// .eq("station_id", sysSystem.getCode()));
// if(StringUtils.isNotBlank(bean.getValue())){
// timer = Long.parseLong(bean.getValue())*1000;
// }
// }
// // 线路或者路网
// if (Constants.STRING_2.equals(sysSystem.getType()) || Constants.STRING_3.equals(sysSystem.getType())) {
// RtSysParams bean = new RtSysParams();
// bean =
// rtSysParamsService.getOne(
// new QueryWrapper<RtSysParams>()
// .eq("name", "topology")
// .eq("station_id", sysSystem.getCode()));
// if(StringUtils.isNotBlank(bean.getValue())){
// timer = Long.parseLong(bean.getValue())*1000;
// }
// }
// }
// // 站点,设备报警信息生成
// if (Constants.STRING_1.equals(sysSystem.getType())) {
// eqEquipmentService.topology(250, sysSystem.getCode());
// }
// // 路网或线路,设备报警信息生成
// if (Constants.STRING_2.equals(sysSystem.getType()) || Constants.STRING_3.equals(sysSystem.getType())) {
// rtEqEquipmentService.topology(250, sysSystem.getCode(), sysSystem.getType());
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
}
},
new Trigger() {
@Override
public Date nextExecutionTime(TriggerContext triggerContext) {
// System.out.println("站点-----------"+cron);
if (timer == null) {
timer = (long)15000;
}
PeriodicTrigger periodicTrigger = new PeriodicTrigger(timer);
Date nextExecDate = periodicTrigger.nextExecutionTime(triggerContext);
return nextExecDate;
}
});
}
}
......@@ -24,9 +24,12 @@ public class SbInfo implements Serializable {
/** 资源点id */
@ApiModelProperty(value="资源点id",name="resourceId")
private java.lang.String resourceId;
/** 当前频率 */
@ApiModelProperty(value="当前频率",name="currentFrequency")
/** 运转频率 */
@ApiModelProperty(value="运转频率",name="currentFrequency")
private java.lang.String currentFrequency;
/** 设定频率 */
@ApiModelProperty(value="设定频率",name="setFrequency")
private java.lang.String setFrequency;
/** 故障报警 */
@ApiModelProperty(value="故障报警",name="faultAlarm")
private java.lang.String faultAlarm;
......@@ -39,4 +42,13 @@ public class SbInfo implements Serializable {
/** 创建时间 */
@ApiModelProperty(value="创建时间",name="createTime")
private java.util.Date createTime;
/** 电能 */
@ApiModelProperty(value="电能",name="electricEnergy")
private String electricEnergy;
/** 电表通讯故障 */
@ApiModelProperty(value="电表通讯故障",name="communicationFailure")
private String communicationFailure;
/** 运行反馈 */
@ApiModelProperty(value="运行反馈",name="signalFeedback")
private String signalFeedback;
}
package com.devplatform.admin.modules.eq.bean;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel(value="水泵信息-天对象",description="水泵信息-天对象")
@TableName("sb_info_day")
public class SbInfoDay implements Serializable {
private static final long serialVersionUID = 1L;
/** 主键id */
@ApiModelProperty(value="主键ID",name="id")
@TableId
private String id;
/** 资源点id */
@ApiModelProperty(value="资源点id",name="resourceId")
private String resourceId;
/** 电能 */
@ApiModelProperty(value="电能",name="electricEnergy")
private String electricEnergy;
/** 类型(1手动,2节能) */
@ApiModelProperty(value="类型(1手动,2节能)",name="type")
private Integer type;
/** 站点表id */
@ApiModelProperty(value="站点表id",name="stationId")
private String stationId;
/** 创建时间 */
@ApiModelProperty(value="创建时间",name="createTime")
private java.util.Date createTime;
}
package com.devplatform.admin.modules.eq.bean;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel(value="水泵信息-时对象",description="水泵信息-时对象")
@TableName("sb_info_hour")
public class SbInfoHour implements Serializable {
private static final long serialVersionUID = 1L;
/** 主键id */
@ApiModelProperty(value="主键ID",name="id")
@TableId
private String id;
/** 资源点id */
@ApiModelProperty(value="资源点id",name="resourceId")
private String resourceId;
/** 电能 */
@ApiModelProperty(value="电能",name="electricEnergy")
private String electricEnergy;
/** 类型(1手动,2节能) */
@ApiModelProperty(value="类型(1手动,2节能)",name="type")
private Integer type;
/** 站点表id */
@ApiModelProperty(value="站点表id",name="stationId")
private String stationId;
/** 创建时间 */
@ApiModelProperty(value="创建时间",name="createTime")
private java.util.Date createTime;
}
package com.devplatform.admin.modules.eq.bean;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel(value="水泵信息-月对象",description="水泵信息-月对象")
@TableName("sb_info_month")
public class SbInfoMonth implements Serializable {
private static final long serialVersionUID = 1L;
/** 主键id */
@ApiModelProperty(value="主键ID",name="id")
@TableId
private String id;
/** 资源点id */
@ApiModelProperty(value="资源点id",name="resourceId")
private String resourceId;
/** 电能 */
@ApiModelProperty(value="电能",name="electricEnergy")
private String electricEnergy;
/** 类型(1手动,2节能) */
@ApiModelProperty(value="类型(1手动,2节能)",name="type")
private Integer type;
/** 站点表id */
@ApiModelProperty(value="站点表id",name="stationId")
private String stationId;
/** 创建时间 */
@ApiModelProperty(value="创建时间",name="createTime")
private java.util.Date createTime;
}
package com.devplatform.admin.modules.eq.bean;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel(value="水泵信息-年对象",description="水泵信息-年对象")
@TableName("sb_info_year")
public class SbInfoYear implements Serializable {
private static final long serialVersionUID = 1L;
/** 主键id */
@ApiModelProperty(value="主键ID",name="id")
@TableId
private String id;
/** 资源点id */
@ApiModelProperty(value="资源点id",name="resourceId")
private String resourceId;
/** 电能 */
@ApiModelProperty(value="电能",name="electricEnergy")
private String electricEnergy;
/** 类型(1手动,2节能) */
@ApiModelProperty(value="类型(1手动,2节能)",name="type")
private Integer type;
/** 站点表id */
@ApiModelProperty(value="站点表id",name="stationId")
private String stationId;
/** 创建时间 */
@ApiModelProperty(value="创建时间",name="createTime")
private java.util.Date createTime;
}
......@@ -116,12 +116,25 @@ public class EquipmentController extends AbstractController {
temp.setUpdateTime(time);
sysSystemRunningTimeService.save(temp);
//如果切换成节能模式,则关闭定时任务
if(type == Constants.INT_2){
TimedTask timedTask = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus,Constants.INT_1).last("limit 1"));
if(type == Constants.INT_1){
// TimedTask timedTaskJn = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus,Constants.INT_1).eq(TimedTask::getBusinessType,Constants.INT_3).last("limit 1"));
// if(timedTaskJn != null){
// this.timedTask(timedTaskJn.getId(),timedTaskJn.getStartTime(),timedTaskJn.getEndTime(),Constants.INT_2,Constants.INT_3,null,"");
// }
}else if(type == Constants.INT_2){//如果切换成节能模式,则关闭人工模式的定时任务,打开节能模式定时任务
TimedTask timedTask = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus,Constants.INT_1)
// .eq(TimedTask::getBusinessType,Constants.INT_1)
.last("limit 1"));
if(timedTask != null){
this.timedTask(timedTask.getId(),timedTask.getStartTime(),timedTask.getEndTime(),Constants.INT_2,1,null,"");
}
// TimedTask timedTaskJn = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus,Constants.INT_1).eq(TimedTask::getBusinessType,Constants.INT_3).last("limit 1"));
// if(timedTaskJn != null){
// this.timedTask(timedTaskJn.getId(),timedTaskJn.getStartTime(),timedTaskJn.getEndTime(),Constants.INT_1,Constants.INT_3,null,"");
// }else{
// this.timedTask("","30","",Constants.INT_1,Constants.INT_3,null,"");
// }
}
Map<String,Object> list = equipmentService.getList();
......@@ -237,7 +250,13 @@ public class EquipmentController extends AbstractController {
resJobDataMap1.put("type", type);
job1 = JobBuilder.newJob(SimpleJob.class).withIdentity(id+"-start", JOB_GROUP_NAME).usingJobData(resJobDataMap1).build();
String cron1 = createCron(startTime);
String cron1 = "";
if(businessType == Constants.INT_3){
cron1 = createCron2(startTime);
}else{
cron1 = createCron(startTime);
}
trigger1 = TriggerBuilder.newTrigger().withIdentity(id+"-start", TRIGGER_GROUP_NAME).startAt(new Date())
.withSchedule(CronScheduleBuilder.cronSchedule(cron1).withMisfireHandlingInstructionDoNothing()).build();
}
......@@ -249,7 +268,13 @@ public class EquipmentController extends AbstractController {
resJobDataMap2.put("type", type);
job2 = JobBuilder.newJob(SimpleJob.class).withIdentity(id+"-end", JOB_GROUP_NAME).usingJobData(resJobDataMap2).build();
String cron2 = createCron(endTime);
String cron2 = "";
if(businessType == Constants.INT_3){
cron2 = createCron2(endTime);
}else{
cron2 = createCron(endTime);
}
trigger2 = TriggerBuilder.newTrigger().withIdentity(id+"-end", TRIGGER_GROUP_NAME).startAt(new Date())
.withSchedule(CronScheduleBuilder.cronSchedule(cron2).withMisfireHandlingInstructionDoNothing()).build();
}
......@@ -287,7 +312,22 @@ public class EquipmentController extends AbstractController {
StringBuilder sb = new StringBuilder()
.append(0).append(" ")
.append(strs[1]).append(" ")
.append(strs[0]).append(" * * ? ");
.append(strs[0]).append(" * * ?");
return sb.toString();
}
/**
* 生成cron表达
* @param time 时间
* @return cron
*/
public String createCron2(String time){
//0 */1 * * * ?
StringBuilder sb = new StringBuilder()
.append(0).append(" ")
.append("*/").append(time)
.append(" * * * ?");
// System.out.println(sb.toString());
return sb.toString();
}
......
package com.devplatform.admin.modules.eq.dao;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devplatform.admin.modules.eq.bean.SbInfoDay;
import com.devplatform.admin.modules.eq.model.SbInfoDayModel;
import com.devplatform.common.dao.MyBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* PfjInfoDay Mapper
* 用于排风机信息-天的数据库操作
* @author Administrator
*
*/
@Mapper
public interface SbInfoDayDao extends MyBaseMapper<SbInfoDay> {
/**
* 查询分页数量
* @param model
* @return
*/
Integer queryPageByCount(SbInfoDayModel model);
/**
* 查询排风机信息-天分页数据
* @param model
* @return
*/
List<SbInfoDay> queryPageList(SbInfoDayModel model);
/**
* 查询排风机信息-天分页数据
* @param page
* @param params
* @return
*/
Page<Map<String, Object>> queryPageListByParam(@Param("page") Page<Map<String, Object>> page,
@Param("params") Map<String, Object> params);
List<Map<String, Object>> queryListByParam(@Param("startTime")String startTime,@Param("endTime")String endTime);
}
package com.devplatform.admin.modules.eq.dao;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devplatform.admin.modules.eq.bean.SbInfoHour;
import com.devplatform.admin.modules.eq.model.SbInfoHourModel;
import com.devplatform.common.dao.MyBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* PfjInfoHour Mapper
* 用于排风机信息-时的数据库操作
* @author Administrator
*
*/
@Mapper
public interface SbInfoHourDao extends MyBaseMapper<SbInfoHour> {
/**
* 查询分页数量
* @param model
* @return
*/
Integer queryPageByCount(SbInfoHourModel model);
/**
* 查询排风机信息-时分页数据
* @param model
* @return
*/
List<SbInfoHour> queryPageList(SbInfoHourModel model);
Page<Map<String, Object>> queryPageListByParam(@Param("page") Page<Map<String, Object>> page,
@Param("params") Map<String, Object> params);
List<Map<String, Object>> queryListByParam(@Param("startTime")String startTime,@Param("endTime")String endTime);
}
package com.devplatform.admin.modules.eq.dao;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devplatform.admin.modules.eq.bean.SbInfoMonth;
import com.devplatform.admin.modules.eq.model.SbInfoMonthModel;
import com.devplatform.common.dao.MyBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* PfjInfoMonth Mapper
* 用于排风机信息-月的数据库操作
* @author Administrator
*
*/
@Mapper
public interface SbInfoMonthDao extends MyBaseMapper<SbInfoMonth> {
/**
* 查询分页数量
* @param model
* @return
*/
Integer queryPageByCount(SbInfoMonthModel model);
/**
* 查询排风机信息-月分页数据
* @param model
* @return
*/
List<SbInfoMonth> queryPageList(SbInfoMonthModel model);
Page<Map<String, Object>> queryPageListByParam(@Param("page") Page<Map<String, Object>> page,
@Param("params") Map<String, Object> params);
List<Map<String, Object>> queryListByParam(@Param("startTime")String startTime,@Param("endTime")String endTime);
}
package com.devplatform.admin.modules.eq.dao;
import com.devplatform.admin.modules.eq.bean.SbInfoYear;
import com.devplatform.admin.modules.eq.model.SbInfoYearModel;
import com.devplatform.common.dao.MyBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* PfjInfoYear Mapper
* 用于排风机信息-年的数据库操作
* @author Administrator
*
*/
@Mapper
public interface SbInfoYearDao extends MyBaseMapper<SbInfoYear> {
/**
* 查询分页数量
* @param model
* @return
*/
Integer queryPageByCount(SbInfoYearModel model);
/**
* 查询排风机信息-年分页数据
* @param model
* @return
*/
List<SbInfoYear> queryPageList(SbInfoYearModel model);
}
package com.devplatform.admin.modules.eq.model;
import com.devplatform.admin.common.model.BaseModel;
import lombok.Data;
/**
* 水泵信息-天的Model
* <br>
* @author 代码生成器产生
*/
@Data
public class SbInfoDayModel extends BaseModel {
/** 主键id */
private String id;
/** 资源点id */
private String resourceId;
/** 电能 */
private String electricEnergy;
/** 类型(1手动,2节能) */
private Integer type;
/** 站点表id */
private String stationId;
/** 创建时间 */
private java.util.Date createTime;
private String startTime;
private String endTime;
}
package com.devplatform.admin.modules.eq.model;
import com.devplatform.admin.common.model.BaseModel;
import lombok.Data;
/**
* 水泵信息-时的Model
* <br>
* @author 代码生成器产生
*/
@Data
public class SbInfoHourModel extends BaseModel {
/** 主键id */
private String id;
/** 资源点id */
private String resourceId;
/** 电能 */
private String electricEnergy;
/** 类型(1手动,2节能) */
private Integer type;
/** 站点表id */
private String stationId;
/** 创建时间 */
private java.util.Date createTime;
}
package com.devplatform.admin.modules.eq.model;
import com.devplatform.admin.common.model.BaseModel;
import lombok.Data;
/**
* 水泵信息-月的Model
* <br>
* @author 代码生成器产生
*/
@Data
public class SbInfoMonthModel extends BaseModel {
/** 主键id */
private String id;
/** 资源点id */
private String resourceId;
/** 电能 */
private String electricEnergy;
/** 类型(1手动,2节能) */
private Integer type;
/** 站点表id */
private String stationId;
/** 创建时间 */
private java.util.Date createTime;
}
package com.devplatform.admin.modules.eq.model;
import com.devplatform.admin.common.model.BaseModel;
import lombok.Data;
/**
* 水泵信息-年的Model
* <br>
* @author 代码生成器产生
*/
@Data
public class SbInfoYearModel extends BaseModel {
/** 主键id */
private String id;
/** 资源点id */
private String resourceId;
/** 电能 */
private String electricEnergy;
/** 类型(1手动,2节能) */
private Integer type;
/** 站点表id */
private String stationId;
/** 创建时间 */
private java.util.Date createTime;
}
package com.devplatform.admin.modules.eq.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devplatform.admin.modules.eq.bean.SbInfoDay;
import com.devplatform.admin.modules.eq.model.SbInfoDayModel;
import com.devplatform.common.service.MyBaseService;
import java.util.List;
import java.util.Map;
/**
* 排风机信息-天的service接口
* <br>
* <b>功能:</b>PfjInfoDayService<br>
* @author 代码生成器产生
*/
public interface SbInfoDayService extends MyBaseService<SbInfoDay> {
/**
* 查询排风机信息-天分页数据
* @param model
* @return
*/
List<SbInfoDay> queryPageList(SbInfoDayModel model);
/**
* 查询排风机信息-天分页数据
* @param params
* @return
*/
Page<Map<String,Object>> queryPageListByParam(Page<Map<String, Object>> page,Map<String, Object> params);
List<Map<String, Object>> queryListByParam(String startTime,String endTime);
}
package com.devplatform.admin.modules.eq.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devplatform.admin.modules.eq.bean.SbInfoHour;
import com.devplatform.admin.modules.eq.model.SbInfoHourModel;
import com.devplatform.common.service.MyBaseService;
import java.util.List;
import java.util.Map;
/**
* 排风机信息-时的service接口
* <br>
* <b>功能:</b>PfjInfoHourService<br>
* @author 代码生成器产生
*/
public interface SbInfoHourService extends MyBaseService<SbInfoHour> {
/**
* 查询排风机信息-时分页数据
* @param model
* @return
*/
List<SbInfoHour> queryPageList(SbInfoHourModel model);
Page<Map<String, Object>> queryPageListByParam(Page<Map<String, Object>> pageTask, Map<String, Object> params);
List<Map<String, Object>> queryListByParam(String startTime,String endTime);
}
package com.devplatform.admin.modules.eq.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devplatform.admin.modules.eq.bean.SbInfoMonth;
import com.devplatform.admin.modules.eq.model.SbInfoMonthModel;
import com.devplatform.common.service.MyBaseService;
import java.util.List;
import java.util.Map;
/**
* 排风机信息-月的service接口
* <br>
* <b>功能:</b>PfjInfoMonthService<br>
* @author 代码生成器产生
*/
public interface SbInfoMonthService extends MyBaseService<SbInfoMonth> {
/**
* 查询排风机信息-月分页数据
* @param model
* @return
*/
List<SbInfoMonth> queryPageList(SbInfoMonthModel model);
Page<Map<String, Object>> queryPageListByParam(Page<Map<String, Object>> pageTask, Map<String, Object> params);
List<Map<String, Object>> queryListByParam(String startTime,String endTime);
}
package com.devplatform.admin.modules.eq.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devplatform.admin.modules.eq.bean.SbInfo;
import com.devplatform.admin.modules.eq.model.SbInfoModel;
import com.devplatform.common.service.MyBaseService;
......@@ -23,4 +24,8 @@ public interface SbInfoService extends MyBaseService<SbInfo> {
List<SbInfo> queryPageList(SbInfoModel model);
List<Map<String, Object>> getList();
Page<Map<String, Object>> queryPageListByParam(Page<Map<String, Object>> pageTask, Map<String, Object> params);
List<Map<String, Object>> queryListByParam(String startTime,String endTime);
}
package com.devplatform.admin.modules.eq.service;
import com.devplatform.admin.modules.eq.bean.SbInfoYear;
import com.devplatform.admin.modules.eq.model.SbInfoYearModel;
import com.devplatform.common.service.MyBaseService;
import java.util.List;
/**
* 排风机信息-年的service接口
* <br>
* <b>功能:</b>PfjInfoYearService<br>
* @author 代码生成器产生
*/
public interface SbInfoYearService extends MyBaseService<SbInfoYear> {
/**
* 查询排风机信息-年分页数据
* @param model
* @return
*/
List<SbInfoYear> queryPageList(SbInfoYearModel model);
}
......@@ -43,6 +43,8 @@ public class AnalysisServiceImpl implements AnalysisService {
private SljfgInfoService sljfgInfoService;
@Autowired
private LiResourceService liResourceService;
@Autowired
private SbInfoService sbInfoService;
@Override
public Map<String,Object> getSyParam(){
......@@ -192,6 +194,8 @@ public class AnalysisServiceImpl implements AnalysisService {
page = flrbInfoService.queryPageListByParam(pageTask,params);
}else if(Constants.ID_SLJFG.equals(resourceType)){
}else if(Constants.ID_SB.equals(resourceType)){
page = sbInfoService.queryPageListByParam(pageTask,params);
}else if(Constants.ID_SLSWJ.equals(resourceType)){
page = dlswjInfoService.queryPageListByParam(pageTask,params);
}else if(Constants.ID_SLJFG.equals(resourceType)){
......@@ -226,6 +230,8 @@ public class AnalysisServiceImpl implements AnalysisService {
list = jfktpInfoService.queryListByParam(startTime,endTime);
}else if(Constants.ID_JLM.equals(resourceType)){
}else if(Constants.ID_SB.equals(resourceType)){
list = sbInfoService.queryListByParam(startTime,endTime);
}else if(Constants.ID_FLRBJZ.equals(resourceType)){
list = flrbInfoService.queryListByParam(startTime,endTime);
}else if(Constants.ID_SLJFG.equals(resourceType)){
......
......@@ -28,6 +28,8 @@ public class KanBanServiceImpl implements KanBanService {
private DlswjInfoService dlswjInfoService;
@Autowired
private SljfgInfoService sljfgInfoService;
@Autowired
private SbInfoService sbInfoService;
@Override
public Page<Map<String,Object>> getListByTypeAndId(Map<String, Object> params) {
......@@ -48,7 +50,7 @@ public class KanBanServiceImpl implements KanBanService {
}else if(Constants.ID_SLJFG.equals(resourceType)){
list = sljfgInfoService.queryPageListByParam(pageTask,params);
}else if(Constants.ID_SB.equals(resourceType)){
list = sbInfoService.queryPageListByParam(pageTask,params);
}else if(Constants.ID_SWQXZ.equals(resourceType)){
list = swqxzInfoHourService.queryPageListByParam(pageTask,params);
}else if(Constants.ID_DLSNJ.equals(resourceType)){
......
package com.devplatform.admin.modules.eq.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devplatform.admin.modules.eq.bean.SbInfoDay;
import com.devplatform.admin.modules.eq.dao.SbInfoDayDao;
import com.devplatform.admin.modules.eq.model.SbInfoDayModel;
import com.devplatform.admin.modules.eq.service.SbInfoDayService;
import com.devplatform.common.service.impl.MyBaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 排风机信息-天的service接口实现类
* <br>
* <b>功能:</b>PfjInfoDayServiceImpl<br>
* @author 代码生成器产生
*/
@Service("sbInfoDayService")
public class SbInfoDayServiceImpl extends MyBaseServiceImpl<SbInfoDayDao, SbInfoDay> implements SbInfoDayService {
@Override
public List<SbInfoDay> queryPageList(SbInfoDayModel model) {
Integer rowCount = baseMapper.queryPageByCount(model);
model.getPager().setRowCount(rowCount);
return baseMapper.queryPageList(model);
}
@Override
public Page<Map<String, Object>> queryPageListByParam(Page<Map<String, Object>> page, Map<String, Object> params) {
return baseMapper.queryPageListByParam(page,params);
}
@Override
public List<Map<String, Object>> queryListByParam(String startTime,String endTime) {
return baseMapper.queryListByParam(startTime,endTime);
}
}
package com.devplatform.admin.modules.eq.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devplatform.admin.modules.eq.bean.SbInfoHour;
import com.devplatform.admin.modules.eq.dao.SbInfoHourDao;
import com.devplatform.admin.modules.eq.model.SbInfoHourModel;
import com.devplatform.admin.modules.eq.service.SbInfoHourService;
import com.devplatform.common.service.impl.MyBaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 排风机信息-时的service接口实现类
* <br>
* <b>功能:</b>PfjInfoHourServiceImpl<br>
* @author 代码生成器产生
*/
@Service("sbInfoHourService")
public class SbInfoHourServiceImpl extends MyBaseServiceImpl<SbInfoHourDao, SbInfoHour> implements SbInfoHourService {
@Override
public List<SbInfoHour> queryPageList(SbInfoHourModel model) {
Integer rowCount = baseMapper.queryPageByCount(model);
model.getPager().setRowCount(rowCount);
return baseMapper.queryPageList(model);
}
@Override
public Page<Map<String, Object>> queryPageListByParam(Page<Map<String, Object>> page, Map<String, Object> params) {
return baseMapper.queryPageListByParam(page,params);
}
@Override
public List<Map<String, Object>> queryListByParam(String startTime,String endTime) {
return baseMapper.queryListByParam(startTime,endTime);
}
}
package com.devplatform.admin.modules.eq.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devplatform.admin.modules.eq.bean.SbInfoMonth;
import com.devplatform.admin.modules.eq.dao.SbInfoMonthDao;
import com.devplatform.admin.modules.eq.model.SbInfoMonthModel;
import com.devplatform.admin.modules.eq.service.SbInfoMonthService;
import com.devplatform.common.service.impl.MyBaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 排风机信息-月的service接口实现类
* <br>
* <b>功能:</b>PfjInfoMonthServiceImpl<br>
* @author 代码生成器产生
*/
@Service("sbInfoMonthService")
public class SbInfoMonthServiceImpl extends MyBaseServiceImpl<SbInfoMonthDao, SbInfoMonth> implements SbInfoMonthService {
@Override
public List<SbInfoMonth> queryPageList(SbInfoMonthModel model) {
Integer rowCount = baseMapper.queryPageByCount(model);
model.getPager().setRowCount(rowCount);
return baseMapper.queryPageList(model);
}
@Override
public Page<Map<String, Object>> queryPageListByParam(Page<Map<String, Object>> pageTask, Map<String, Object> params) {
return baseMapper.queryPageListByParam(pageTask,params);
}
@Override
public List<Map<String, Object>> queryListByParam(String startTime,String endTime) {
return baseMapper.queryListByParam(startTime,endTime);
}
}
package com.devplatform.admin.modules.eq.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devplatform.admin.common.utils.Constants;
import com.devplatform.admin.common.utils.DateUtil;
import com.devplatform.admin.modules.eq.bean.SbInfo;
import com.devplatform.admin.modules.eq.dao.SbInfoDao;
import com.devplatform.admin.modules.eq.model.SbInfoModel;
import com.devplatform.admin.modules.eq.service.SbInfoDayService;
import com.devplatform.admin.modules.eq.service.SbInfoHourService;
import com.devplatform.admin.modules.eq.service.SbInfoMonthService;
import com.devplatform.admin.modules.eq.service.SbInfoService;
import com.devplatform.common.service.impl.MyBaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -18,6 +26,12 @@ import java.util.Map;
*/
@Service("sbInfoService")
public class SbInfoServiceImpl extends MyBaseServiceImpl<SbInfoDao, SbInfo> implements SbInfoService {
@Autowired
private SbInfoHourService sbInfoHourService;
@Autowired
private SbInfoDayService sbInfoDayService;
@Autowired
private SbInfoMonthService sbInfoMonthService;
@Override
public List<SbInfo> queryPageList(SbInfoModel model) {
......@@ -30,4 +44,34 @@ public class SbInfoServiceImpl extends MyBaseServiceImpl<SbInfoDao, SbInfo> impl
public List<Map<String, Object>> getList() {
return baseMapper.getList();
}
@Override
public Page<Map<String, Object>> queryPageListByParam(Page<Map<String, Object>> pageTask, Map<String, Object> params) {
String startTime = (String) params.get("startTime");
String endTime = (String) params.get("endTime");
int type = DateUtil.checkTimeToType(startTime,endTime);
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
if(type == Constants.INT_1){
page = sbInfoHourService.queryPageListByParam(pageTask,params);
}else if(type == Constants.INT_2 || type == Constants.INT_3){
page = sbInfoDayService.queryPageListByParam(pageTask,params);
}else if(type == Constants.INT_4){
page = sbInfoMonthService.queryPageListByParam(pageTask,params);
}
return page;
}
@Override
public List<Map<String, Object>> queryListByParam(String startTime, String endTime) {
List<Map<String,Object>> list = new ArrayList<>();
int type = DateUtil.checkTimeToType(startTime,endTime);
if(type == Constants.INT_1){
list = sbInfoHourService.queryListByParam(startTime,endTime);
}else if(type == Constants.INT_2 || type == Constants.INT_3){
list = sbInfoDayService.queryListByParam(startTime,endTime);
}else if(type == Constants.INT_4){
list = sbInfoMonthService.queryListByParam(startTime,endTime);
}
return list;
}
}
package com.devplatform.admin.modules.eq.service.impl;
import com.devplatform.admin.modules.eq.bean.SbInfoYear;
import com.devplatform.admin.modules.eq.dao.SbInfoYearDao;
import com.devplatform.admin.modules.eq.model.SbInfoYearModel;
import com.devplatform.admin.modules.eq.service.SbInfoYearService;
import com.devplatform.common.service.impl.MyBaseServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 排风机信息-年的service接口实现类
* <br>
* <b>功能:</b>PfjInfoYearServiceImpl<br>
* @author 代码生成器产生
*/
@Service("sbInfoYearService")
public class SbInfoYearServiceImpl extends MyBaseServiceImpl<SbInfoYearDao, SbInfoYear> implements SbInfoYearService {
@Override
public List<SbInfoYear> queryPageList(SbInfoYearModel model) {
Integer rowCount = baseMapper.queryPageByCount(model);
model.getPager().setRowCount(rowCount);
return baseMapper.queryPageList(model);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.devplatform.admin.modules.eq.dao.SbInfoDayDao">
<!-- Result Map -->
<resultMap id="BaseResultMap" type="com.devplatform.admin.modules.eq.bean.SbInfoDay">
<result column="id" property="id"/>
<result column="resource_id" property="resourceId"/>
<result column="electric_energy" property="electricEnergy"/>
<result column="type" property="type"/>
<result column="station_id" property="stationId"/>
<result column="create_time" property="createTime"/>
</resultMap>
<!-- sb_info_day table all fields -->
<sql id="Base_Column_List">
id,resource_id,electric_energy,type,station_id,create_time
</sql>
<!-- 公共查询条件 -->
<sql id="Example_Where_Clause">
where t.deleted=0
<if test="id!=null and id!=''">and t.id = #{id}</if>
<if test="resourceId!=null and resourceId!=''">and t.resource_id = #{resourceId}</if>
<if test="electricEnergy!=null and electricEnergy!=''">and t.electric_energy = #{electricEnergy}</if>
<if test="type!=null ">and t.type = #{type}</if>
<if test="stationId!=null and stationId!=''">and t.station_id = #{stationId}</if>
<if test="createTime!=null ">and t.create_time = #{createTime}</if>
</sql>
<select id="queryPageByCount" parameterType="Object" resultType="java.lang.Integer">
select count(1) from sb_info_day t
<include refid="Example_Where_Clause"/>
</select>
<select id="queryPageList" parameterType="Object" resultMap="BaseResultMap">
select t.* from sb_info_day t
<include refid="Example_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''">
${pager.orderCondition}
</if>
<if test="pager.mysqlQueryCondition != null and pager.mysqlQueryCondition != ''">
${pager.mysqlQueryCondition}
</if>
</select>
<select id="queryPageListByParam" resultType="java.util.Map">
select t.create_time,cast(sum(cast(t.electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from sb_info_day t
where 1=1
<if test="params.resourceId!=null and params.resourceId!=''">
and t.resource_id = #{params.resourceId}
</if>
<if test="(params.startTime == null or params.startTime == '') and (params.endTime == null or params.endTime == '')">
and TO_DAYS(t.create_time) = TO_DAYS(NOW())
</if>
<if test="params.startTime != null and params.startTime != ''">
and t.create_time &gt;= #{params.startTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
and t.create_time &lt;= #{params.endTime}
</if>
group by t.create_time
<if test="params.sort != null and params.sort != '' and params.order != null and params.order != ''">
ORDER BY ${params.sort} ${params.order}
</if>
<if test="params.sort == null or params.sort == '' or params.order == null or params.order == ''">
ORDER BY t.create_time
</if>
</select>
<select id="queryListByParam" resultType="java.util.Map">
select create_time,cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy
from sb_info_day
where 1=1
<if test="(startTime == null or startTime == '') and (endTime == null or endTime == '')">
and TO_DAYS(create_time) = TO_DAYS(NOW())
</if>
<if test="startTime != null and startTime != ''">
and create_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and create_time &lt;= #{endTime}
</if>
group by create_time
order by create_time
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.devplatform.admin.modules.eq.dao.SbInfoHourDao">
<!-- Result Map -->
<resultMap id="BaseResultMap" type="com.devplatform.admin.modules.eq.bean.SbInfoHour">
<result column="id" property="id"/>
<result column="resource_id" property="resourceId"/>
<result column="electric_energy" property="electricEnergy"/>
<result column="type" property="type"/>
<result column="station_id" property="stationId"/>
<result column="create_time" property="createTime"/>
</resultMap>
<!-- sb_info_hour table all fields -->
<sql id="Base_Column_List">
id,resource_id,electric_energy,type,station_id,create_time
</sql>
<!-- 公共查询条件 -->
<sql id="Example_Where_Clause">
where t.deleted=0
<if test="id!=null and id!=''">and t.id = #{id}</if>
<if test="resourceId!=null and resourceId!=''">and t.resource_id = #{resourceId}</if>
<if test="electricEnergy!=null and electricEnergy!=''">and t.electric_energy = #{electricEnergy}</if>
<if test="type!=null ">and t.type = #{type}</if>
<if test="stationId!=null and stationId!=''">and t.station_id = #{stationId}</if>
<if test="createTime!=null ">and t.create_time = #{createTime}</if>
</sql>
<select id="queryPageByCount" parameterType="Object" resultType="java.lang.Integer">
select count(1) from sb_info_hour t
<include refid="Example_Where_Clause"/>
</select>
<select id="queryPageList" parameterType="Object" resultMap="BaseResultMap">
select t.* from sb_info_hour t
<include refid="Example_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''">
${pager.orderCondition}
</if>
<if test="pager.mysqlQueryCondition != null and pager.mysqlQueryCondition != ''">
${pager.mysqlQueryCondition}
</if>
</select>
<select id="queryPageListByParam" resultType="java.util.Map">
select t.create_time,cast(sum(cast(t.electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from sb_info_hour t
where 1=1
<if test="params.resourceId!=null and params.resourceId!=''">
and t.resource_id = #{params.resourceId}
</if>
<if test="(params.startTime == null or params.startTime == '') and (params.endTime == null or params.endTime == '')">
and TO_DAYS(t.create_time) = TO_DAYS(NOW())
</if>
<if test="params.startTime != null and params.startTime != ''">
and t.create_time &gt;= #{params.startTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
and t.create_time &lt;= #{params.endTime}
</if>
group by t.create_time
<if test="params.sort != null and params.sort != '' and params.order != null and params.order != ''">
ORDER BY ${params.sort} ${params.order}
</if>
<if test="params.sort == null or params.sort == '' or params.order == null or params.order == ''">
ORDER BY t.create_time
</if>
</select>
<select id="queryListByParam" resultType="java.util.Map">
select create_time,cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy
from sb_info_hour
where 1=1
<if test="(startTime == null or startTime == '') and (endTime == null or endTime == '')">
and TO_DAYS(create_time) = TO_DAYS(NOW())
</if>
<if test="startTime != null and startTime != ''">
and create_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and create_time &lt;= #{endTime}
</if>
group by create_time
order by create_time
</select>
</mapper>
......@@ -6,15 +6,20 @@
<result column="id" property="id"/>
<result column="resource_id" property="resourceId"/>
<result column="current_frequency" property="currentFrequency"/>
<result column="set_frequency" property="setFrequency"/>
<result column="fault_alarm" property="faultAlarm"/>
<result column="type" property="type"/>
<result column="station_id" property="stationId"/>
<result column="create_time" property="createTime"/>
<result column="create_time" property="createTime"/>
<result column="electric_energy" property="electricEnergy"/>
<result column="communication_failure" property="communicationFailure"/>
<result column="signal_feedback" property="signalFeedback"/>
</resultMap>
<!-- sb_info table all fields -->
<sql id="Base_Column_List">
id,resource_id,current_frequency,fault_alarm,type,station_id,create_time
id,resource_id,current_frequency,fault_alarm,type,station_id,create_time,set_frequency,electric_energy,communication_failure,signal_feedback
</sql>
<!-- 公共查询条件 -->
......@@ -23,10 +28,14 @@
<if test="id!=null and id!=''">and t.id = #{id}</if>
<if test="resourceId!=null and resourceId!=''">and t.resource_id = #{resourceId}</if>
<if test="currentFrequency!=null and currentFrequency!=''">and t.current_frequency = #{currentFrequency}</if>
<if test="setFrequency!=null and setFrequency!=''">and t.set_frequency = #{setFrequency}</if>
<if test="faultAlarm!=null and faultAlarm!=''">and t.fault_alarm = #{faultAlarm}</if>
<if test="type!=null ">and t.type = #{type}</if>
<if test="stationId!=null and stationId!=''">and t.station_id = #{stationId}</if>
<if test="createTime!=null ">and t.create_time = #{createTime}</if>
<if test="electricEnergy!=null and electricEnergy!=''">and t.electric_energy = #{electricEnergy}</if>
<if test="communicationFailure!=null and communicationFailure!=''">and t.communication_failure = #{communicationFailure}</if>
<if test="signalFeedback!=null and signalFeedback!=''">and t.signal_feedback = #{signalFeedback}</if>
</sql>
<select id="queryPageByCount" parameterType="Object" resultType="java.lang.Integer">
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.devplatform.admin.modules.eq.dao.SbInfoMonthDao">
<!-- Result Map -->
<resultMap id="BaseResultMap" type="com.devplatform.admin.modules.eq.bean.SbInfoMonth">
<result column="id" property="id"/>
<result column="resource_id" property="resourceId"/>
<result column="electric_energy" property="electricEnergy"/>
<result column="type" property="type"/>
<result column="station_id" property="stationId"/>
<result column="create_time" property="createTime"/>
</resultMap>
<!-- sb_info_month table all fields -->
<sql id="Base_Column_List">
id,resource_id,electric_energy,type,station_id,create_time
</sql>
<!-- 公共查询条件 -->
<sql id="Example_Where_Clause">
where t.deleted=0
<if test="id!=null and id!=''">and t.id = #{id}</if>
<if test="resourceId!=null and resourceId!=''">and t.resource_id = #{resourceId}</if>
<if test="electricEnergy!=null and electricEnergy!=''">and t.electric_energy = #{electricEnergy}</if>
<if test="type!=null ">and t.type = #{type}</if>
<if test="stationId!=null and stationId!=''">and t.station_id = #{stationId}</if>
<if test="createTime!=null ">and t.create_time = #{createTime}</if>
</sql>
<select id="queryPageByCount" parameterType="Object" resultType="java.lang.Integer">
select count(1) from sb_info_month t
<include refid="Example_Where_Clause"/>
</select>
<select id="queryPageList" parameterType="Object" resultMap="BaseResultMap">
select t.* from sb_info_month t
<include refid="Example_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''">
${pager.orderCondition}
</if>
<if test="pager.mysqlQueryCondition != null and pager.mysqlQueryCondition != ''">
${pager.mysqlQueryCondition}
</if>
</select>
<select id="queryPageListByParam" resultType="java.util.Map">
select t.create_time,cast(sum(cast(t.electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy from sb_info_month t
where 1=1
<if test="params.resourceId!=null and params.resourceId!=''">
and t.resource_id = #{params.resourceId}
</if>
<if test="(params.startTime == null or params.startTime == '') and (params.endTime == null or params.endTime == '')">
and TO_DAYS(t.create_time) = TO_DAYS(NOW())
</if>
<if test="params.startTime != null and params.startTime != ''">
and t.create_time &gt;= #{params.startTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
and t.create_time &lt;= #{params.endTime}
</if>
group by t.create_time
<if test="params.sort != null and params.sort != '' and params.order != null and params.order != ''">
ORDER BY ${params.sort} ${params.order}
</if>
<if test="params.sort == null or params.sort == '' or params.order == null or params.order == ''">
ORDER BY t.create_time
</if>
</select>
<select id="queryListByParam" resultType="java.util.Map">
select create_time,cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy
from sb_info_month
where 1=1
<if test="(startTime == null or startTime == '') and (endTime == null or endTime == '')">
and TO_DAYS(create_time) = TO_DAYS(NOW())
</if>
<if test="startTime != null and startTime != ''">
and create_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and create_time &lt;= #{endTime}
</if>
group by create_time
order by create_time
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.devplatform.admin.modules.eq.dao.SbInfoYearDao">
<!-- Result Map -->
<resultMap id="BaseResultMap" type="com.devplatform.admin.modules.eq.bean.SbInfoYear">
<result column="id" property="id"/>
<result column="resource_id" property="resourceId"/>
<result column="electric_energy" property="electricEnergy"/>
<result column="type" property="type"/>
<result column="station_id" property="stationId"/>
<result column="create_time" property="createTime"/>
</resultMap>
<!-- sb_info_year table all fields -->
<sql id="Base_Column_List">
id,resource_id,electric_energy,type,station_id,create_time
</sql>
<!-- 公共查询条件 -->
<sql id="Example_Where_Clause">
where t.deleted=0
<if test="id!=null and id!=''">and t.id = #{id}</if>
<if test="resourceId!=null and resourceId!=''">and t.resource_id = #{resourceId}</if>
<if test="electricEnergy!=null and electricEnergy!=''">and t.electric_energy = #{electricEnergy}</if>
<if test="type!=null ">and t.type = #{type}</if>
<if test="stationId!=null and stationId!=''">and t.station_id = #{stationId}</if>
<if test="createTime!=null ">and t.create_time = #{createTime}</if>
</sql>
<select id="queryPageByCount" parameterType="Object" resultType="java.lang.Integer">
select count(1) from sb_info_year t
<include refid="Example_Where_Clause"/>
</select>
<select id="queryPageList" parameterType="Object" resultMap="BaseResultMap">
select t.* from sb_info_year t
<include refid="Example_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''">
${pager.orderCondition}
</if>
<if test="pager.mysqlQueryCondition != null and pager.mysqlQueryCondition != ''">
${pager.mysqlQueryCondition}
</if>
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment