Commit a9da08ca authored by wujiang's avatar wujiang

添加逆变器告警接口

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