AdminReceiptHeaderController.java 3.07 KB
package com.huaheng.pc.receipt.receiptHeader.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.common.utils.security.ShiroUtils;
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.TableDataInfo;
import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader;
import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.ArrayList;
import java.util.List;


/**
 * 入库单主 信息操作处理
 * 
 * @author huaheng
 * @date 2019-05-21
 */
@Controller
@RequestMapping("/admin/receiptHeader")
public class AdminReceiptHeaderController extends BaseController
{


    private String prefix = "admin/receiptHeader";
	
	@Autowired
	private ReceiptHeaderService receiptHeaderService;
	
	@GetMapping()
	public String receiptHeader()
	{
	    return prefix + "/receiptHeader";
	}
	
	/**
	 * 查询入库单主列表
	 */
	@Log(title = "入库-入库单", operating = "查看入库主单列表", action = BusinessType.GRANT)
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(ReceiptHeader receiptHeader, String time)
	{
        startPage();
		LambdaQueryWrapper<ReceiptHeader> lambdaQueryWrapper = Wrappers.lambdaQuery();
		lambdaQueryWrapper
				.eq(StringUtils.isNotEmpty(receiptHeader.getCompanyCode()),ReceiptHeader::getCompanyCode, receiptHeader.getCompanyCode())
				.eq(StringUtils.isNotEmpty(receiptHeader.getWarehouseCode()),ReceiptHeader::getWarehouseCode, receiptHeader.getWarehouseCode())
				.eq(StringUtils.isNotEmpty(receiptHeader.getReceiptType()),
						ReceiptHeader::getReceiptType, receiptHeader.getReceiptType())
				.eq(StringUtils.isNotEmpty(receiptHeader.getCode()), ReceiptHeader::getCode, receiptHeader.getCode())
				.eq(StringUtils.isNotNull(receiptHeader.getFirstStatus()),
						ReceiptHeader::getFirstStatus, receiptHeader.getFirstStatus())
				.eq(StringUtils.isNotNull(receiptHeader.getLastStatus()),
						ReceiptHeader::getLastStatus, receiptHeader.getLastStatus())
				.orderByDesc(ReceiptHeader::getCreated);
		List<ReceiptHeader> list = new ArrayList<>();
        if(StringUtils.isEmpty(time)) {
			list=receiptHeaderService.list(lambdaQueryWrapper);
		}else {
        	list=receiptHeaderService.selectListByCreated();
		}
		return getDataTable(list);
	}

	@PostMapping("/getReceiptHeader")
	@ResponseBody
	public AjaxResult<ReceiptHeader> getShipmentHeader(int id){
		return AjaxResult.success(receiptHeaderService.getById(id));
	}
}