水资源调度-统计分析

master
yangzhe123 2025-09-01 14:47:45 +08:00
parent 8036453c27
commit 91d34a227f
3 changed files with 42 additions and 0 deletions

View File

@ -3,6 +3,9 @@ package com.gunshi.project.hsz.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gunshi.project.hsz.model.StWaterRReorganize; import com.gunshi.project.hsz.model.StWaterRReorganize;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* : * :
@ -12,4 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface StWaterRReorganizeMapper extends BaseMapper<StWaterRReorganize> { public interface StWaterRReorganizeMapper extends BaseMapper<StWaterRReorganize> {
List<StWaterRReorganize> getWaterSupplyerYeaarOrMonth(@Param("type") Integer type,@Param("date") String date);
} }

View File

@ -12,7 +12,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* : * :
@ -298,6 +300,28 @@ public class StWaterRReorganizeService extends ServiceImpl<StWaterRReorganizeMap
return arrow.concat(value.abs().toString()).concat("%"); return arrow.concat(value.abs().toString()).concat("%");
} }
} }
public Map<String, BigDecimal> getWaterSupplyerYeaarOrMonth(Integer type,String date) {
Map<String, BigDecimal> res = new HashMap<>();
BigDecimal ggTotal = BigDecimal.ZERO;
BigDecimal stTotal = BigDecimal.ZERO;
List<StWaterRReorganize> rReorganizes;
if(type == 0){
rReorganizes = baseMapper.getWaterSupplyerYeaarOrMonth(type,date);
}else{
rReorganizes = baseMapper.getWaterSupplyerYeaarOrMonth(type,date);
}
if(rReorganizes.size() > 0){
for (StWaterRReorganize o : rReorganizes) {
ggTotal = ggTotal.add(o.getMci1V()).add(o.getMci2V());
stTotal = stTotal.add(o.getEcologyV());
}
}
res.put("gg",ggTotal);
res.put("st",stTotal);
return res;
}
} }

View File

@ -2,4 +2,16 @@
<!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.gunshi.project.hsz.mapper.StWaterRReorganizeMapper"> <mapper namespace="com.gunshi.project.hsz.mapper.StWaterRReorganizeMapper">
<select id="getWaterSupplyerYeaarOrMonth" resultType="com.gunshi.project.hsz.model.StWaterRReorganize">
select *
from st_water_r_reorganize t
WHERE 1=1
<if test="type == 0">
AND SUBSTRING(t.tm FROM 1 FOR 7) = #{date}
</if>
<if test="type == 1">
AND SUBSTRING(t.tm FROM 1 FOR 4) = #{date}
</if>
</select>
</mapper> </mapper>