/*
* Copyright (c) 2018-2025, ztt All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: ztt
*/
package com.chinaztt.mes.basic.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chinaztt.mes.basic.dto.ParamDTO;
import com.chinaztt.mes.basic.dto.ParamPlusDto;
import com.chinaztt.mes.basic.entity.Param;
import com.chinaztt.mes.basic.service.ParamService;
import com.chinaztt.mes.basic.util.DictUtils;
import com.chinaztt.mes.common.util.JsonUtil;
import com.chinaztt.mes.common.util.StringUtils;
import com.chinaztt.mes.common.util.easyexcel.EasyExcelUtils;
import com.chinaztt.mes.common.util.easyexcel.template.ParamTemplate;
import com.chinaztt.mes.common.wrapper.QueryWrapperUtil;
import com.chinaztt.ztt.admin.api.entity.SysDictItem;
import com.chinaztt.ztt.common.core.util.R;
import com.chinaztt.ztt.common.log.annotation.SysLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
* 工序参数表
*
* @author sunxl
* @date 2021-01-14 15:24:37
*/
@RestController
@AllArgsConstructor
@RequestMapping("/param")
@Api(value = "param", tags = "工序参数表管理")
public class ParamController {
private final ParamService paramService;
private DictUtils dictUtils;
@ApiOperation(value = "分页模板查询", notes = "分页查询")
@GetMapping("/pageInModel")
@PreAuthorize("@pms.hasPermission('technology_param_view','product_workbench')")
public R getParamPageInModel(Page page, ParamDTO param) {
QueryWrapper gen = QueryWrapperUtil.gen(param);
gen.lambda().eq(Param::getParentId,0L);
return R.ok(paramService.page(page, gen));
}
@ApiOperation(value = "工艺绑定查询", notes = "查询")
@PostMapping("/pageInId")
@PreAuthorize("@pms.hasPermission('technology_param_view','product_workbench')")
public R getParamPageInId(Page page, @RequestParam("idList") ListidList) {
System.out.println(idList);
QueryWrapper gen = new QueryWrapper<>();
gen.lambda().in(Param::getId,idList);
List dict = dictUtils.getDict("technology_param");
Page page1 = paramService.page(page, gen);
List records = page1.getRecords();
List