@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; }
測試api