1 changed files with 96 additions and 0 deletions
@ -0,0 +1,96 @@ |
|||
package com.epmet.opendata.controller; |
|||
|
|||
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ExcelUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.opendata.dto.form.PreserVationFormDTO; |
|||
import com.epmet.opendata.dto.wgh.BmGridDTO; |
|||
|
|||
import com.epmet.opendata.excel.WghBmGridExcel; |
|||
|
|||
import com.epmet.opendata.service.WghBmGridService; |
|||
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 generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-06-14 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("bmGrid") |
|||
public class WghBmGridController { |
|||
|
|||
@Autowired |
|||
private WghBmGridService bmGridService; |
|||
|
|||
@RequestMapping("page") |
|||
public Result<PageData<BmGridDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<BmGridDTO> page = bmGridService.page(params); |
|||
return new Result<PageData<BmGridDTO>>().ok(page); |
|||
} |
|||
|
|||
@RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) |
|||
public Result<BmGridDTO> get(@PathVariable("id") String id){ |
|||
BmGridDTO data = bmGridService.get(id); |
|||
return new Result<BmGridDTO>().ok(data); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("save") |
|||
public Result save(@RequestBody BmGridDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
bmGridService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("update") |
|||
public Result update(@RequestBody BmGridDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
bmGridService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("delete") |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
bmGridService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<BmGridDTO> list = bmGridService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, WghBmGridExcel.class); |
|||
} |
|||
|
|||
/** |
|||
* 调用ruoyi存储bm_grid数据 |
|||
* |
|||
* @param dto |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @author LZN |
|||
* @date 2022/6/14 14:16 |
|||
*/ |
|||
@PostMapping("preserBmGridVation") |
|||
public Result getpreserBmGridVation(@RequestBody PreserVationFormDTO dto) { |
|||
bmGridService.getPreserBmGridVation(dto); |
|||
return new Result(); |
|||
} |
|||
} |
Loading…
Reference in new issue