5 changed files with 108 additions and 12 deletions
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.personroom.controller; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.elink.esua.epdc.dto.personroom.EpidemicPlotBuildingErrorDTO; |
||||
|
import com.elink.esua.epdc.modules.personroom.excel.EpidemicPlotBuildingErrorExcel; |
||||
|
import com.elink.esua.epdc.modules.personroom.service.EpidemicPlotBuildingErrorService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 小区,楼栋信息 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2022-04-25 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("epidemicplotbuildingerror") |
||||
|
public class EpidemicPlotBuildingErrorController { |
||||
|
|
||||
|
@Autowired |
||||
|
private EpidemicPlotBuildingErrorService epidemicPlotBuildingErrorService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<EpidemicPlotBuildingErrorDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<EpidemicPlotBuildingErrorDTO> page = epidemicPlotBuildingErrorService.page(params); |
||||
|
return new Result<PageData<EpidemicPlotBuildingErrorDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<EpidemicPlotBuildingErrorDTO> get(@PathVariable("id") String id){ |
||||
|
EpidemicPlotBuildingErrorDTO data = epidemicPlotBuildingErrorService.get(id); |
||||
|
return new Result<EpidemicPlotBuildingErrorDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody EpidemicPlotBuildingErrorDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
epidemicPlotBuildingErrorService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody EpidemicPlotBuildingErrorDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
epidemicPlotBuildingErrorService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
epidemicPlotBuildingErrorService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<EpidemicPlotBuildingErrorDTO> list = epidemicPlotBuildingErrorService.getErrorExcelList(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, EpidemicPlotBuildingErrorExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue