Commit a9da08ca authored by wujiang's avatar wujiang

添加逆变器告警接口

parent ca7fe384
package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterWarnDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpInverterWarn;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -16,6 +17,8 @@ import java.util.Map;
*/
public interface TdHygfJpInverterWarnMapper extends BaseMapper<TdHygfJpInverterWarn> {
List<Map<String,Object>> getCountTdHygfJpInverterWarn(@Param("dto") List<JpStation> dto);
List<Map<String, Object>> getCountTdHygfJpInverterWarn(@Param("dto") List<JpStation> dto);
List<TdHygfJpInverterWarnDto> list(@Param("param") TdHygfJpInverterWarnDto tdHygfJpInverterWarnDto);
}
<?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.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpInverterWarnMapper">
<select id="getCountTdHygfJpInverterWarn" resultType="map">
SELECT `state`,count(`state`) num
FROM house_pv_data.td_hygf_jp_inverter_warn
<where>
......@@ -16,8 +13,13 @@
</if>
</where>
GROUP BY `state`
</select>
<select id="list" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterWarnDto">
SELECT * FROM house_pv_data.td_hygf_jp_inverter_warn
<where>
<if test="param.state!=null">
`state` = #{param.state}
</if>
</where>
</select>
</mapper>
......@@ -11,6 +11,9 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterWarnDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpCollector;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpInverterWarn;
......@@ -30,24 +33,19 @@ public class TdHygfJpInverterWarnServiceImpl
/**
* 分页查询
*/
public Page<TdHygfJpInverterWarnDto> queryForTdHygfJpInverterWarnPage(Page<TdHygfJpInverterWarnDto> page,
public Page<TdHygfJpInverterWarnDto> queryForTdHygfJpInverterWarnPage(Page<TdHygfJpInverterWarnDto> pageParam,
TdHygfJpInverterWarnDto tdHygfJpInverterWarnDto) {
Page<TdHygfJpInverterWarn> entiryPage = new Page<>(page.getCurrent(), page.getSize());
LambdaQueryWrapper<TdHygfJpInverterWarn> wrapper = new LambdaQueryWrapper<>();
if (tdHygfJpInverterWarnDto.getState() != null) {
wrapper.eq(TdHygfJpInverterWarn::getState, tdHygfJpInverterWarnDto.getState());
}
entiryPage = (Page<TdHygfJpInverterWarn>) this.page(entiryPage, wrapper);
if (!ValidationUtil.isEmpty(entiryPage.getRecords())) {
page.setTotal(entiryPage.getTotal());
page.setPages(entiryPage.getPages());
page.setCurrent(entiryPage.getCurrent());
page.setSize(entiryPage.getSize());
if (!ValidationUtil.isEmpty(entiryPage.getRecords()))
page.setRecords(Bean.toModels(entiryPage.getRecords(), this.getModelClass()));
}
return page;
int pageNum = (int) pageParam.getCurrent();
int pageSize = (int) pageParam.getSize();
PageHelper.startPage(pageNum, pageSize);
List<TdHygfJpInverterWarnDto> list = this.baseMapper.list(tdHygfJpInverterWarnDto);
PageInfo<TdHygfJpInverterWarnDto> page = new PageInfo(list);
com.baomidou.mybatisplus.extension.plugins.pagination.Page<TdHygfJpInverterWarnDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<TdHygfJpInverterWarnDto>();
pagenew.setCurrent(pageNum);
pagenew.setTotal(page.getTotal());
pagenew.setSize(pageSize);
pagenew.setRecords(page.getList());
return pagenew;
}
/**
......
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