LockSapUniqueIdController.java
3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package com.huaheng.pc.sap.controller;
import java.util.List;
import javax.annotation.Resource;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.framework.web.page.PageDomain;
import com.huaheng.framework.web.page.TableDataInfo;
import com.huaheng.framework.web.page.TableSupport;
import com.huaheng.pc.sap.domain.LockSapUniqueId;
import com.huaheng.pc.sap.service.LockSapUniqueIdService;
import io.swagger.annotations.Api;
/**
* 中间表 信息操作处理
* @author huaheng
* @date 2022-05-11
*/
@Api(tags = "中间表")
@Controller
@RequestMapping("/sap/lockSapUniqueId")
public class LockSapUniqueIdController extends BaseController {
private String prefix = "sap/LockUniqueId";
@Resource
private LockSapUniqueIdService lockSapUniqueIdService;
@RequiresPermissions("sap:lockSapUniqueId:view")
@GetMapping()
public String zarsh() {
return prefix + "/list";
}
/**
* 查询中间表列表
*/
@RequiresPermissions("sap:lockSapUniqueId:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(LockSapUniqueId lockSapUniqueId) {
LambdaQueryWrapper<LockSapUniqueId> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(StringUtils.isNotEmpty(lockSapUniqueId.getUniqueId()), LockSapUniqueId::getUniqueId, lockSapUniqueId.getUniqueId());
lambdaQueryWrapper.eq(StringUtils.isNotEmpty(lockSapUniqueId.getStation()), LockSapUniqueId::getStation, lockSapUniqueId.getStation());
lambdaQueryWrapper.orderByAsc(LockSapUniqueId::getStatus);
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
/* 使用分页查询 */
Page<LockSapUniqueId> page = new Page<>(pageNum, pageSize);
IPage<LockSapUniqueId> iPage = lockSapUniqueIdService.page(page, lambdaQueryWrapper);
return getMpDataTable(iPage.getRecords(), iPage.getTotal());
} else {
List<LockSapUniqueId> list = lockSapUniqueIdService.list(lambdaQueryWrapper);
return getDataTable(list);
}
}
/**
* 解锁站台
* @return
*/
@RequiresPermissions("sap:lockSapUniqueId:update")
@PostMapping("/unlockStation")
@ResponseBody
public AjaxResult unlockStation(String station, String uniqueId) {
return lockSapUniqueIdService.unlockStaionById(station, uniqueId);
}
}