| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.oying.modules.system.domain.Dict; |
| | | import com.oying.modules.system.domain.dto.DictQueryCriteria; |
| | | import com.oying.utils.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | |
| | | @ApiOperation("查询字典") |
| | | @GetMapping(value = "/all") |
| | | @PreAuthorize("@el.check('dict:list')") |
| | | public ResponseEntity<List<Dict>> queryAllDict(){ |
| | | return new ResponseEntity<>(dictService.queryAll(new DictQueryCriteria()),HttpStatus.OK); |
| | | public ResponseEntity<Object> queryAllDict() { |
| | | return new ResponseEntity<>(R.success(dictService.queryAll(new DictQueryCriteria())), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("查询字典") |
| | | @GetMapping |
| | | @PreAuthorize("@el.check('dict:list')") |
| | | public ResponseEntity<PageResult<Dict>> queryDict(DictQueryCriteria criteria){ |
| | | public ResponseEntity<Object> queryDict(DictQueryCriteria criteria) { |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | return new ResponseEntity<>(dictService.queryAll(criteria, page),HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(dictService.queryAll(criteria, page)), HttpStatus.OK); |
| | | } |
| | | |
| | | @Log("新增字典") |
| | |
| | | throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); |
| | | } |
| | | dictService.create(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.CREATED); |
| | | } |
| | | |
| | | @Log("修改字典") |
| | |
| | | @PreAuthorize("@el.check('dict:edit')") |
| | | public ResponseEntity<Object> updateDict(@Validated(Dict.Update.class) @RequestBody Dict resources){ |
| | | dictService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @Log("删除字典") |
| | |
| | | @PreAuthorize("@el.check('dict:del')") |
| | | public ResponseEntity<Object> deleteDict(@RequestBody Set<Long> ids){ |
| | | dictService.delete(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | } |