| | |
| | | package org.springblade.modules.permit.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.permit.entity.Permit; |
| | |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入permit") |
| | | public R<IPage<Permit>> list(Permit permit, Query query) { |
| | | permit.setStorage("1"); |
| | | IPage<Permit> pages = permitService.page(Condition.getPage(query), Condition.getQueryWrapper(permit)); |
| | | return R.data(pages); |
| | | } |
| | |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增", notes = "传入permit") |
| | | public R save(@Valid @RequestBody Permit permit) { |
| | | String cardid = permit.getCardid(); |
| | | Map map = permitService.selectIn(cardid); |
| | | if (map!=null){ |
| | | String id = map.get("id").toString(); |
| | | permitService.removeByIds(Func.toLongList(id)); |
| | | } |
| | | permit.setType("2"); |
| | | permit.setStorage("1"); |
| | | permit.setPermitime(new Date()); |
| | | Map<String, String> param = null; |
| | | return R.status(permitService.save(permit)); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | *暂存 |
| | | */ |
| | | @PostMapping("/storage") |
| | | @ApiOperation(value = "新增", notes = "传入permit") |
| | | public R storage(@Valid @RequestBody Permit permit) { |
| | | permit.setStorage("0"); |
| | | permit.setPermitime(new Date()); |
| | | return R.status(permitService.save(permit)); |
| | | String cardid = permit.getCardid(); |
| | | Map map = permitService.selectIn(cardid); |
| | | if (map!=null){ |
| | | permit.setStorage("0"); |
| | | permitService.updateById(permit); |
| | | } |
| | | else { |
| | | permit.setStorage("0"); |
| | | permit.setPermitime(new Date()); |
| | | permitService.save(permit); |
| | | } |
| | | return R.success("暂存成功"); |
| | | } |
| | | |
| | | |