| | |
| | | import com.vincent.rsf.server.manager.controller.params.ReviseLogParams; |
| | | import com.vincent.rsf.server.manager.entity.ReviseLog; |
| | | import com.vincent.rsf.server.manager.service.ReviseLogService; |
| | | import com.vincent.rsf.server.manager.utils.buildPageRowsUtils; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<ReviseLog, BaseParam> pageParam = new PageParam<>(baseParam, ReviseLog.class); |
| | | return R.ok().add(reviseLogService.page(pageParam, pageParam.buildWrapper(true))); |
| | | PageParam<ReviseLog, BaseParam> page = reviseLogService.page(pageParam, pageParam.buildWrapper(true)); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(page)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locRevise:list')") |
| | | @PostMapping("/reviseLog/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(reviseLogService.list()); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(reviseLogService.list())); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locRevise:list')") |
| | | @PostMapping({"/reviseLog/many/{ids}", "/reviseLogs/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(reviseLogService.listByIds(Arrays.asList(ids))); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(reviseLogService.listByIds(Arrays.asList(ids)))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locRevise:list')") |
| | | @GetMapping("/reviseLog/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(reviseLogService.getById(id)); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(reviseLogService.getById(id))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locRevise:save')") |
| | |
| | | if (!reviseLogService.save(reviseLog)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(reviseLog); |
| | | return R.ok("Save Success").add(buildPageRowsUtils.rowsMap(reviseLog)); |
| | | } |
| | | |
| | | |
| | |
| | | if (!reviseLogService.updateById(reviseLog)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(reviseLog); |
| | | return R.ok("Update Success").add(buildPageRowsUtils.rowsMap(reviseLog)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locRevise:update')") |
| | |
| | | if (Objects.isNull(reviseLog)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | return R.ok().add(reviseLogService.reviseLoc(reviseLog, getLoginUserId())); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(reviseLogService.reviseLoc(reviseLog, getLoginUserId()))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locRevise:update')") |
| | |
| | | if (!reviseLogService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | return R.ok("Delete Success").add(buildPageRowsUtils.rowsMap(ids)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locRevise:list')") |
| | |
| | | reviseLogService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getId())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | return R.ok().add(buildPageRowsUtils.rowsMap(vos)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locRevise:list')") |
| | | @PostMapping("/reviseLog/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(reviseLogService.list(), ReviseLog.class), response); |
| | | ExcelUtil.build(ExcelUtil.create(buildPageRowsUtils.rowsMap(reviseLogService.list()), ReviseLog.class), response); |
| | | } |
| | | |
| | | } |