@RequestMapping(value = "/cityList",method = RequestMethod.POST)
public ResponseVo<IPage<GovernanceRegulationClosePo>> querySearchCityDataList(@RequestBody Map<String,Object>map){
IPage<GovernanceRegulationClosePo> page=governanceRegulationCloseService.getCityDataList(map);
return new ResponseVo<>(true,page,UnicomResponseEnums.SUCCESS_OPTION);
}
IPage<GovernanceRegulationClosePo> getCityDataList(Map<String, Object> map);
@Override
public IPage<GovernanceRegulationClosePo> getCityDataList(Map<String, Object> map) {
String countyName = (String) map.get("countyName");
String regionCode = (String) map.get("regionCode");
Integer pageNum = (Integer) map.get("pageNum");
Integer pageSize = (Integer) map.get("pageSize");
String subRegionCode=regionCode.substring(0,4);
Page<GovernanceRegulationClosePo> page=new Page<>(pageNum,pageSize);
IPage<GovernanceRegulationClosePo> iPage=governanceRegulationCloseMapper.getCityDataList(page,countyName,subRegionCode);
return iPage;
}
IPage<GovernanceRegulationClosePo> getCityDataList(Page<GovernanceRegulationClosePo> page, @Param("countyName") String countyName,@Param("subRegionCode") String subRegionCode);
<select id="getCityDataList" resultType="com.huitian.mine.domain.vo.GovernanceRegulationCloseVo">
SELECT
b.COUNTY_NAME,b.REGION_CODE,COUNT(MINE_NUMBER) AS count ,SUM(DAMAGED_AREA) AS sumDamagedArea ,SUM(PLAN_REPAIR_AREA) AS sumPlanRepairedArea ,SUM(REPAIRED_AREA) AS sumRepairedArea ,SUM(CAPITAL_USAGE) AS sumCapitalUsage
FROM B_MINEREPAIRPROGRESSCLOSE b
<if test="countyName!=''and countyName!=null">
WHERE b.COUNTY_NAME=#{countyName}
</if>
GROUP BY b.COUNTY_NAME,b.REGION_CODE
HAVING b.REGION_CODE LIKE CONCAT(#{subRegionCode},'%')
</select>
public class GovernanceRegulationCloseVo {
/**
* 区县名称
*/
private String countyName;
/**
* 所属行政区编码
*/
private String regionCode;
/**
* 矿山总数
*/
private Integer count;
/**
* 总损毁面积
*/
private Long sumDamagedArea;
/**
* 总拟修复面积
*/
private Long sumPlanRepairedArea;
/**
* 总已修复面积
*/
private Long sumRepairedArea;
/**
* 总使用资金
*/
private Double sumCapitalUsage;
}
测试