Commit 00ab32e6 by 袁伟铭

Merge remote-tracking branch 'origin/master'

parents 041da083 b33bd380
package com.zq.common.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "v_shjz_total")
public class VShjzStats {
/**
* ID
*/
@TableId
@ApiModelProperty("ID")
private Long id;
/**
* 区划ID
*/
@ApiModelProperty("区划ID")
private Long unitId;
/**
* 年份
*/
@ApiModelProperty("年份")
private String year;
/**
* 救助类型
*/
@ApiModelProperty("救助类型")
private String helpType;
/**
* 低保总数
*/
@ApiModelProperty("低保总数")
private String total;
/**
* createTime
*/
private Date createTime;
}
......@@ -2,6 +2,7 @@ package com.zq.portal.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.common.entity.VShjzAchieve;
import com.zq.common.entity.VShjzStats;
import com.zq.portal.vo.StatsVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -16,7 +17,7 @@ import java.util.Map;
* @since 2021-06-26 10:28:36
*/
@Repository
public interface VShjzAchieveDao extends BaseMapper<VShjzAchieve> {
public interface VShjzAchieveDao extends BaseMapper<VShjzStats> {
List<Map<String, Object>> getFivesYearStats(@Param("date") String date);
......
package com.zq.portal.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.zq.common.constant.DBName;
import com.zq.portal.vo.StatsReqVo;
import com.zq.portal.vo.StatsVo;
import org.springframework.stereotype.Repository;
import java.util.List;
@DS(DBName.MASTER)
@Repository
public interface VShjzStatsDao{
List<StatsVo> getPeopleNumStats(StatsReqVo vo);
}
......@@ -82,9 +82,9 @@ public class ShjzStatsService {
BigDecimal villageToatlAmount = BigDecimal.ZERO;
BigDecimal cityToatlAmount = BigDecimal.ZERO;
for (Map<String, Object> fivesYearStat : fivesYearStats) {
if ("城市低保".equals(fivesYearStat.get("iscity").toString())) {
if ("城市低保".equals(fivesYearStat.get("helpType").toString())) {
cityToatlAmount = getFivesYearTotalNum(cityToatlAmount, fivesYearStat);
} else if ("农村低保".equals(fivesYearStat.get("iscity").toString())) {
} else if ("农村低保".equals(fivesYearStat.get("helpType").toString())) {
villageToatlAmount = getFivesYearTotalNum(villageToatlAmount, fivesYearStat);
}
}
......@@ -150,9 +150,9 @@ public class ShjzStatsService {
BigDecimal villageToatlAmount = BigDecimal.ZERO;
BigDecimal cityToatlAmount = BigDecimal.ZERO;
for (Map<String, Object> fivesYearStat : fivesYearStats) {
if ("城市低保".equals(fivesYearStat.get("iscity").toString())) {
if ("城市低保".equals(fivesYearStat.get("helpType").toString())) {
cityToatlAmount = getThreeYearTotalNum(cityToatlAmount, fivesYearStat);
} else if ("农村低保".equals(fivesYearStat.get("iscity").toString())) {
} else if ("农村低保".equals(fivesYearStat.get("helpType").toString())) {
villageToatlAmount = getThreeYearTotalNum(villageToatlAmount, fivesYearStat);
}
}
......@@ -181,13 +181,13 @@ public class ShjzStatsService {
List<Map<String, Object>> fivesYearStats = vShjzAchieveDao.getFivesYearStats(DateUtil.today());
for (Map<String, Object> fivesYearStat : fivesYearStats) {
if ("城市低保".equals(fivesYearStat.get("iscity").toString())) {
if ("城市低保".equals(fivesYearStat.get("helpType").toString())) {
cityAmountList.add(fivesYearStat.get("s2017").toString());
cityAmountList.add(fivesYearStat.get("s2018").toString());
cityAmountList.add(fivesYearStat.get("s2019").toString());
cityAmountList.add(fivesYearStat.get("s2020").toString());
cityAmountList.add(fivesYearStat.get("s2021").toString());
} else if ("农村低保".equals(fivesYearStat.get("iscity").toString())) {
} else if ("农村低保".equals(fivesYearStat.get("helpType").toString())) {
villageAmountList.add(fivesYearStat.get("s2017").toString());
villageAmountList.add(fivesYearStat.get("s2018").toString());
villageAmountList.add(fivesYearStat.get("s2019").toString());
......@@ -222,9 +222,9 @@ public class ShjzStatsService {
BigDecimal villageToatlNum = BigDecimal.ZERO;
BigDecimal cityToatlNum = BigDecimal.ZERO;
for (Map<String, Object> fivesYearStat : fivesYearStats) {
if ("城市低保".equals(fivesYearStat.get("iscity").toString())) {
if ("城市低保".equals(fivesYearStat.get("helpType").toString())) {
cityToatlNum = getFivesYearTotalNum(cityToatlNum, fivesYearStat);
} else if ("农村低保".equals(fivesYearStat.get("iscity").toString())) {
} else if ("农村低保".equals(fivesYearStat.get("helpType").toString())) {
villageToatlNum = getFivesYearTotalNum(villageToatlNum, fivesYearStat);
}
}
......@@ -253,11 +253,11 @@ public class ShjzStatsService {
List<Map<String, Object>> fivesYearStats = vShjzAchieveDao.getFivesYearStats(DateUtil.today());
for (Map<String, Object> fivesYearStat : fivesYearStats) {
if ("城市低保".equals(fivesYearStat.get("iscity").toString())) {
if ("城市低保".equals(fivesYearStat.get("helpType").toString())) {
cityAmountList.add(fivesYearStat.get("s2019").toString());
cityAmountList.add(fivesYearStat.get("s2020").toString());
cityAmountList.add(fivesYearStat.get("s2021").toString());
} else if ("农村低保".equals(fivesYearStat.get("iscity").toString())) {
} else if ("农村低保".equals(fivesYearStat.get("helpType").toString())) {
villageAmountList.add(fivesYearStat.get("s2019").toString());
villageAmountList.add(fivesYearStat.get("s2020").toString());
villageAmountList.add(fivesYearStat.get("s2021").toString());
......@@ -290,9 +290,9 @@ public class ShjzStatsService {
BigDecimal villageToatlNum = BigDecimal.ZERO;
BigDecimal cityToatlNum = BigDecimal.ZERO;
for (Map<String, Object> fivesYearStat : fivesYearStats) {
if ("城市低保".equals(fivesYearStat.get("iscity").toString())) {
if ("城市低保".equals(fivesYearStat.get("helpType").toString())) {
cityToatlNum = getThreeYearTotalNum(cityToatlNum, fivesYearStat);
} else if ("农村低保".equals(fivesYearStat.get("iscity").toString())) {
} else if ("农村低保".equals(fivesYearStat.get("helpType").toString())) {
villageToatlNum = getThreeYearTotalNum(villageToatlNum, fivesYearStat);
}
}
......
......@@ -3,6 +3,14 @@
<mapper namespace="com.zq.portal.dao.VShjzAchieveDao">
<select id="getFivesYearStats" resultType="java.util.Map">
SELECT help_type,
(select SUM(total) FROM v_shjz_total where `year`=${year} AND `help_type`=${help_type})
FROM `v_shjz_total`
WHERE DATE_FORMAT(createTime, '%Y-%m-%d') =
(SELECT DATE_FORMAT(createTime, '%Y-%m-%d') FROM v_shjz_total ORDER BY createTime DESC LIMIT 1)
GROUP BY
help_type
SELECT iscity,
SUM(s_2017) 's2017', SUM(s_2018) 's2018', SUM(s_2019) 's2019', SUM(s_2020) 's2020', SUM(s_2021) 's2021'
FROM `v_shjz_achieve`
......@@ -13,28 +21,43 @@
</select>
<select id="getStatsByYear" resultType="java.util.Map">
SELECT get_upunitname 'city', s_${year} 'achieveNum'
FROM `v_shjz_achieve`
WHERE DATE_FORMAT(create_time, '%Y-%m-%d') =
(SELECT DATE_FORMAT(create_time, '%Y-%m-%d') FROM v_shjz_achieve ORDER BY create_time DESC
SELECT u.city_name 'city', (select SUM(total) FROM v_shjz_total where AND `year`=${year}) 'achieveNum'
FROM `v_shjz_total` s
LEFT JOIN unit_code u ON s.unit_id=u.county_id
WHERE DATE_FORMAT(createTime, '%Y-%m-%d') =
(SELECT DATE_FORMAT(createTime, '%Y-%m-%d') FROM v_shjz_total ORDER BY createTime DESC
LIMIT 1)
AND iscity = '低保'
<!-- SELECT get_upunitname 'city', s_${year} 'achieveNum'-->
<!-- FROM `v_shjz_achieve`-->
<!-- WHERE DATE_FORMAT(create_time, '%Y-%m-%d') =-->
<!-- (SELECT DATE_FORMAT(create_time, '%Y-%m-%d') FROM v_shjz_achieve ORDER BY create_time DESC-->
<!-- LIMIT 1)-->
<!-- AND iscity = '低保'-->
</select>
<select id="getAreaYearShjzAchieveStats" resultType="com.zq.portal.vo.StatsVo">
SELECT unit_id 'code', get_upunitname 'name', iscity 'type', s_2017 + s_2018 + s_2019 + s_2020 + s_2021 'num'
FROM `v_shjz_achieve`
WHERE unit_id != '45' AND DATE_FORMAT(create_time, '%Y-%m-%d') =
(SELECT DATE_FORMAT(create_time, '%Y-%m-%d') FROM v_shjz_achieve ORDER BY create_time DESC LIMIT 1)
ORDER BY unit_id
SELECT u.city_id 'code', u.city_name 'name', s.help_type 'type', (select SUM(total) FROM v_shjz_total) 'num'
FROM `v_shjz_total` s
LEFT JOIN unit_code u ON s.unit_id=u.county_id
WHERE unit_id != '45' AND DATE_FORMAT(createTime, '%Y-%m-%d') =
(SELECT DATE_FORMAT(createTime, '%Y-%m-%d') FROM v_shjz_total ORDER BY createTime DESC LIMIT 1)
ORDER BY u.city_id
<!-- SELECT unit_id 'code', get_upunitname 'name', iscity 'type', s_2017 + s_2018 + s_2019 + s_2020 + s_2021 'num'-->
<!-- FROM `v_shjz_achieve`-->
<!-- WHERE unit_id != '45' AND DATE_FORMAT(create_time, '%Y-%m-%d') =-->
<!-- (SELECT DATE_FORMAT(create_time, '%Y-%m-%d') FROM v_shjz_achieve ORDER BY create_time DESC LIMIT 1)-->
<!-- ORDER BY unit_id-->
</select>
<select id="getAreaNameList" resultType="java.lang.String">
SELECT get_upunitname 'name'
FROM `v_shjz_achieve`
WHERE unit_id != '45'
GROUP BY get_upunitname
ORDER BY unit_id
SELECT u.city_name 'name'
FROM `v_shjz_total` s
LEFT JOIN unit_code u ON s.unit_id=u.county_id
WHERE s.unit_id != '45'
GROUP BY u.city_name
ORDER BY s.unit_id
</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