New file |
| | |
| | | package com.dg.core.controller; |
| | | |
| | | 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.db.gen.entity.AutomessagePolicyDocuments; |
| | | import com.dg.core.db.gen.entity.SysUser; |
| | | import com.dg.core.service.IAutomessagePolicyDocumentsService; |
| | | import com.dg.core.util.TableDataInfo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.Data; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Api(tags = {"获取法律法规政策文件接口"}) |
| | | @RestController |
| | | @RequestMapping("/AutomessagePolicyDocumentsController") |
| | | public class AutomessagePolicyDocumentsController extends BaseController { |
| | | |
| | | @Resource |
| | | private IAutomessagePolicyDocumentsService iAutomessagePolicyDocumentsService; |
| | | |
| | | /** |
| | | * 获取法律法规政策文件列表(分页) |
| | | * @param name |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "获取法律法规政策文件列表(分页)",response = AutomessagePolicyDocuments.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "type", value = "类型(1.法律法规2.政策文件)", required = true, dataType = "String", paramType = "query") |
| | | }) |
| | | @GetMapping("/selectConfigList") |
| | | 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 = "type",required = false) String type, |
| | | @RequestParam(value = "departmentId",required = false) Integer departmentId, |
| | | @CurrentUser SysUser sysUser){ |
| | | Page<AutomessagePolicyDocuments> pageParam = new Page<>(pageNum,pageSize); |
| | | List<AutomessagePolicyDocuments> list = iAutomessagePolicyDocumentsService.selectConfigList(pageParam,pageSize,name,type,sysUser,departmentId); |
| | | return getDataTable(list,iAutomessagePolicyDocumentsService.selectCountList(name,type,departmentId)); |
| | | } |
| | | |
| | | /** |
| | | * 获取法律法规政策文件列表(不分页) |
| | | * @param name |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "获取法律法规政策文件列表(不分页)",response = AutomessagePolicyDocuments.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "type", value = "类型(1.法律法规2.政策文件)", required = true, dataType = "String", paramType = "query") |
| | | }) |
| | | @GetMapping("/selectList") |
| | | public ResultData selectConfigList(@RequestParam(value = "name",required = false) String name, |
| | | @RequestParam(value = "type",required = false) String type, |
| | | @RequestParam(value = "departmentId",required = false) Integer departmentId){ |
| | | List<AutomessagePolicyDocuments> list = iAutomessagePolicyDocumentsService.selectConfigList(name,type,departmentId); |
| | | return ResultData.success(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增法律法规政策文件 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = " 新增法律法规政策文件 ",response = AutomessagePolicyDocuments.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "type", value = "类型(1.法律法规2.政策文件)传参中的type 传入1则是新增的法律规范2则是政策文件", required = true, dataType = "String", paramType = "query") |
| | | }) |
| | | @PostMapping("/add") |
| | | @Authorization |
| | | public ResultData add(@RequestBody AutomessagePolicyDocuments automessagePolicyDocuments,@CurrentUser SysUser sysUser){ |
| | | automessagePolicyDocuments.setCreateUserId(sysUser.getUserId()); |
| | | automessagePolicyDocuments.setUpdateUserId(sysUser.getUserId()); |
| | | int add = iAutomessagePolicyDocumentsService.add(automessagePolicyDocuments); |
| | | if (add>0){ |
| | | return ResultData.success("新增成功"); |
| | | }else { |
| | | return ResultData.error("新增失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改法律法规政策文件 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = " 新增法律法规政策文件 ",response = AutomessagePolicyDocuments.class) |
| | | @PostMapping("/update") |
| | | @Authorization |
| | | public ResultData update(@RequestBody AutomessagePolicyDocuments automessagePolicyDocuments,@CurrentUser SysUser sysUser){ |
| | | automessagePolicyDocuments.setUpdateUserId(sysUser.getUserId()); |
| | | int update = iAutomessagePolicyDocumentsService.update(automessagePolicyDocuments); |
| | | if (update>0){ |
| | | return ResultData.success("修改成功"); |
| | | }else { |
| | | return ResultData.error("修改失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除法律法规政策文件 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = " 删除法律法规政策文件 ",response = AutomessagePolicyDocuments.class) |
| | | @DeleteMapping("/delete") |
| | | @Authorization |
| | | public ResultData delete(@RequestParam(value = "id") Integer id){ |
| | | int delete = iAutomessagePolicyDocumentsService.delete(id); |
| | | if (delete>0){ |
| | | return ResultData.success("删除成功"); |
| | | }else { |
| | | return ResultData.error("删除失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据id获取法律法规政策文件数据 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = " 根据id获取法律法规政策文件数据 ",response = AutomessagePolicyDocuments.class) |
| | | @GetMapping("/selectAutomessagePolicyDocumentById") |
| | | public ResultData selectAutomessagePolicyDocumentById(@RequestParam(value = "id") Integer id){ |
| | | AutomessagePolicyDocuments automessagePolicyDocuments = iAutomessagePolicyDocumentsService.selectAutomessagePolicyDocumentById(id); |
| | | if (automessagePolicyDocuments!=null){ |
| | | return ResultData.success(automessagePolicyDocuments); |
| | | }else { |
| | | return ResultData.error("查找失败"); |
| | | } |
| | | } |
| | | } |