b4b75dce 张雷

禅道BUG修改

1 个父辈 6256fe9c
......@@ -99,9 +99,14 @@ public interface FCustomReportDatasetMapper extends BaseMapper<FCustomReportData
* @return
*/
Map<String, Object> getWeekReport(@Param(value="dataTime") String dataTime, @Param(value="departId") String departId,
@Param(value="week") String week,@Param(value="startDate") String startDate,@Param(value="endDate") String endDate);
List<DepartWeekReportVO> getWeekReportData(@Param(value="startDate") String startDate, @Param(value="endDate") String endDate);
@Param(value="week") String week,@Param(value="startDate") String startDate,@Param(value="endDate") String endDate,
@Param(value="dataViewName3a24") String dataViewName3a24,
@Param(value="dataViewName2119") String dataViewName2119,
@Param(value="dataViewName9bff") String dataViewName9bff);
List<DepartWeekReportVO> getWeekReportData(@Param(value="startDate") String startDate, @Param(value="endDate") String endDate,
@Param(value="dataViewName3a24") String dataViewName3a24,
@Param(value="dataViewName2119") String dataViewName2119);
List<JnhbReportData> getJnhbReport(@Param(value="dataViewName2") String dataViewName2, @Param(value="dataViewName3") String dataViewName3,
@Param(value="start") String start, @Param(value="end") String end, @Param(value="departIds") String departIds);
......
......@@ -208,23 +208,28 @@
sys_depart d
LEFT JOIN (SELECT * FROM view_30a8 WHERE depart_id = #{departId} AND time = #{dataTime} AND zs = #{week}) v3 on v3.depart_id = d.id
LEFT JOIN (SELECT
ROUND(AVG(JSCOD),2) JSCOD,ROUND(AVG(JSAD),2) JSAD,ROUND(AVG(JSPH),2) JSPH,ROUND(AVG(JSZD),2) JSZD,ROUND(AVG(JSZL),2) JSZL,ROUND(AVG(JSSS),2) JSSS,
ROUND(AVG(CSCOD),2) CSCOD,ROUND(AVG(CSAD),2) CSAD,ROUND(AVG(CSPH),2) CSPH,ROUND(AVG(CSTN),2) CSTN,ROUND(AVG(CSZL),2) CSZL,ROUND(AVG(CSSS),2) CSSS,
depart_id
FROM view_9bff
WHERE depart_id = #{departId} AND time &gt;= #{startDate} AND time &lt;= #{endDate} ) v9 on v9.depart_id = d.id
ROUND(AVG(v.JSCOD),2) JSCOD,ROUND(AVG(v.JSAD),2) JSAD,ROUND(AVG(v.JSPH),2) JSPH,
ROUND(AVG(v.JSZD),2) JSZD,ROUND(AVG(v.JSZL),2) JSZL,ROUND(AVG(v.JSSS),2) JSSS,
ROUND(AVG(v.CSCOD),2) CSCOD,ROUND(AVG(v.CSAD),2) CSAD,ROUND(AVG(v.CSPH),2) CSPH,
ROUND(AVG(v.CSTN),2) CSTN,ROUND(AVG(v.CSZL),2) CSZL,ROUND(AVG(v.CSSS),2) CSSS,
v.depart_id
FROM ${dataViewName9bff} v
WHERE v.depart_id = #{departId} AND v.time &gt;= #{startDate} AND v.time &lt;= #{endDate} ) v9 on v9.depart_id = d.id
LEFT JOIN (SELECT
SUM(DLHJ) dlhj,(SUM( PAMRJ ) + SUM( SCLPAMZ ) + SUM( SCLPAMF ) + SUM( NACLO ) + SUM( PACGT ) + SUM( PACYT ) + SUM( PFS ) + SUM( FHTY ) +
SUM( RYXNJ ) + SUM( YWL ) + SUM( GXCLJ ) + SUM( CH3COONA ) + SUM( HXT ) + SUM( FECL3 ) + SUM( SH ) + SUM( CH3COOH ) + SUM( FESO4G ) +
SUM( FESO4Y ) + SUM( H2O2 )) yjhl,SUM(WNL) wnl,depart_id
FROM view_3a24
WHERE depart_id = #{departId} AND time &gt;= #{startDate} AND time &lt;= #{endDate} ) v8 on v8.depart_id = d.id
SUM(IFNULL(v.DLHJ,0)) dlhj,(SUM( IFNULL(v.PAMRJ,0) ) + SUM( IFNULL(v.SCLPAMZ,0) ) +
SUM( IFNULL(v.SCLPAMF,0) ) + SUM( IFNULL(v.NACLO,0) ) + SUM( IFNULL(v.PACGT,0) ) +
SUM( IFNULL(v.PACYT,0) ) + SUM( IFNULL(v.PFS,0) ) + SUM( IFNULL(v.FHTY,0) ) +SUM( IFNULL(v.RYXNJ,0) ) +
SUM( IFNULL(v.YWL,0) ) + SUM( IFNULL(v.GXCLJ,0) ) + SUM( IFNULL(v.CH3COONA,0) ) + SUM( IFNULL(v.HXT,0) ) +
SUM( IFNULL(v.FECL3,0) ) + SUM( IFNULL(v.SH,0) ) + SUM( IFNULL(v.CH3COOH,0) ) + SUM( IFNULL(v.FESO4G,0) ) +
SUM( IFNULL(v.FESO4Y,0) ) + SUM( IFNULL(v.H2O2,0) )) yjhl,SUM(IFNULL(v.WNL,0)) wnl,v.depart_id
FROM ${dataViewName3a24} v
WHERE v.depart_id = #{departId} AND v.time &gt;= #{startDate} AND v.time &lt;= #{endDate} ) v8 on v8.depart_id = d.id
LEFT JOIN (SELECT
SUM(CSL) zclsl,
ROUND(AVG(CSL),2) rjclsl,
depart_id
FROM view_2119
WHERE depart_id = #{departId} AND time &gt;= #{startDate} AND time &lt;= #{endDate} ) v2 on v2.depart_id = d.id
SUM(v.CSL) zclsl,
ROUND(AVG(v.CSL),2) rjclsl,
v.depart_id
FROM ${dataViewName2119} v
WHERE v.depart_id = #{departId} AND v.time &gt;= #{startDate} AND v.time &lt;= #{endDate} ) v2 on v2.depart_id = d.id
LEFT JOIN sys_factory_info f on f.depart_id = d.id
LEFT JOIN report_target_config t on t.depart_id = d.id
WHERE
......@@ -242,12 +247,12 @@
FROM
sys_depart d
left join sys_factory_info f on f.depart_id = d.id
left join (select depart_id,ROUND(SUM(WNL),2) wnl,ROUND(SUM(DLHJ),2) hdl
from view_3a24
where time &gt;= #{startDate} AND time &lt;= #{endDate} GROUP BY depart_id) v3 on v3.depart_id = d.id
left join (select depart_id, ROUND(AVG(CSL)/10000,2) AS rjclsl, ROUND(SUM(CSL),2) AS zclsl
from view_2119
where time &gt;= #{startDate} AND time &lt;= #{endDate} GROUP BY depart_id) v2 on v2.depart_id = d.id
left join (select v.depart_id,ROUND(SUM(v.WNL),2) wnl,ROUND(SUM(v.DLHJ),2) hdl
from ${dataViewName3a24} v
where v.time &gt;= #{startDate} AND v.time &lt;= #{endDate} GROUP BY v.depart_id) v3 on v3.depart_id = d.id
left join (select v.depart_id, ROUND(AVG(v.CSL)/10000,2) AS rjclsl, ROUND(SUM(v.CSL),2) AS zclsl
from ${dataViewName2119} v
where v.time &gt;= #{startDate} AND v.time &lt;= #{endDate} GROUP BY v.depart_id) v2 on v2.depart_id = d.id
WHERE
d.depart_type = 1
ORDER BY
......
......@@ -24,6 +24,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
*/
@Service
public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDatasetMapper, FCustomReportDataset> implements IFCustomReportDatasetService {
private static String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
private static String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
private static String view9bff = "9bffaf9187093d6e6a4390e8c56acca8";
private static String view4411 = "4411ed3d78634bcdcd700f6e33724025";
@Autowired
private FCustomReportDatasetMapper mapper;
/* (non-Javadoc)
......@@ -68,9 +73,6 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
public List<Map<String, Object>> getDataFromHY(String dataTime, String departId) {
List<Map<String, Object>> valueMapList = new ArrayList<>();
String tbYear = String.valueOf(Integer.parseInt(dataTime) - 1);
String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
String view4411 = "4411ed3d78634bcdcd700f6e33724025";
String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departId, dataTime);
String dataViewName2119tb = ReportViewUtil.buildViewLike(view2119,"CSL", departId, tbYear);
......@@ -158,45 +160,19 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
return valueMapList;
}
/*public List<Map<String, Object>> getDataFromHY(String year, String departId,String startTime,String endTime) {
List<Map<String, Object>> valueMapList = new ArrayList<>();
String tbYear = String.valueOf(Integer.parseInt(year) - 1);
String tbStartTime = startTime.replaceAll( year , tbYear ) ;//去年开始时间
String tbEndTime = endTime.replaceAll( year , tbYear ) ;//去年结束时间
String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1";
String view3a24 = "3a243d5715b9e1a3753c180872ca0df9";
String view4411 = "4411ed3d78634bcdcd700f6e33724025";
String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departId, startTime,endTime);
String dataViewName2119tb = ReportViewUtil.buildViewLike(view2119,"CSL", departId, tbStartTime,tbEndTime);
String field3a24 = "DLHJ,PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ," +
"YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2";
String dataViewName3a24 = ReportViewUtil.buildViewLike(view3a24,field3a24, departId, dataTime);
String dataViewName3a24tb = ReportViewUtil.buildViewLike(view3a24,field3a24, departId, tbYear);
String field4411 = "yslwcbl,ysjsldyqntqyy,qntqsfsl,ysfsl,sfsldbbhl,sldyyqyy,dhgyqntqyy,yyf,yhgyqntqyy,dhcmbzyy,yhcyqyy";
String dataViewName4411 = ReportViewUtil.buildViewLike(view4411,field4411, departId, dataTime);
String dataViewName4411tb = ReportViewUtil.buildViewLike(view4411,"qntqsfsl", departId, tbYear);
//主库数据源
JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
valueMapList = masterDB.queryForList(sql);
if(valueMapList==null){
valueMapList = new ArrayList<>();
}
return valueMapList;
}*/
@Override
public Map<String, Object> getWeekReport(String dataTime, String departId, String week) {
Map<String, Object> valueMap = new HashMap<>();
Map<String,String> weekMap = getWeekDate(dataTime,week);
String startDate = weekMap.get("start");
String endDate = weekMap.get("end");
valueMap = mapper.getWeekReport(dataTime, departId, week, startDate, endDate);
String field3a24 = "DLHJ,PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ," +
"YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2,WNL";
String dataViewName3a24 = ReportViewUtil.buildView(view3a24, field3a24, "", startDate, endDate);
String dataViewName2119 = ReportViewUtil.buildView(view2119,"CSL", "", startDate, endDate);
String field9bff = "JSCOD,JSAD,JSPH,JSZD,JSZL,JSSS,CSCOD,CSAD,CSPH,CSTN,CSZL,CSSS";
String dataViewName9bff = ReportViewUtil.buildView(view9bff, field9bff, "", startDate, endDate);
valueMap = mapper.getWeekReport(dataTime, departId, week, startDate, endDate, dataViewName3a24, dataViewName2119, dataViewName9bff);
if(valueMap==null){
valueMap = new HashMap<>();
valueMap.put("depart_id", departId);
......@@ -226,10 +202,6 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
// 计算目标周的开始和结束日期
LocalDate startOfWeek = firstMondayOfMonth.plusWeeks(weekOfMonth - 1).plusDays(1);
LocalDate endOfWeek = startOfWeek.plusDays(6);
// 如果结束日期超出本月,调整结束日期
if (endOfWeek.getMonth() != firstOfMonth.getMonth()) {
endOfWeek = firstOfMonth.withDayOfMonth(firstOfMonth.lengthOfMonth());
}
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
map.put("start", startOfWeek.format(dateFormatter));
map.put("end", endOfWeek.format(dateFormatter));
......@@ -245,8 +217,8 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
String start = month.substring(0,4)+"-01-31";
String end = month + "-31";
String departIds = mapper.getChildDepartId(departId);
String dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", departIds, start, end);
String dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", departIds, start, end);
String dataViewName2 = ReportViewUtil.buildView(view2119,"CSL", departIds, start, end);
String dataViewName3 = ReportViewUtil.buildView(view3a24,"DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", departIds, start, end);
List<JnhbReportData> list = mapper.getJnhbReport(dataViewName2, dataViewName3, start, end, departIds);
return list;
}
......@@ -258,8 +230,8 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
List<JnhbReportDetailsJs> jsList = new ArrayList<>();
List<JnhbReportDetailsHj> hjList = new ArrayList<>();
String year = month.substring(0,4);
String dataViewName2 = ReportViewUtil.buildViewLike("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", departId, year);
String dataViewName3 = ReportViewUtil.buildViewLike("3a243d5715b9e1a3753c180872ca0df9","", departId, year);
String dataViewName2 = ReportViewUtil.buildViewLike(view2119,"CSL", departId, year);
String dataViewName3 = ReportViewUtil.buildViewLike(view3a24,"", departId, year);
dyList = mapper.getDyList(dataViewName2, dataViewName3, departId, year);
jsList = mapper.getJsList(dataViewName2, dataViewName3, departId, year);
hjList = mapper.getHjList(dataViewName2, dataViewName3, departId, year);
......@@ -274,21 +246,21 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
long startTime = System.nanoTime();
JnhbLargeScreenVO largeScreenVO = new JnhbLargeScreenVO();
//当月数据
String dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime());
String dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime());
String dataViewName2 = ReportViewUtil.buildView(view2119,"CSL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime());
String dataViewName3 = ReportViewUtil.buildView(view3a24,"DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getNowStartTime(), dataVO.getNowEndTime());
List<JnhbReportData> jnhbReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getNowStartTime(), dataVO.getNowEndTime(), null);
//System.out.println("1111---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
// 上月数据 同比
dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime());
dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime());
dataViewName2 = ReportViewUtil.buildView(view2119,"CSL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime());
dataViewName3 = ReportViewUtil.buildView(view3a24,"DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime());
List<JnhbReportData> lastMonthReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getLastMonthStartTime(), dataVO.getLastMonthEndTime(), null);
//System.out.println("2222---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
Map<String,JnhbReportData> lastMonthMapData= convertJnhbReportDataMap(lastMonthReportDataList);
// 去年数据 环比
dataViewName2 = ReportViewUtil.buildView("2119ecbf53a1d2d0708258ff67cfd9e1","CSL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime());
dataViewName3 = ReportViewUtil.buildView("3a243d5715b9e1a3753c180872ca0df9","DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime());
dataViewName2 = ReportViewUtil.buildView(view2119,"CSL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime());
dataViewName3 = ReportViewUtil.buildView(view3a24,"DLHJ,GFFDL,QY,YSL,WNL,WNHSL,GFCZL,WFCSL,WFCZL", null, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime());
List<JnhbReportData> lastYearReportDataList = mapper.getJnhbReport(dataViewName2, dataViewName3, dataVO.getLastYearStartTime(), dataVO.getLastYearEndTime(), null);
Map<String,JnhbReportData> lastYearMapData= convertJnhbReportDataMap(lastYearReportDataList);
......@@ -406,33 +378,6 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
int count2 = masterDB.queryForObject("select count(1) from equipment_info where energy_level = 2",Integer.class);
largeScreenVO.setEquipmentL2( count2 );
//System.out.println("666666---**************执行时间:"+ (System.nanoTime() - startTime) / 1_000_000.0 + " milliseconds");
// 各站点系统负荷率排名:负荷率排序、设置排名
/* if(largeScreenVO.getLoadRateVOList() != null && !largeScreenVO.getLoadRateVOList().isEmpty()){
// 根据分数排序
Collections.sort(largeScreenVO.getLoadRateVOList(), new Comparator<LoadRateVO>() {
public int compare(LoadRateVO s1, LoadRateVO s2) {
return Double.compare(ConvertUtils.getDouble(s1.getWsfhl(),0d), ConvertUtils.getDouble(s1.getWsfhl(),0d)); // 降序排序
}
});
*//*int rank = 1; // 设置排名
for( LoadRateVO loadRateVORank: largeScreenVO.getLoadRateVOList()){
loadRateVORank.setRank( rank++);
}*//*
}*/
//各站点能源消耗排名 吨水电耗
/*if(largeScreenVO.getPowerConsumeVOList() != null && !largeScreenVO.getPowerConsumeVOList().isEmpty()) {
// 根据分数排序
Collections.sort(largeScreenVO.getPowerConsumeVOList(), new Comparator<PowerConsumeVO>() {
public int compare(PowerConsumeVO s1, PowerConsumeVO s2) {
return Double.compare(ConvertUtils.getDouble(s1.getDh(), 0d), ConvertUtils.getDouble(s1.getDh(), 0d)); // 降序排序
}
});
*//*int rank = 1; // 设置排名
for( LoadRateVO loadRateVORank: largeScreenVO.getLoadRateVOList()){
loadRateVORank.setRank( rank++);
}*//*
}*/
return largeScreenVO;
}
/**转换为Map<部门编号,JnhbReportData> */
......@@ -452,7 +397,13 @@ public class FCustomReportDatasetServiceImpl extends ServiceImpl<FCustomReportDa
Map<String,String> weekMap = getWeekDate(dataTime,week);
String startDate = weekMap.get("start");
String endDate = weekMap.get("end");
list = mapper.getWeekReportData(startDate, endDate);
String field3a24 = "DLHJ,PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,PFS,FHTY,RYXNJ," +
"YWL,GXCLJ,CH3COONA,HXT,FECL3,SH,CH3COOH,FESO4G,FESO4Y,H2O2,WNL";
String dataViewName3a24 = ReportViewUtil.buildView(view3a24, field3a24, "", startDate, endDate);
String dataViewName2119 = ReportViewUtil.buildView(view2119,"CSL", "", startDate, endDate);
String field9bff = "JSCOD,JSAD,JSPH,JSZD,JSZL,JSSS,CSCOD,CSAD,CSPH,CSTN,CSZL,CSSS";
String dataViewName9bff = ReportViewUtil.buildView(view9bff, field9bff, "", startDate, endDate);
list = mapper.getWeekReportData(startDate, endDate, dataViewName3a24, dataViewName2119);
map.put("start", startDate);//开始时间
map.put("end", endDate);//结束时间
map.put("zclsl", "776");//处理水量合计
......
......@@ -70,15 +70,8 @@ public class ReportElectricCostController {
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<ReportElectricCost>> result = new Result<IPage<ReportElectricCost>>();
QueryWrapper<ReportElectricCost> queryWrapper = QueryGenerator.initQueryWrapper(reportElectricCost, req.getParameterMap());
if(reportElectricCost.getDepartId()!=null){
queryWrapper.eq("depart_id",reportElectricCost.getDepartId());
}
if(reportElectricCost.getMonth()!=null){
queryWrapper.like("month",reportElectricCost.getMonth());
}
Page<ReportElectricCost> page = new Page<ReportElectricCost>(pageNo, pageSize);
IPage<ReportElectricCost> pageList = reportElectricCostService.page(page, queryWrapper);
IPage<ReportElectricCost> pageList = reportElectricCostService.getPage(page, reportElectricCost);
result.setSuccess(true);
result.setResult(pageList);
return result;
......
......@@ -2,6 +2,7 @@ package com.skua.modules.report.mapper;
import java.util.List;
import com.skua.tool.annotation.Anonymous;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.report.entity.ReportElectricCost;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
......@@ -11,4 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface ReportElectricCostMapper extends BaseMapper<ReportElectricCost> {
@Anonymous
List<ReportElectricCost> getPage(@Param("reportElectricCost") ReportElectricCost reportElectricCost);
}
......
......@@ -2,4 +2,14 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.skua.modules.report.mapper.ReportElectricCostMapper">
</mapper>
\ No newline at end of file
<select id="getPage" resultType="com.skua.modules.report.entity.ReportElectricCost" parameterType="com.skua.modules.report.entity.ReportElectricCost">
select * from report_electric_cost where 1=1
<if test="reportElectricCost.departId!=null and reportElectricCost.departId!=''">
AND depart_id = #{reportElectricCost.departId}
</if>
<if test="reportElectricCost.month!=null and reportElectricCost.month!=''">
AND month like CONCAT(#{reportElectricCost.month},'%')
</if>
</select>
</mapper>
......
package com.skua.modules.report.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.report.entity.ReportElectricCost;
import com.baomidou.mybatisplus.extension.service.IService;
......@@ -8,4 +11,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IReportElectricCostService extends IService<ReportElectricCost> {
IPage<ReportElectricCost> getPage(Page<ReportElectricCost> page, ReportElectricCost reportElectricCost);
}
......
package com.skua.modules.report.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.modules.report.entity.ReportElectricCost;
import com.skua.modules.report.mapper.ReportElectricCostMapper;
import com.skua.modules.report.service.IReportElectricCostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.ArrayList;
import java.util.List;
/**
* 月度电费报表
*/
@Service
public class ReportElectricCostServiceImpl extends ServiceImpl<ReportElectricCostMapper, ReportElectricCost> implements IReportElectricCostService {
@Autowired
private ReportElectricCostMapper reportElectricCostMapper;
@Override
public IPage<ReportElectricCost> getPage(Page<ReportElectricCost> page, ReportElectricCost reportElectricCost) {
// if(reportElectricCost.getDepartId()!=null){
// queryWrapper.eq("depart_id",reportElectricCost.getDepartId());
// }
// if(reportElectricCost.getMonth()!=null){
// queryWrapper.like("month",reportElectricCost.getMonth());
// }
List<ReportElectricCost> list = new ArrayList<>();
list = reportElectricCostMapper.getPage(reportElectricCost);
page.setRecords(list);
return page;
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!