package org.jeecg.modules.arj.b.controller; import cn.hutool.core.io.IoUtil; import cn.hutool.poi.excel.ExcelReader; import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelWriter; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.jeecg.modules.arj.b.entity.Sbjx; import org.jeecg.modules.arj.b.entity.Scjh; import org.jeecg.modules.arj.b.service.ScjhService; import org.jeecg.modules.arj.b.vo.SbjxVo; import org.jeecg.modules.arj.b.vo.ScjhVo; import org.jeecg.modules.arj.config.AjaxResult; import org.jeecg.modules.arj.entity.Head; import org.jeecg.modules.arj.mapper.HeadMapper; import org.jeecg.modules.arj.service.HeadService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.InputStream; import java.net.URLEncoder; import java.util.List; /*其中org.jeecg.modules.arj.b.service就等于 com.example.demo.service,ScjhService就等于SpiderdataSpiderxrmmwService*/ /*其中org.jeecg.modules.arj.b.entity就等于com.example.demo.entity,Scjh就等于SpiderdataSpiderxrmmw,一种Java的模板引擎语法*/ /** *
* 生产计划表 前端控制器 *
* * @author hyy * @since 2023-05-08 */ @Api(tags = "B1-生产计划表") @RestController @RequestMapping("/b/scjh") public class ScjhController { @Resource private ScjhService scjhService; @Autowired private HeadService headService; @Autowired private HeadMapper headMapper; //新增和修改接口 @ApiOperation("增加新数据") @PostMapping("/add") public AjaxResult save(@RequestBody ScjhVo scjhVo) { //新增或者更新 //新增或者更新 Head h = headService.insert(scjhVo.getHead()); scjhVo.getScjhList().stream().forEach(item -> item.setHeadId(h.getId())); scjhService.saveOrUpdateBatch(scjhVo.getScjhList()); return AjaxResult.success(h.getId()); } /** * 获取最新数据 * * @return 实例对象 */ @ApiOperation("获取最新数据") @PostMapping("/last") public AjaxResult getlastRecord(@RequestBody String leixing) { Head head = headService.queryLeixingChanxian("B1", null); ScjhVo scjhVo = new ScjhVo(); if (head == null) return AjaxResult.error("访问无数据"); List