ReceiptContainerDetailController.java
3.95 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
84
85
86
package com.huaheng.pc.receipt.receiptContainerDetail.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.huaheng.common.utils.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huaheng.common.support.Convert;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
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.receipt.receiptContainerDetail.domain.ReceiptContainerDetail;
import com.huaheng.pc.receipt.receiptContainerDetail.service.ReceiptContainerDetailService;
import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail;
import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
@Controller
@RequestMapping("/receipt/receiptContainerDetail")
public class ReceiptContainerDetailController extends BaseController {
@Resource
private ReceiptContainerDetailService receiptContainerDetailService;
private String prefix = "receipt/receiptContainerDetail";
@RequiresPermissions("receipt:receiptContainerDetail:view")
@Log(title = "入库-入库详情列表", operating = "入库详情列表", action = BusinessType.GRANT)
@GetMapping("/list/{id}")
public String list(@PathVariable("id")Integer id, ModelMap mmap) {
mmap.put("receiptId", id);
return prefix+"/receiptDetail";
}
/**
* 查询入库详情
*/
@ApiOperation(value="查看入库详情", notes="根据头表id获取入库单明细信息", httpMethod = "POST")
@RequiresPermissions("receipt:receiptDetail:list")
@Log(title = "入库-入库单明细管理", operating = "查看入库单明细", action = BusinessType.GRANT)
@PostMapping("/list/{id}")
@ResponseBody
public TableDataInfo list(@ApiParam(name="receiptDetail",value="入库详情") @PathVariable("id")Integer receiptDetailId) {
LambdaQueryWrapper<ReceiptContainerDetail> lambdaQueryWrapper = Wrappers.lambdaQuery();
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
lambdaQueryWrapper.eq(ReceiptContainerDetail::getReceiptContainerId, receiptDetailId);
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){
/*使用分页查询*/
Page<ReceiptContainerDetail> page = new Page<>(pageNum, pageSize);
IPage<ReceiptContainerDetail> iPage = receiptContainerDetailService.page(page, lambdaQueryWrapper);
return getMpDataTable(iPage.getRecords(), iPage.getTotal());
} else {
List<ReceiptContainerDetail> list = receiptContainerDetailService.list(lambdaQueryWrapper);
return getDataTable(list);
}
}
@RequiresPermissions("receipt:receiptContainerDetail:remove")
@Log(title = "入库-入库详情列表", operating = "入库详情列表", action = BusinessType.GRANT)
@PostMapping("remove")
@ResponseBody
public AjaxResult remove(String ids) {
if (StringUtils.isEmpty(ids)){
return AjaxResult.error("id不能为空");
}
List<Integer> idList = Arrays.asList(Convert.toIntArray(ids));
return toAjax(receiptContainerDetailService.detailRemove(idList));
}
}