新火炬后端单体项目初始化代码
Lius
7 天以前 904727f59b7e10a291ce7d1576e33192a619f2f2
src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
@@ -13,10 +13,12 @@
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.base.model.FactoryIdModel;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor;
import org.jeecg.modules.mdc.model.MdcEquipmentTree;
import org.jeecg.modules.mdc.model.ProductionIdModel;
import org.jeecg.modules.mdc.service.IFactoryEquipmentService;
import org.jeecg.modules.mdc.service.IMdcEquipmentDepartService;
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.service.IMdcProductionEquipmentService;
@@ -55,7 +57,10 @@
    private IMdcEquipmentDepartService mdcEquipmentDepartService;
    @Resource
    private IMdcProductionEquipmentService mdcProductionEquipmentService;
    private IFactoryEquipmentService factoryEquipmentService;
//    @Resource
//    private IMdcProductionEquipmentService mdcProductionEquipmentService;
    /**
     * 分页列表查询
@@ -244,7 +249,7 @@
    public Result<MdcEquipment> add(@RequestBody MdcEquipment mdcEquipment) {
        Result<MdcEquipment> result = new Result<>();
        String selectedDeparts = mdcEquipment.getSelectedDeparts();
        String selectedProduction = mdcEquipment.getSelectedProduction();
        String selectedProduction = mdcEquipment.getSelectedFactory();
        mdcEquipment.setEquipmentStatus(CommonConstant.STATUS_NORMAL);
        try {
            mdcEquipmentService.saveMdcEquipment(mdcEquipment, selectedDeparts, selectedProduction);
@@ -367,11 +372,11 @@
     */
    @AutoLog(value = "设备表-查询指定设备和产线关联的数据")
    @ApiOperation(value = "设备表-查询指定设备和产线关联的数据", notes = "设备表-查询指定设备和产线关联的数据")
    @GetMapping(value = "/equipmentProductionList")
    public Result<List<ProductionIdModel>> getEquipmentProductionList(@RequestParam(name = "equipmentId", required = true) String equipmentId) {
        Result<List<ProductionIdModel>> result = new Result<>();
    @GetMapping(value = "/equipmentFactoryList")
    public Result<List<FactoryIdModel>> equipmentFactoryList(@RequestParam(name = "equipmentId", required = true) String equipmentId) {
        Result<List<FactoryIdModel>> result = new Result<>();
        try {
            List<ProductionIdModel> proIdModelList = this.mdcProductionEquipmentService.queryProductionIdsOfEquipment(equipmentId);
            List<FactoryIdModel> proIdModelList = this.factoryEquipmentService.queryFactoryIdsOfEquipment(equipmentId);
            if (proIdModelList != null && !proIdModelList.isEmpty()) {
                result.setSuccess(true);
                result.setMessage("查找成功");
@@ -388,6 +393,33 @@
            return result;
        }
    }
//    /**
//     * 查询指定设备和产线关联的数据
//     */
//    @AutoLog(value = "设备表-查询指定设备和产线关联的数据")
//    @ApiOperation(value = "设备表-查询指定设备和产线关联的数据", notes = "设备表-查询指定设备和产线关联的数据")
//    @GetMapping(value = "/equipmentProductionList")
//    public Result<List<ProductionIdModel>> getEquipmentProductionList(@RequestParam(name = "equipmentId", required = true) String equipmentId) {
//        Result<List<ProductionIdModel>> result = new Result<>();
//        try {
//            List<ProductionIdModel> proIdModelList = this.mdcProductionEquipmentService.queryProductionIdsOfEquipment(equipmentId);
//            if (proIdModelList != null && !proIdModelList.isEmpty()) {
//                result.setSuccess(true);
//                result.setMessage("查找成功");
//                result.setResult(proIdModelList);
//            } else {
//                result.setSuccess(false);
//                result.setMessage("查找失败");
//            }
//            return result;
//        } catch (Exception e) {
//            log.error(e.getMessage(), e);
//            result.setSuccess(false);
//            result.setMessage("查找过程中出现了异常: " + e.getMessage());
//            return result;
//        }
//    }
    /**
     * 加载部门设备树
@@ -430,6 +462,26 @@
    }
    /**
     * 加载产线设备树
     */
    @AutoLog(value = "设备表-加载产线设备树")
    @ApiOperation(value = "设备表-加载产线设备树", notes = "设备表-加载产线设备树")
    @GetMapping(value = "/queryTreeListByFactory")
    public Result<List<MdcEquipmentTree>> queryTreeListByFactory() {
        Result<List<MdcEquipmentTree>> result = new Result<>();
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = user.getId();
        try {
            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProduction(userId);
            result.setSuccess(true);
            result.setResult(mdcEquipmentTreeList);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
        return result;
    }
    /**
     * 导出excel
     *
     * @param request