New file |
| | |
| | | package com.dg.core.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dg.core.ResultData; |
| | | import com.dg.core.db.gen.entity.ElseAccessoryEntity; |
| | | import com.dg.core.service.IElseAccessoryService; |
| | | import com.dg.core.util.TableDataInfo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Api(tags = {"其他附件接口"}) |
| | | @RestController |
| | | @RequestMapping("/else") |
| | | public class ElseAccessoryController extends BaseController |
| | | { |
| | | |
| | | @Autowired |
| | | IElseAccessoryService iElseAccessoryService; |
| | | |
| | | |
| | | /** |
| | | * 获取附件列表 |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @param Name |
| | | * @return |
| | | */ |
| | | @ApiOperation("获取附件列表接口") |
| | | @GetMapping(path = "/getList") |
| | | public TableDataInfo selectConfigList(@RequestParam(value = "pageNum",required = false) Integer pageNum, |
| | | @RequestParam(value = "pageSize",required = false) Integer pageSize, |
| | | @RequestParam(value = "Name",required = false) String Name) |
| | | { |
| | | Page<ElseAccessoryEntity> pageParam = new Page<>(pageNum,pageSize); |
| | | List<ElseAccessoryEntity> list = iElseAccessoryService.selectConfigList(pageParam,pageSize,Name); |
| | | int num=iElseAccessoryService.countNum(Name); |
| | | return getDataTable(list,num); |
| | | } |
| | | |
| | | /** |
| | | * 获取附件列表 |
| | | * @param Name |
| | | * @return |
| | | */ |
| | | @ApiOperation("获取附件列表接口(全部)") |
| | | @GetMapping(path = "/getAllList") |
| | | public TableDataInfo selectConfigListAll(@RequestParam(value = "Name",required = false) String Name) |
| | | { |
| | | List<ElseAccessoryEntity> list = iElseAccessoryService.selectConfigList(Name); |
| | | int num=iElseAccessoryService.countNum(Name); |
| | | return getDataTable(list,num); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增列表 |
| | | * @param entity |
| | | * @return |
| | | */ |
| | | @ApiOperation("新增附件") |
| | | @PostMapping(path = "/add") |
| | | public ResultData insertConfig(@RequestBody ElseAccessoryEntity entity) |
| | | { |
| | | if(entity==null) |
| | | { |
| | | return ResultData.error("参数不能为空"); |
| | | } |
| | | |
| | | if(StringUtils.isEmpty(entity.getName())) |
| | | { |
| | | return ResultData.error("事项名称不能为空"); |
| | | } |
| | | |
| | | if(StringUtils.isEmpty(entity.getUrl())) |
| | | { |
| | | return ResultData.error("文件url不能为空"); |
| | | } |
| | | |
| | | if(StringUtils.isEmpty(entity.getDepartmentId())) |
| | | { |
| | | return ResultData.error("部门不能为空"); |
| | | } |
| | | |
| | | return toAjax(iElseAccessoryService.insertConfig(entity)); |
| | | } |
| | | |
| | | /** |
| | | * 更新附件 |
| | | * @param entity |
| | | * @return |
| | | */ |
| | | @ApiOperation("更新附件") |
| | | @PostMapping(path = "/update") |
| | | public ResultData updateConfig(@RequestBody ElseAccessoryEntity entity) |
| | | { |
| | | return toAjax(iElseAccessoryService.updateConfig(entity)); |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | * @param Id |
| | | * @return |
| | | */ |
| | | @ApiOperation("删除附件") |
| | | @DeleteMapping(path = "/delete") |
| | | public ResultData deleteConfigById(@RequestParam(value = "Id",required = false) String Id) |
| | | { |
| | | return toAjax(iElseAccessoryService.deleteConfigById(Id)); |
| | | } |
| | | |
| | | } |