New file |
| | |
| | | package com.dg.core.api; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dg.core.ResultData; |
| | | import com.dg.core.annotation.Authorization; |
| | | import com.dg.core.annotation.CurrentUser; |
| | | import com.dg.core.controller.BaseController; |
| | | import com.dg.core.db.gen.entity.ElseAccessoryEntity; |
| | | import com.dg.core.db.gen.entity.GuideRepairOrder; |
| | | import com.dg.core.db.gen.entity.SysUser; |
| | | import com.dg.core.service.IElseAccessoryService; |
| | | import com.dg.core.service.IOrganizationChartService; |
| | | 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("/applets/else") |
| | | public class ElseAccessoryAppletsController extends BaseController |
| | | { |
| | | |
| | | @Autowired |
| | | IElseAccessoryService iElseAccessoryService; |
| | | |
| | | @Autowired |
| | | IOrganizationChartService iOrganizationChartService; |
| | | |
| | | /** |
| | | * 获取附件列表 |
| | | * @param Name |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "获取附件列表接口(全部)",response = ElseAccessoryEntity.class) |
| | | @GetMapping(path = "/getAllList") |
| | | @Authorization |
| | | public TableDataInfo selectConfigListAll(@RequestParam(value = "Name",required = false) String Name, |
| | | @CurrentUser SysUser sysUser) |
| | | { |
| | | List<String> ids=iOrganizationChartService.getIds(sysUser.getDepartmentId()); |
| | | List<ElseAccessoryEntity> list = iElseAccessoryService.selectConfigList(Name,ids); |
| | | int num=iElseAccessoryService.countNum(Name,ids); |
| | | return getDataTable(list,num); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增列表 |
| | | * @param entity |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "新增附件",response = ElseAccessoryEntity.class) |
| | | @PostMapping(path = "/add") |
| | | @Authorization |
| | | 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(value = "更新附件",response = ElseAccessoryEntity.class) |
| | | @PostMapping(path = "/update") |
| | | @Authorization |
| | | public ResultData updateConfig(@RequestBody ElseAccessoryEntity entity) |
| | | { |
| | | return toAjax(iElseAccessoryService.updateConfig(entity)); |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | * @param Id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "删除附件",response = ElseAccessoryEntity.class) |
| | | @DeleteMapping(path = "/delete") |
| | | @Authorization |
| | | public ResultData deleteConfigById(@RequestParam(value = "Id",required = false) String Id) |
| | | { |
| | | return toAjax(iElseAccessoryService.deleteConfigById(Id)); |
| | | } |
| | | |
| | | } |