AdminShipmentHeaderController.java 3.34 KB
package com.huaheng.pc.shipment.shipmentHeader.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.shipment.shipmentHeader.domain.ShipmentHeader;
import com.huaheng.pc.shipment.shipmentHeader.service.ShipmentHeaderService;
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/shipmentHeader")
public class AdminShipmentHeaderController extends BaseController
{
    private String prefix = "admin/shipmentHeader";
	
	@Autowired
	private ShipmentHeaderService shipmentHeaderService;
	@Autowired

	
	@GetMapping()
	public String shipmentHeader()
	{
	    return prefix + "/shipmentHeader";
	}
	
	/**
	 * 查询出库单主列表
	 */
	@Log(title = "出库-出库单", operating="查看出库主单", action = BusinessType.GRANT)
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(ShipmentHeader shipmentHeader, String time)
	{
		startPage();
		LambdaQueryWrapper<ShipmentHeader> lambdaQueryWrapper = Wrappers.lambdaQuery();
		lambdaQueryWrapper
				.eq(StringUtils.isNotEmpty(shipmentHeader.getWarehouseCode()),ShipmentHeader::getWarehouseCode, shipmentHeader.getWarehouseCode())
				.eq(ShipmentHeader::getDeleted,false)
				.in(StringUtils.isNotEmpty(shipmentHeader.getCompanyCode()),ShipmentHeader::getCompanyCode,shipmentHeader.getCompanyCode())
				.eq(StringUtils.isNotEmpty(shipmentHeader.getCode()),ShipmentHeader::getCode,shipmentHeader.getCode())
				.eq(StringUtils.isNotEmpty(shipmentHeader.getShipmentType()),ShipmentHeader::getShipmentType,shipmentHeader.getShipmentType())
				.eq(StringUtils.isNotEmpty(shipmentHeader.getReferCode()), ShipmentHeader::getReferCode, shipmentHeader.getReferCode())
				.eq(StringUtils.isNotEmpty(shipmentHeader.getReferCodeType()), ShipmentHeader::getReferCodeType, shipmentHeader.getReferCodeType())
				.eq(shipmentHeader.getFirstStatus()!=null, ShipmentHeader::getFirstStatus, shipmentHeader.getFirstStatus())
				.eq(shipmentHeader.getLastStatus()!=null, ShipmentHeader::getLastStatus, shipmentHeader.getLastStatus())
				.orderByDesc(ShipmentHeader::getId);
		List<ShipmentHeader> list = new ArrayList<>();
		if(StringUtils.isEmpty(time)) {
			list=shipmentHeaderService.list(lambdaQueryWrapper);
		}else {
			list=shipmentHeaderService.selectListByCreated();
		}
		return getDataTable(list);
	}

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