| | |
| | | import com.dg.core.annotation.CurrentUser; |
| | | import com.dg.core.db.gen.entity.ReplyTemplateEntity; |
| | | import com.dg.core.db.gen.entity.SysUser; |
| | | import com.dg.core.service.IOrganizationChartService; |
| | | import com.dg.core.service.IReplyTemplateService; |
| | | import com.dg.core.util.PermissionUtil; |
| | | import com.dg.core.util.TableDataInfo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | @Autowired |
| | | IReplyTemplateService iReplyTemplateService; |
| | | |
| | | @Autowired |
| | | IOrganizationChartService iOrganizationChartService; |
| | | |
| | | |
| | | /** |
| | | * 获取模板列表 |
| | | * @return |
| | | */ |
| | | @ApiOperation("获取模板列表") |
| | | @GetMapping("/getlist") |
| | | @Authorization |
| | | public TableDataInfo selectConfigList(@RequestParam(value = "pageNum",required = false) Integer pageNum, |
| | | @RequestParam(value = "pageSize",required = false) Integer pageSize, |
| | | @RequestParam(value = "Name",required = false) String Name) |
| | | @RequestParam(value = "name",required = false) String Name, |
| | | @CurrentUser SysUser sysUser) |
| | | { |
| | | Page<ReplyTemplateEntity> pageParam = new Page<>(pageNum,pageSize); |
| | | List<ReplyTemplateEntity> list = iReplyTemplateService.selectConfigList(pageParam,pageSize,Name); |
| | | int num=iReplyTemplateService.countNum(Name); |
| | | List<String> ids=PermissionUtil.getStairDepartment(sysUser,iOrganizationChartService); |
| | | List<ReplyTemplateEntity> list; |
| | | if (sysUser.getUserType().equals("1")||sysUser.getIsDivisionHead().equals("1")){ |
| | | list = iReplyTemplateService.selectConfigList(pageParam,pageSize,Name,ids,null); |
| | | } |
| | | else { |
| | | list = iReplyTemplateService.selectConfigList(pageParam,pageSize,Name,ids,sysUser.getUserId()); |
| | | } |
| | | int num=iReplyTemplateService.countNum(Name,ids); |
| | | return getDataTable(list,num); |
| | | } |
| | | |
| | |
| | | */ |
| | | @ApiOperation("获取详情") |
| | | @GetMapping("/getdata") |
| | | @Authorization |
| | | public ResultData selectConfigData(@RequestParam(value = "Id",required = false) String Id) |
| | | { |
| | | if(StringUtils.isEmpty(Id)) |
| | |
| | | return ResultData.error("模板名称不能为空"); |
| | | } |
| | | |
| | | if(StringUtils.isEmpty(entity.getDepartmentId())) |
| | | { |
| | | return ResultData.error("部门id不能为空 请分配部门id"); |
| | | } |
| | | |
| | | List<String> ids=iOrganizationChartService.getIds(entity.getDepartmentId()); |
| | | int num=iReplyTemplateService.countNum(entity.getName(),ids); |
| | | |
| | | if(num>0) |
| | | { |
| | | return ResultData.error("部门里办事名称重复!"); |
| | | } |
| | | |
| | | entity.setId(null); |
| | | entity.setDepartmentId(sysUser.getDepartmentId()); |
| | | entity.setDepartmentId(entity.getDepartmentId()); |
| | | entity.setCreateUserId(sysUser.getUserId()+""); |
| | | |
| | | return toAjax(iReplyTemplateService.insertConfig(entity)); |
| | |
| | | */ |
| | | @ApiOperation("更新模板") |
| | | @PostMapping("/update") |
| | | @Authorization |
| | | public ResultData updateConfig(@RequestBody ReplyTemplateEntity entity) |
| | | { |
| | | if(entity==null) |
| | |
| | | */ |
| | | @ApiOperation("删除模板") |
| | | @DeleteMapping("/delete") |
| | | @Authorization |
| | | public ResultData deleteConfigById(@RequestParam(value = "Id",required = false) String Id) |
| | | { |
| | | return toAjax(iReplyTemplateService.deleteConfigById(Id)); |
| | |
| | | */ |
| | | @ApiOperation("复制模板") |
| | | @PostMapping("/copy") |
| | | public ResultData copy(@RequestParam(value = "Id",required = false) String Id) |
| | | @Authorization |
| | | public ResultData copy(@RequestParam(value = "Id",required = false) String Id,@CurrentUser SysUser sysUser) |
| | | { |
| | | if(StringUtils.isEmpty(Id)) |
| | | { |
| | |
| | | { |
| | | return ResultData.error("模板不存在!"); |
| | | } |
| | | entity.setCreateUserId(sysUser.getUserId()); |
| | | entity.setName(entity.getName()+"(副本)"); |
| | | entity.setId(null); |
| | | return toAjax(iReplyTemplateService.insertConfig(entity)); |
| | | } |