ErpCommonController.java 4.7 KB
package com.skua.modules.erp.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.query.QueryGenerator;
import com.skua.modules.equipment.service.IEquipmentSparepartService;
import com.skua.modules.erp.entity.ApproveRecord;
import com.skua.modules.erp.entity.PurchaseMaterial;
import com.skua.modules.erp.service.IDistributMaterialService;
import com.skua.modules.erp.service.IPurchaseMaterialService;
import com.skua.modules.supplies.entity.EquipmentSparepartSupplies;
import com.skua.modules.supplies.service.IEquipmentSparepartSuppliesService;
import com.skua.modules.system.entity.SysUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@Slf4j
@Api(tags="ert通用方法")
@RestController("rrpCommonController")
@RequestMapping("/web/erp/common")
public class ErpCommonController {
    @Autowired
    private IEquipmentSparepartSuppliesService sparepartSuppliesService;//物料serivce
    @Autowired
    private IPurchaseMaterialService purchaseMaterialService;

    @Autowired
    private IDistributMaterialService  distributMaterialService;

    @AutoLog(value = "ERP-物料列表")
    @ApiOperation(value = "ERP-物料列表", notes = "ERP-物料列表")
    @RequestMapping(value = "/sparepartList", method = RequestMethod.GET)
    public Result<IPage<EquipmentSparepartSupplies>> sparepartList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
        Result<IPage<EquipmentSparepartSupplies>> result = new Result<IPage<EquipmentSparepartSupplies>>();
        Page<EquipmentSparepartSupplies> page = new Page<EquipmentSparepartSupplies>(pageNo, pageSize);
        String depId = BaseContextHandler.getRealDepartId();//临时参数
       // String username = req.getParameter("username");
        IPage<EquipmentSparepartSupplies> pageList = sparepartSuppliesService.queryPageByOut(page, depId);
        result.setSuccess(true);
        result.setResult(pageList);
        return result;
    }

    @AutoLog(value = "ERP-采购合同--物料清单")
    @ApiOperation(value = "ERP-采购合同--物料清单", notes = "ERP-采购合同--物料清单")
    @RequestMapping(value = "/purchaseMaterialList", method = RequestMethod.GET)
    public Result<IPage<PurchaseMaterial>> purchaseMaterialList(
            @RequestParam(name = "goodCode")  String goodCode,
            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
        Result<IPage<PurchaseMaterial>> result = new Result<IPage<PurchaseMaterial>>();
        Page<PurchaseMaterial> page = new Page<PurchaseMaterial>(pageNo, pageSize);
        String depId = BaseContextHandler.getRealDepartId();//临时参数
        // String username = req.getParameter("username");
        IPage<PurchaseMaterial> pageList = purchaseMaterialService.queryByPage(page,goodCode, depId);
        result.setSuccess(true);
        result.setResult(pageList);
        return result;
    }


   /* @AutoLog(value = "ERP-采购合同--物料清单")
    @ApiOperation(value = "ERP-采购合同--物料清单", notes = "ERP-采购合同--物料清单")
    @RequestMapping(value = "/distributMaterialList", method = RequestMethod.GET)
    public Result<IPage<EquipmentSparepartSupplies>> distributMaterialList(
            @RequestParam(name = "goodCode")  String goodCode,
            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
        Result<IPage<EquipmentSparepartSupplies>> result = new Result<IPage<EquipmentSparepartSupplies>>();
        Page<EquipmentSparepartSupplies> page = new Page<EquipmentSparepartSupplies>(pageNo, pageSize);
        String depId = BaseContextHandler.getRealDepartId();//临时参数
        // String username = req.getParameter("username");
        IPage<EquipmentSparepartSupplies> pageList = distributMaterialService.queryByPage(page,goodCode, depId);
        result.setSuccess(true);
        result.setResult(pageList);
        return result;
    }*/

}