|  | @ -1,8 +1,8 @@
 | 
												
													
														
															|  | package com.yihu.jw.base.endpoint.people_num;
 |  | 
 | 
												
													
														
															|  | 
 |  | package com.yihu.jw.base.endpoint.population;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.base.service.people_num.BasePeopleNumService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.peopel_num.BasePeopleNumDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.base.people_num.BasePeopleNumVO;
 |  | 
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.base.service.population.BasePopulationService;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.base.population.BasePopulationDO;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.restmodel.base.population.BasePopulationVO;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.web.Envelop;
 |  | import com.yihu.jw.restmodel.web.Envelop;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.web.ListEnvelop;
 |  | import com.yihu.jw.restmodel.web.ListEnvelop;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.web.ObjEnvelop;
 |  | import com.yihu.jw.restmodel.web.ObjEnvelop;
 | 
												
											
												
													
														
															|  | @ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.*;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import java.util.List;
 |  | import java.util.List;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | /**
 |  | /**
 | 
												
													
														
															|  | *
 |  | *
 | 
												
													
														
															|  | * 基础人口基数信息控制器
 |  | * 基础人口基数信息控制器
 | 
												
											
												
													
														
															|  | @ -26,54 +25,54 @@ import java.util.List;
 | 
												
													
														
															|  | * @version
 |  | * @version
 | 
												
													
														
															|  | * <pre>
 |  | * <pre>
 | 
												
													
														
															|  |  * Author	Version		Date		Changes
 |  |  * Author	Version		Date		Changes
 | 
												
													
														
															|  |  * Administrator 	1.0  		2018年09月05日 	Created
 |  | 
 | 
												
													
														
															|  | 
 |  |  * litaohong 	1.0  		2018年09月26日 	update
 | 
												
													
														
															|  |  *
 |  |  *
 | 
												
													
														
															|  |  * </pre>
 |  |  * </pre>
 | 
												
													
														
															|  | * @since 1.
 |  | * @since 1.
 | 
												
													
														
															|  | */
 |  | */
 | 
												
													
														
															|  | @RestController
 |  | @RestController
 | 
												
													
														
															|  | @RequestMapping(value = BaseRequestMapping.BasePeopleNum.PREFIX)
 |  | 
 | 
												
													
														
															|  | 
 |  | @RequestMapping(value = BaseRequestMapping.BasePopulation.PREFIX)
 | 
												
													
														
															|  | @Api(value = "基础人口基数信息管理", description = "基础人口基数信息管理服务接口", tags = {"wlyy基础服务 - 基础人口基数信息管理服务接口"})
 |  | @Api(value = "基础人口基数信息管理", description = "基础人口基数信息管理服务接口", tags = {"wlyy基础服务 - 基础人口基数信息管理服务接口"})
 | 
												
													
														
															|  | public class BasePeopleNumEndpoint extends EnvelopRestEndpoint {
 |  | 
 | 
												
													
														
															|  | 
 |  | public class BasePopulationEndpoint extends EnvelopRestEndpoint {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | @Autowired
 |  | @Autowired
 | 
												
													
														
															|  | private BasePeopleNumService basePeopleNumService;
 |  | 
 | 
												
													
														
															|  | 
 |  | private BasePopulationService basePopulationService;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | @PostMapping(value = BaseRequestMapping.BasePeopleNum.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
 |  | 
 | 
												
													
														
															|  | 
 |  | @PostMapping(value = BaseRequestMapping.BasePopulation.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
 | 
												
													
														
															|  | @ApiOperation(value = "创建")
 |  | @ApiOperation(value = "创建")
 | 
												
													
														
															|  | public ObjEnvelop<BasePeopleNumVO> create (
 |  | 
 | 
												
													
														
															|  | 
 |  | public ObjEnvelop<BasePopulationVO> create (
 | 
												
													
														
															|  |     @ApiParam(name = "json_data", value = "Json数据", required = true)
 |  |     @ApiParam(name = "json_data", value = "Json数据", required = true)
 | 
												
													
														
															|  |     @RequestBody String jsonData) throws Exception {
 |  |     @RequestBody String jsonData) throws Exception {
 | 
												
													
														
															|  |     BasePeopleNumDO basePeopleNum = toEntity(jsonData, BasePeopleNumDO.class);
 |  | 
 | 
												
													
														
															|  |     basePeopleNum = basePeopleNumService.save(basePeopleNum);
 |  | 
 | 
												
													
														
															|  |     return success(basePeopleNum, BasePeopleNumVO.class);
 |  | 
 | 
												
													
														
															|  | 
 |  |     BasePopulationDO basePopulation = toEntity(jsonData, BasePopulationDO.class);
 | 
												
													
														
															|  | 
 |  |     basePopulation = basePopulationService.save(basePopulation);
 | 
												
													
														
															|  | 
 |  |     return success(basePopulation, BasePopulationVO.class);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @PostMapping(value = BaseRequestMapping.BasePeopleNum.DELETE)
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = BaseRequestMapping.BasePopulation.DELETE)
 | 
												
													
														
															|  |     @ApiOperation(value = "删除")
 |  |     @ApiOperation(value = "删除")
 | 
												
													
														
															|  |     public Envelop delete(
 |  |     public Envelop delete(
 | 
												
													
														
															|  |     @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
 |  |     @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
 | 
												
													
														
															|  |     @RequestParam(value = "ids") String ids) {
 |  |     @RequestParam(value = "ids") String ids) {
 | 
												
													
														
															|  |     basePeopleNumService.delete(ids.split(","));
 |  | 
 | 
												
													
														
															|  | 
 |  |     basePopulationService.delete(ids.split(","));
 | 
												
													
														
															|  |     return success("删除成功");
 |  |     return success("删除成功");
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @PostMapping(value = BaseRequestMapping.BasePeopleNum.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = BaseRequestMapping.BasePopulation.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
 | 
												
													
														
															|  |     @ApiOperation(value = "更新")
 |  |     @ApiOperation(value = "更新")
 | 
												
													
														
															|  |     public ObjEnvelop<BasePeopleNumVO> update (
 |  | 
 | 
												
													
														
															|  | 
 |  |     public ObjEnvelop<BasePopulationVO> update (
 | 
												
													
														
															|  |         @ApiParam(name = "json_data", value = "Json数据", required = true)
 |  |         @ApiParam(name = "json_data", value = "Json数据", required = true)
 | 
												
													
														
															|  |         @RequestBody String jsonData) throws Exception {
 |  |         @RequestBody String jsonData) throws Exception {
 | 
												
													
														
															|  |         BasePeopleNumDO basePeopleNum = toEntity(jsonData, BasePeopleNumDO.class);
 |  | 
 | 
												
													
														
															|  |         if (null == basePeopleNum.getId()) {
 |  | 
 | 
												
													
														
															|  | 
 |  |         BasePopulationDO basePopulation = toEntity(jsonData, BasePopulationDO.class);
 | 
												
													
														
															|  | 
 |  |         if (null == basePopulation.getId()) {
 | 
												
													
														
															|  |         return failed("ID不能为空", ObjEnvelop.class);
 |  |         return failed("ID不能为空", ObjEnvelop.class);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         basePeopleNum = basePeopleNumService.save(basePeopleNum);
 |  | 
 | 
												
													
														
															|  |         return success(basePeopleNum, BasePeopleNumVO.class);
 |  | 
 | 
												
													
														
															|  | 
 |  |         basePopulation = basePopulationService.save(basePopulation);
 | 
												
													
														
															|  | 
 |  |         return success(basePopulation, BasePopulationVO.class);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         @GetMapping(value = BaseRequestMapping.BasePeopleNum.PAGE)
 |  | 
 | 
												
													
														
															|  | 
 |  |         @GetMapping(value = BaseRequestMapping.BasePopulation.PAGE)
 | 
												
													
														
															|  |         @ApiOperation(value = "获取分页")
 |  |         @ApiOperation(value = "获取分页")
 | 
												
													
														
															|  |         public PageEnvelop<BasePeopleNumVO> page (
 |  | 
 | 
												
													
														
															|  | 
 |  |         public PageEnvelop<BasePopulationVO> page (
 | 
												
													
														
															|  |             @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
 |  |             @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
 | 
												
													
														
															|  |             @RequestParam(value = "fields", required = false) String fields,
 |  |             @RequestParam(value = "fields", required = false) String fields,
 | 
												
													
														
															|  |             @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
 |  |             @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
 | 
												
											
												
													
														
															|  | @ -84,22 +83,22 @@ public ObjEnvelop<BasePeopleNumVO> create (
 | 
												
													
														
															|  |             @RequestParam(value = "page") int page,
 |  |             @RequestParam(value = "page") int page,
 | 
												
													
														
															|  |             @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
 |  |             @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
 | 
												
													
														
															|  |             @RequestParam(value = "size") int size) throws Exception {
 |  |             @RequestParam(value = "size") int size) throws Exception {
 | 
												
													
														
															|  |             List<BasePeopleNumDO> basePeopleNums = basePeopleNumService.search(fields, filters, sorts, page, size);
 |  | 
 | 
												
													
														
															|  |                 int count = (int)basePeopleNumService.getCount(filters);
 |  | 
 | 
												
													
														
															|  |                 return success(basePeopleNums, count, page, size, BasePeopleNumVO.class);
 |  | 
 | 
												
													
														
															|  | 
 |  |             List<BasePopulationDO> basePopulations = basePopulationService.search(fields, filters, sorts, page, size);
 | 
												
													
														
															|  | 
 |  |                 int count = (int)basePopulationService.getCount(filters);
 | 
												
													
														
															|  | 
 |  |                 return success(basePopulations, count, page, size, BasePopulationVO.class);
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |          @GetMapping(value = BaseRequestMapping.BasePeopleNum.LIST)
 |  | 
 | 
												
													
														
															|  | 
 |  |          @GetMapping(value = BaseRequestMapping.BasePopulation.LIST)
 | 
												
													
														
															|  |          @ApiOperation(value = "获取列表")
 |  |          @ApiOperation(value = "获取列表")
 | 
												
													
														
															|  |          public ListEnvelop<BasePeopleNumVO> list (
 |  | 
 | 
												
													
														
															|  | 
 |  |          public ListEnvelop<BasePopulationVO> list (
 | 
												
													
														
															|  |              @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
 |  |              @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
 | 
												
													
														
															|  |              @RequestParam(value = "fields", required = false) String fields,
 |  |              @RequestParam(value = "fields", required = false) String fields,
 | 
												
													
														
															|  |              @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
 |  |              @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
 | 
												
													
														
															|  |              @RequestParam(value = "filters", required = false) String filters,
 |  |              @RequestParam(value = "filters", required = false) String filters,
 | 
												
													
														
															|  |              @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
 |  |              @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
 | 
												
													
														
															|  |              @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
 |  |              @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
 | 
												
													
														
															|  |              List<BasePeopleNumDO> basePeopleNums = basePeopleNumService.search(fields, filters, sorts);
 |  | 
 | 
												
													
														
															|  |                   return success(basePeopleNums, BasePeopleNumVO.class);
 |  | 
 | 
												
													
														
															|  | 
 |  |              List<BasePopulationDO> basePopulations = basePopulationService.search(fields, filters, sorts);
 | 
												
													
														
															|  | 
 |  |                   return success(basePopulations, BasePopulationVO.class);
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |  }
 |  |  }
 |