| File was renamed from eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/SysContractController.java |
| | |
| | | package me.zhengjie.modules.system.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.system.domain.SysContract; |
| | | import me.zhengjie.modules.system.service.SysContractService; |
| | | import me.zhengjie.modules.system.service.dto.SysContractQueryCriteria; |
| | | import me.zhengjie.modules.system.domain.SysUserContract; |
| | | import me.zhengjie.modules.system.service.SysUserContractService; |
| | | import me.zhengjie.modules.system.service.dto.SysUserContractQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "合同部分管理") |
| | | @RequestMapping("/api/sysContract") |
| | | public class SysContractController { |
| | | @RequestMapping("/api/sysUserContract") |
| | | public class SysUserContractController { |
| | | |
| | | private final SysContractService sysContractService; |
| | | private final SysUserContractService sysUserContractService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('sysContract:list')") |
| | | public void exportSysContract(HttpServletResponse response, SysContractQueryCriteria criteria) throws IOException { |
| | | sysContractService.download(sysContractService.queryAll(criteria), response); |
| | | @PreAuthorize("@el.check('sysUserContract:download')") |
| | | public void exportSysContract(HttpServletResponse response, SysUserContractQueryCriteria criteria) throws IOException { |
| | | sysUserContractService.download(sysUserContractService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询合同部分") |
| | | @ApiOperation("查询合同部分") |
| | | @PreAuthorize("@el.check('sysContract:list')") |
| | | public ResponseEntity<Object> querySysContract(SysContractQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(sysContractService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | @PreAuthorize("@el.check('sysUserContract:list')") |
| | | public ResponseEntity<Object> querySysContract(SysUserContractQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(sysUserContractService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/all") |
| | | @Log("查询合同部分") |
| | | @ApiOperation("查询合同部分") |
| | | @PreAuthorize("@el.check('sysContract:list')") |
| | | public ResponseEntity<Object> querySysContract(SysContractQueryCriteria criteria){ |
| | | return new ResponseEntity<>(sysContractService.queryAll(criteria),HttpStatus.OK); |
| | | @PreAuthorize("@el.check('sysUserContract:list')") |
| | | public ResponseEntity<Object> querySysContract(SysUserContractQueryCriteria criteria){ |
| | | return new ResponseEntity<>(sysUserContractService.queryAll(criteria),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增合同部分") |
| | | @ApiOperation("新增合同部分") |
| | | @PreAuthorize("@el.check('sysContract:add')") |
| | | public ResponseEntity<Object> createSysContract(@Validated @RequestBody SysContract resources){ |
| | | return new ResponseEntity<>(sysContractService.create(resources),HttpStatus.CREATED); |
| | | @PreAuthorize("@el.check('sysUserContract:add')") |
| | | public ResponseEntity<Object> createSysContract(@Validated @RequestBody SysUserContract resources){ |
| | | return new ResponseEntity<>(sysUserContractService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改合同部分") |
| | | @ApiOperation("修改合同部分") |
| | | @PreAuthorize("@el.check('sysContract:edit')") |
| | | public ResponseEntity<Object> updateSysContract(@Validated @RequestBody SysContract resources){ |
| | | sysContractService.update(resources); |
| | | @PreAuthorize("@el.check('sysUserContract:edit')") |
| | | public ResponseEntity<Object> updateSysContract(@Validated @RequestBody SysUserContract resources){ |
| | | sysUserContractService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除合同部分") |
| | | @ApiOperation("删除合同部分") |
| | | @PreAuthorize("@el.check('sysContract:del')") |
| | | @PreAuthorize("@el.check('sysUserContract:del')") |
| | | public ResponseEntity<Object> deleteSysContract(@RequestBody Long[] ids) { |
| | | sysContractService.deleteAll(ids); |
| | | sysUserContractService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |