邱宇豪
2023-09-25 d4ca39e076e00a768ad947f2c85b7185443c02e7
预埋件接口完成
已修改9个文件
已添加5个文件
1304 ■■■■■ 文件已修改
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysProjectServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysSegmentServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysEmbedmentGoodsController.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInsetRecordsController.java 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentRecordDto.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentRecordEntity.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/mapper/SysEmbedmentGoodsMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/SysEmbedmentGoodsService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/SysEmbedmentRecordService.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/impl/SysEmbedmentGoodsServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/impl/SysEmbedmentRecordServiceImpl.java 180 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentCorrectionMapper.xml 389 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentGoodsMapper.xml 227 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentRecordMapper.xml 282 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysProjectServiceImpl.java
@@ -37,7 +37,7 @@
        String proId = projectMapper.proNameByOne(proName);
        if(!StringUtil.isEmpty(proId)){
            BasicResult.faild("11111","error","项目名称被占用");
            BasicResult.faild("11111","项目名称被占用",null);
        }
        String proNumber ="";
        SysProject project = projectMapper.newByProject();
hd/pipe/engineeringManage/src/main/java/com/thhy/engineering/modules/biz/engineering/service/impl/SysSegmentServiceImpl.java
@@ -95,10 +95,10 @@
    public BasicResult segmentUpdate(Map<String, Object> values) {
        String segmentId1 = values.get("segmentId").toString();
        String segmentName = values.get("segmentName").toString();
        String unitProjectName = values.get("unitProjectName").toString();
        String segmentId =  segmentMapper.segmentNameByOne(segmentName);
        if(segmentId!=null && !segmentId.equals(segmentId1)){
        String segmentId =  segmentMapper.segmentNameByProjectName(unitProjectName);
        if(!segmentId1.equals(segmentId)){
            return  BasicResult.faild("11111","error","标段名称被占用");
        }
        segmentMapper.segmentUpdate(values);
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysEmbedmentGoodsController.java
@@ -5,10 +5,7 @@
import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentGoodsEntity;
import com.thhy.materials.modules.biz.embedment.service.SysEmbedmentGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
 * @Author QiuYuHao
@@ -38,4 +35,22 @@
    public BasicResult findAll(@RequestBody EmbedmentGoodsDto embedmentGoodsDto){
        return sysEmbedmentGoodsService.findAll(embedmentGoodsDto);
    }
    //查询库存单条
    @GetMapping("/findEntity")
    public BasicResult findEntity(@RequestParam String id){
        return sysEmbedmentGoodsService.findEntity(id);
    }
    //查询规格
    @GetMapping("/findAllDetails")
    public BasicResult findAllDetails(){
        return sysEmbedmentGoodsService.findAllDetails();
    }
    //查询dict类型
    @GetMapping("/getType")
    public BasicResult getType(){
        return sysEmbedmentGoodsService.getType();
    }
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/controller/SysInsetRecordsController.java
@@ -1,7 +1,16 @@
package com.thhy.materials.modules.biz.embedment.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.thhy.general.common.BasicResult;
import com.thhy.materials.modules.biz.concret.entity.SysSteelRecord;
import com.thhy.materials.modules.biz.embedment.dto.EmbedmentRecordDto;
import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentRecordEntity;
import com.thhy.materials.modules.biz.embedment.service.SysEmbedmentRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * @Author QiuYuHao
@@ -12,5 +21,96 @@
@RequestMapping(value = "embedmentInsetRecord")
public class SysInsetRecordsController {
    @Autowired
    private SysEmbedmentRecordService sysEmbedmentRecordService;
    /**
     * 新增记录
     * @param sysEmbedmentRecordEntity
     * @return
     */
    @PostMapping(value = "insert")
    public BasicResult insert (@RequestBody SysEmbedmentRecordEntity sysEmbedmentRecordEntity){
        return sysEmbedmentRecordService.insert(sysEmbedmentRecordEntity);
    }
    /**
     * 记录删除
     * @param id
     * @return
     */
    @GetMapping(value = "embedmentRecordDel")
    public BasicResult embedmentRecordDel (@RequestParam String id){
        return sysEmbedmentRecordService.embedmentRecordDel(id);
    }
    /**
     * 记录修改
     * @param sysEmbedmentRecordEntity
     * @return
     */
    @PostMapping(value = "update")
    BasicResult update(@RequestBody SysEmbedmentRecordEntity sysEmbedmentRecordEntity){
        return sysEmbedmentRecordService.update(sysEmbedmentRecordEntity);
    }
    /**
     * 入库记录查询
     * @param embedmentRecordDto
     * @return
     */
    @PostMapping(value = "embedmentRecordList")
    BasicResult embedmentRecordList(@RequestBody EmbedmentRecordDto embedmentRecordDto){
        return sysEmbedmentRecordService.embedmentRecordList(embedmentRecordDto);
    }
    /**
     * 出库记录查询
     * @param embedmentRecordDto
     * @return
     */
    @PostMapping(value = "embedmentRecordOutList")
    BasicResult embedmentRecordOutList(@RequestBody EmbedmentRecordDto embedmentRecordDto){
        return sysEmbedmentRecordService.embedmentRecordOutList(embedmentRecordDto);
    }
    /**
     * 出入库详情查询
     * @param id
     * @return
     */
    @GetMapping(value = "embedmentRecordInfo")
    public BasicResult embedmentRecordInfo (@RequestParam String id){
        return sysEmbedmentRecordService.embedmentRecordInfo(id);
    }
    /**
     * 导出
     * @param embedmentRecordDto
     * @param response
     */
    @PostMapping(value = "export")
    void export(@RequestBody EmbedmentRecordDto embedmentRecordDto, HttpServletResponse response){
        this.sysEmbedmentRecordService.export(embedmentRecordDto,response);
    }
    /**
     * 导出模板
     * @param embedmentRecordDto
     * @param response
     */
    @PostMapping(value = "recordExportTemplate")
    void recordExportTemplate(@RequestBody EmbedmentRecordDto embedmentRecordDto, HttpServletResponse response){
        this.sysEmbedmentRecordService.recordExportTemplate(embedmentRecordDto,response);
    }
    /**
     * 导入
     * @param file
     * @param request
     */
    @PostMapping(value = "variateExcel")
    void variateExcel(@RequestParam MultipartFile file, HttpServletRequest request){
        this.sysEmbedmentRecordService.variateExcel(file,request);
    }
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/dto/EmbedmentRecordDto.java
@@ -12,6 +12,7 @@
public class EmbedmentRecordDto {
    private String embedmentName;
    private String embedmentId;
    private String embedmentModel;
    private String companyId;
    private String supplierId;
    private String getDepart;
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/entity/SysEmbedmentRecordEntity.java
@@ -1,6 +1,7 @@
package com.thhy.materials.modules.biz.embedment.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.thhy.general.annotations.Excel;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@@ -22,11 +23,18 @@
    /**
     * 预埋件ID
     */
    private String EmbedmentId;
    private String embedmentId;
    //预埋件名称
    private String EmbedmentName;
    private String embedmentName;
    //预埋件规格
    private String EmbedmentModel;
    private String embedmentModel;
    @Excel(sort = 1,title = "预埋件名称")
    private String embedmentNameAndModel;
    public String getEmbedmentNameAndModel() {
        return embedmentName+"-"+embedmentModel;
    }
    /**
     * 1入库2出库
@@ -36,6 +44,7 @@
    /**
     * 出库量/入库量
     */
    @Excel(sort = 2,title = "数量")
    private Integer changeStock;
    /**
@@ -48,16 +57,19 @@
    /**
     * 单价
     */
    @Excel(sort = 3,title = "单价")
    private BigDecimal singlePrice;
    /**
     * 金额
     */
    @Excel(sort = 4,title = "金额")
    private BigDecimal amount;
    /**
     * 备注
     */
    @Excel(sort = 5,title = "备注")
    private String remark;
    /**
@@ -79,6 +91,7 @@
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String createTime;
    private String companyId;
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database table sys_assist_record
@@ -86,4 +99,5 @@
     * @mbg.generated Tue Apr 11 09:37:48 CST 2023
     */
    private static final long serialVersionUID = 1L;
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/mapper/SysEmbedmentGoodsMapper.java
@@ -6,6 +6,7 @@
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
 * @Author QiuYuHao
@@ -29,4 +30,5 @@
    void alarmSet(EmbedmentGoodsDto embedmentGoodsDto);
    List<Map<String,Object>> getType();
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/SysEmbedmentGoodsService.java
@@ -21,6 +21,8 @@
    BasicResult findAll(EmbedmentGoodsDto embedmentGoodsDto);
    BasicResult findAllDetails();
    BasicResult findEntity(String id);
    void export(EmbedmentGoodsDto embedmentGoodsDto, HttpServletResponse response);
@@ -31,4 +33,5 @@
    BasicResult inventoryList(EmbedmentGoodsDto embedmentGoodsDto);
    BasicResult getType();
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/SysEmbedmentRecordService.java
对比新文件
@@ -0,0 +1,49 @@
package com.thhy.materials.modules.biz.embedment.service;
import com.thhy.general.common.BasicResult;
import com.thhy.materials.modules.biz.embedment.dto.EmbedmentRecordDto;
import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentRecordEntity;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-22 16:27:16
 * 预埋件出入库接口
 */
public interface SysEmbedmentRecordService {
    BasicResult insert(SysEmbedmentRecordEntity sysEmbedmentRecordEntity);
    BasicResult embedmentRecordDel(String id);
    BasicResult update(SysEmbedmentRecordEntity sysEmbedmentRecordEntity);
    /**
     * 入库列表
     * @param embedmentRecordDto
     * @return
     */
    BasicResult embedmentRecordList(EmbedmentRecordDto embedmentRecordDto);
    /**
     * 出库列表
     * @param embedmentRecordDto
     * @return
     */
    BasicResult embedmentRecordOutList(EmbedmentRecordDto embedmentRecordDto);
    /**
     * 查询单条
     * @param id
     * @return
     */
    BasicResult embedmentRecordInfo(String id);
    void export(EmbedmentRecordDto embedmentRecordDto, HttpServletResponse response);
    void recordExportTemplate(EmbedmentRecordDto embedmentRecordDto, HttpServletResponse response);
    BasicResult variateExcel(MultipartFile file, HttpServletRequest request);
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/impl/SysEmbedmentGoodsServiceImpl.java
@@ -24,6 +24,8 @@
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
 * @Author QiuYuHao
@@ -43,6 +45,11 @@
    private SysEmbedmentCorrectionMapper sysEmbedmentCorrectionMapper;
    //=======================种类到此开始=======================
    @Override
    public BasicResult getType() {
        return BasicResult.success(sysEmbedmentGoodsMapper.getType());
    }
    @Override
    public BasicResult insert(SysEmbedmentGoodsEntity sysEmbedmentGoodsEntity) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
@@ -92,6 +99,14 @@
        return BasicResult.success(sysEmbedmentGoodsMapper.findEntity(id));
    }
    @Override
    public BasicResult findAllDetails() {
        List<String> modelList = sysEmbedmentGoodsMapper.findAll(null)
                .stream().map(s -> s.getEmbedmentModel()).collect(Collectors.toList());
        return BasicResult.success(modelList);
    }
    //=======================种类到此结束=======================
    //=======================库存管理开始=======================
@@ -170,6 +185,7 @@
        PageInfo<SysEmbedmentCorrectionEntity> pageInfo = new PageInfo<>(sysEmbedmentCorrectionEntities);
        return BasicResult.success(pageInfo);
    }
    //=======================校正记录结束=======================
}
hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/embedment/service/impl/SysEmbedmentRecordServiceImpl.java
对比新文件
@@ -0,0 +1,180 @@
package com.thhy.materials.modules.biz.embedment.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.thhy.general.common.BasicMessage;
import com.thhy.general.common.BasicResult;
import com.thhy.general.common.IBasicStatus;
import com.thhy.general.config.SysUserInfo;
import com.thhy.general.exception.BasicException;
import com.thhy.general.utils.ExcelUtils;
import com.thhy.general.utils.UserInfoUtils;
import com.thhy.materials.modules.biz.embedment.dto.EmbedmentRecordDto;
import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentGoodsEntity;
import com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentRecordEntity;
import com.thhy.materials.modules.biz.embedment.mapper.SysEmbedmentGoodsMapper;
import com.thhy.materials.modules.biz.embedment.mapper.SysEmbedmentRecordMapper;
import com.thhy.materials.modules.biz.embedment.service.SysEmbedmentRecordService;
import com.thhy.materials.modules.biz.utils.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
 * @Author QiuYuHao
 * @CreateDate 2023-09-22 16:28:24
 * 预埋件出入库实现
 */
@Service
public class SysEmbedmentRecordServiceImpl implements SysEmbedmentRecordService{
    @Autowired
    private SysEmbedmentRecordMapper sysEmbedmentRecordMapper;
    @Autowired
    private SysEmbedmentGoodsMapper sysEmbedmentGoodsMapper;
    @Override
    public BasicResult insert(SysEmbedmentRecordEntity sysEmbedmentRecordEntity) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        sysEmbedmentRecordEntity.setCreateUser(sysUserInfo.getRealName());
        SysEmbedmentGoodsEntity entity = sysEmbedmentGoodsMapper.findEntity(sysEmbedmentRecordEntity.getEmbedmentId());
        if(entity!=null){
            String stockType = sysEmbedmentRecordEntity.getStockType();
            //stockType 1入库 2出库
            int result = entity.getStock();
            if("1".equals(stockType)){
                result= entity.getStock() + sysEmbedmentRecordEntity.getChangeStock();
            }else{
                result= entity.getStock() - sysEmbedmentRecordEntity.getChangeStock();
            }
            if(result < 0 ){
                return BasicResult.faild("11111","库存不足","库存不足");
            }
            entity.setStock(result);
            sysEmbedmentGoodsMapper.update(entity);//更改库存
        }else {
            return BasicResult.faild("11111","库存没有该预埋件,请到【预埋件种类】添加","库存没有该预埋件,请到【预埋件种类】添加");
        }
        sysEmbedmentRecordMapper.insert(sysEmbedmentRecordEntity);
        return BasicResult.success();
    }
    @Override
    public BasicResult embedmentRecordDel(String id) {
        sysEmbedmentRecordMapper.embedmentRecordDel(id);
        return BasicResult.success();
    }
    @Override
    public BasicResult update(SysEmbedmentRecordEntity sysEmbedmentRecordEntity) {
        sysEmbedmentRecordMapper.update(sysEmbedmentRecordEntity);
        return BasicResult.success();
    }
    @Override
    public BasicResult embedmentRecordList(EmbedmentRecordDto embedmentRecordDto) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        embedmentRecordDto.setCompanyId(sysUserInfo.getCompanyId());
        PageHelper.startPage(embedmentRecordDto.getPageNum(),embedmentRecordDto.getPageSize());
        List<SysEmbedmentRecordEntity> sysEmbedmentRecordEntities = sysEmbedmentRecordMapper.embedmentRecordList(embedmentRecordDto);
        PageInfo<SysEmbedmentRecordEntity> info = new PageInfo<>(sysEmbedmentRecordEntities);
        return BasicResult.success(info);
    }
    @Override
    public BasicResult embedmentRecordOutList(EmbedmentRecordDto embedmentRecordDto) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        embedmentRecordDto.setCompanyId(sysUserInfo.getCompanyId());
        PageHelper.startPage(embedmentRecordDto.getPageNum(),embedmentRecordDto.getPageSize());
        List<SysEmbedmentRecordEntity> sysEmbedmentRecordEntities = sysEmbedmentRecordMapper.embedmentRecordOutList(embedmentRecordDto);
        PageInfo<SysEmbedmentRecordEntity> info = new PageInfo<>(sysEmbedmentRecordEntities);
        return BasicResult.success(info);
    }
    @Override
    public BasicResult embedmentRecordInfo(String id) {
        return BasicResult.success(sysEmbedmentRecordMapper.embedmentRecordInfo(id));
    }
    @Override
    public void export(EmbedmentRecordDto embedmentRecordDto, HttpServletResponse response) {
        SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
        embedmentRecordDto.setCompanyId(sysUserInfo.getCompanyId());
        List<SysEmbedmentRecordEntity> sysEmbedmentRecordEntities = sysEmbedmentRecordMapper.embedmentRecordList(embedmentRecordDto);
        ExcelUtils.downExcel(sysEmbedmentRecordEntities,SysEmbedmentRecordEntity.class,response,"预埋件入库");
    }
    @Override
    public void recordExportTemplate(EmbedmentRecordDto embedmentRecordDto, HttpServletResponse response) {
        List<SysEmbedmentRecordEntity> sysEmbedmentRecordEntities = new ArrayList<>();
        ExcelUtils.downExcel(sysEmbedmentRecordEntities,SysEmbedmentRecordEntity.class,response,"预埋件出入库");
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public BasicResult variateExcel(MultipartFile file, HttpServletRequest request) {
        List<List<Object>> lists = null;//去工具类处理,返回excel中的数据
        try {
            lists = ExcelUtil.getUserListByExcel(file.getInputStream(), file.getOriginalFilename());
        } catch (Exception e) {
            e.printStackTrace();
        }
        lists.remove(0);
        if (lists.size()>0){
            for (List<Object> list :lists){
                String embedmentNameAndModel = list.get(0).toString();
                String[] split = embedmentNameAndModel.split("-");
                String embedmentName = split[0];
                String embedmentModel = split[1];
                String id =  sysEmbedmentGoodsMapper.embedmentNameAndType(embedmentName,null);
                SysEmbedmentRecordEntity sysEmbedmentRecordEntity = new SysEmbedmentRecordEntity();
                sysEmbedmentRecordEntity.setEmbedmentId(id);
                //入库数量
                Integer changeStock = Integer.valueOf(list.get(2).toString());
                sysEmbedmentRecordEntity.setChangeStock(changeStock);
                //单价
                String dj = list.get(3).toString();
                BigDecimal singlePrice = new BigDecimal(dj);
                sysEmbedmentRecordEntity.setSinglePrice(singlePrice);
                //金额
                String je = list.get(4).toString();
                BigDecimal amount = new BigDecimal(je);
                sysEmbedmentRecordEntity.setAmount(amount);
                //备注
                String remark = list.get(5).toString();
                sysEmbedmentRecordEntity.setRemark(remark);
                //入库人
                SysUserInfo sysUserInfo = UserInfoUtils.getInstance().getUserInfo();
                String companyId = sysUserInfo.getCompanyId();
                sysEmbedmentRecordEntity.setCreateUser(sysUserInfo.getRealName());
                sysEmbedmentRecordEntity.setCompanyId(companyId);
                //stockType 1入库
                sysEmbedmentRecordEntity.setStockType("1");
                SysEmbedmentGoodsEntity entity = sysEmbedmentGoodsMapper.findEntity(sysEmbedmentRecordEntity.getEmbedmentId());
                if(entity!=null){
                    int result = entity.getStock() + sysEmbedmentRecordEntity.getChangeStock();
                    entity.setStock(result);
                    sysEmbedmentGoodsMapper.update(entity);//更改库存
                }else {
                    throw new BasicException(new BasicMessage("500","库存没有【"+embedmentName+"】,请到预埋件种类新增,新增完可重新导入!"));
                }
                sysEmbedmentRecordMapper.insert(sysEmbedmentRecordEntity);
            }
            return BasicResult.success("导入成功");
        }else {
            return BasicResult.faild("11111","error","空文件");
        }
    }
}
hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentCorrectionMapper.xml
对比新文件
@@ -0,0 +1,389 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.thhy.materials.modules.biz.embedment.mapper.SysEmbedmentCorrectionMapper">
  <insert id="insert" >
      insert into sys_embedment_correction
      <trim prefix="(" suffix=")" suffixOverrides=",">
          <if test="id != null">
              id,
          </if>
          <if test="embedmentId != null">
              embedment_id,
          </if>
          <if test="correctionBefore != null">
              correction_before,
          </if>
          <if test="correctionNum != null">
              correction_num,
          </if>
          <if test="correctionAfter != null">
              correction_after,
          </if>
          <if test="createTime != null">
              create_time,
          </if>
          <if test="createUser != null">
              create_user,
          </if>
          <if test="remark != null">
              remark,
          </if>
      </trim>
      <trim prefix="values (" suffix=")" suffixOverrides=",">
          <if test="id != null">
              #{id,jdbcType=VARCHAR},
          </if>
          <if test="embedmentId != null">
              #{embedmentId,jdbcType=VARCHAR},
          </if>
          <if test="correctionBefore != null">
              #{correctionBefore,jdbcType=INTEGER},
          </if>
          <if test="correctionNum != null">
              #{correctionNum,jdbcType=INTEGER},
          </if>
          <if test="correctionAfter != null">
              #{correctionAfter,jdbcType=INTEGER},
          </if>
          <if test="createTime != null">
              #{createTime,jdbcType=TIMESTAMP},
          </if>
          <if test="createUser != null">
              #{createUser,jdbcType=VARCHAR},
          </if>
          <if test="remark != null">
              #{remark,jdbcType=VARCHAR},
          </if>
      </trim>
  </insert>
    <select id="inventoryList" resultType="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentCorrectionEntity">
        select
            sac.id,
            sac.embedment_id as embedmentId,
            sac.correction_before as correctionBefore,
            sac.correction_num as correctionNum,
            sac.correction_after as correctionAfter,
            sac.create_time as createTime,
            sac.create_user as createUser,
            sac.remark as remark,
            sag.embedment_name as embedmentName,
            sag.embedment_model as embedmentModel,
            sag.unit
        from sys_embedment_correction sac
        left join sys_embedment_goods sag  on sac.embedment_id=sag.id
        where 1=1
        <if test="embedmentName!=null and embedmentName!='' ">
            and sag.embedment_name like concat('%',#{embedmentName},'%')
        </if>
        <if test="companyId!=null and companyId!='' ">
            and sag.company_id=#{companyId}
        </if>
        order by sac.create_time desc
    </select>
  <select id="assistRecordList" resultType="com.thhy.materials.modules.biz.materials.entity.SysAssistRecord">
       select sar.id,
      sar.assist_id as assistId,
      sar.stock_type as stockType,
      sar.change_stock as changeStock,
      sar.supplier_id as supplierId,
      sar.single_price as singlePrice,
      sar.amount as amount,
      sar.remark as remark,
      sar.get_depart as getDepart,
      sar.create_user as createUser,
      sar.create_time as createTime,
      sar.is_use as isUse,
       sag.assist_name as assistName,
       sag.assist_model as assistModel,
       ss.supplier_name as supplierName,
       su.real_name as realName
       from sys_assist_record sar
       left join  sys_assist_good sag  on sar.assist_id=sag.id
       left join sys_supplier ss on sar.supplier_id=ss.id
       left join sys_users su on su.user_id=sar.create_user
        where sar.is_use=1 and sar.stock_type=1
        <if test="assistName!=null and assistName!='' ">
          and sag.assist_name like concat('%',#{assistName},'%')
        </if>
        <if test="assistId!=null and assistId!='' ">
          and sar.assist_id=#{assistId}
        </if>
          <if test="companyId!=null and companyId!='' ">
              and sar.company_id=#{companyId}
          </if>
        <if test="realName!=null and realName!='' ">
         and su.real_name like concat('%',#{realName},'%')
        </if>
        <if test="supplierId!=null and supplierId!='' ">
            and sar.supplier_id=#{supplierId}
        </if>
        <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
            and sar.create_time between  #{strTime}and #{endTime}
        </if>
        order by sar.create_time desc
  </select>
  <select id="assistRecordOutList" resultType="com.thhy.materials.modules.biz.materials.entity.SysAssistRecord">
       select
      sar.id,
      sar.assist_id as assistId,
      sar.stock_type as stockType,
      sar.change_stock as changeStock,
      sar.supplier_id as supplierId,
      sar.single_price as singlePrice,
      sar.amount as amount,
      sar.remark as remark,
      sar.get_depart as getDepart,
      sar.create_user as createUser,
      sar.create_time as createTime,
      sar.is_use as isUse,
       sag.assist_name as assistName,
       sag.assist_model as assistModel,
       su.real_name as realName,
       sd.depart_name as departName from sys_assist_record sar
       left join  sys_assist_good sag  on sar.assist_id=sag.id
       left join sys_users su on su.user_id=sar.create_user
       left join sys_depart sd on  sd.depart_id=sar.get_depart
        where sar.is_use=1 and sar.stock_type=2
        <if test="assistName!=null and assistName!='' ">
          and sag.assist_name like concat('%',#{assistName},'%')
        </if>
        <if test="assistId!=null and assistId!='' ">
          and sar.assist_id=#{assistId}
        </if>
          <if test="companyId!=null and companyId!='' ">
              and sar.company_id=#{companyId}
          </if>
        <if test="realName!=null and realName!='' ">
         and su.real_name like concat('%',#{realName},'%')
        </if>
        <if test="supplierId!=null and supplierId!='' ">
            and sar.supplier_id=#{supplierId}
        </if>
        <if test="getDepart!=null and getDepart!='' ">
            and sd.depart_name like concat('%',#{getDepart},'%')
        </if>
        <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
            and sar.create_time between  #{strTime} and #{endTime}
        </if>
        order by sar.create_time desc
  </select>
  <select id="assistRecordInfo" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.materials.entity.SysAssistRecord">
     select
        sar.id,
      sar.assist_id as assistId,
      sar.stock_type as stockType,
      sar.change_stock as changeStock,
      sar.supplier_id as supplierId,
      sar.single_price as singlePrice,
      sar.amount as amount,
      sar.remark as remark,
      sar.get_depart as getDepart,
      sar.create_user as createUser,
      sar.create_time as createTime,
      sar.is_use as isUse,
     sag.assist_name as assistName,
     sag.assist_model as assistModel,
     ss.supplier_name as supplierName,
     su.real_name as realName from sys_assist_record sar
       left join  sys_assist_good sag  on sar.assist_id=sag.id
       left join sys_supplier ss on sar.supplier_id=ss.id
       left join sys_users su on su.user_id=sar.create_user
        where sar.is_use=1 and sar.id=#{id}
  </select>
  <select id="assistIdSelect" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.materials.entity.SysAssistRecord">
        select
         sar.id,
      sar.assist_id as assistId,
      sar.stock_type as stockType,
      sar.change_stock as changeStock,
      sar.supplier_id as supplierId,
      sar.single_price as singlePrice,
      sar.amount as amount,
      sar.remark as remark,
      sar.get_depart as getDepart,
      sar.create_user as createUser,
      sar.create_time as createTime,
      sar.is_use as isUse
         from  sys_assist_record sar where sar.id=#{id}
  </select>
  <update id="assistRecordDel" >
    update  sys_assist_record set
     is_use=2
    where  id=#{id}
  </update>
    <insert id="assistCheckInsert">
        insert into sys_assist_correction
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="assistId != null">
                assist_id,
            </if>
            <if test="correctionBefore != null">
                correction_before,
            </if>
            <if test="correctionNum != null">
                correction_num,
            </if>
            <if test="correctionAfter != null">
                correction_after,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="createUser != null">
                create_user,
            </if>
            <if test="remark != null">
                remark,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=VARCHAR},
            </if>
            <if test="assistId != null">
                #{assistId,jdbcType=VARCHAR},
            </if>
            <if test="correctionBefore != null">
                #{correctionBefore,jdbcType=INTEGER},
            </if>
            <if test="correctionNum != null">
                #{correctionNum,jdbcType=INTEGER},
            </if>
            <if test="correctionAfter != null">
                #{correctionAfter,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="createUser != null">
                #{createUser,jdbcType=VARCHAR},
            </if>
            <if test="remark != null">
                #{remark,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
    <select id="assistCorrectionList" resultType="com.thhy.materials.modules.biz.materials.entity.SysAssistCorrection">
        select sac.id,
        sac.assist_id as assistId,
        sac.correction_before as correctionBefore,
        sac.correction_num as correctionNum,
        sac.correction_after as correctionAfter,
        sac.create_time as createTime,
        sac.create_user as createUser,
        sac.remark as remark,
        sag.assist_name as assistName,
        sag.assist_model as assistModel,
        sag.unit,
        su.real_name as realName
        from sys_assist_correction sac
        left join sys_assist_good sag  on sac.assist_id=sag.id
        left join sys_users su  on su.user_id=sac.create_user
        where 1=1
        <if test="assistName!=null and assistName!='' ">
            and sag.assist_name like concat('%',#{assistName},'%')
        </if>
        <if test="companyId!=null and companyId!='' ">
            and sag.company_id=#{companyId}
        </if>
        order by sac.create_time desc
    </select>
    <select id="assistStatisticsDay" resultType="com.thhy.materials.modules.biz.materials.entity.dto.AssistStatisticsDto">
        SELECT
    sar.assist_id AS assistId,
    sag.assist_name AS assistName,
    sag.assist_model AS assistModel,
    DATE( sar.create_time ) AS getDate,
    SUM( sar.change_stock ) AS changeStock
FROM
    sys_assist_record sar
    LEFT JOIN sys_assist_good sag ON sar.assist_id = sag.id
WHERE
    sar.stock_type = 2
    AND sar.is_use = 1
    <if test="assistId!=null and assistId!='' ">
       and  sar.assist_id=#{assistId}
    </if>
    <if test="companyId!=null and companyId!='' ">
        and sag.company_id=#{companyId}
    </if>
    <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
        and DATE( sar.create_time ) between  #{strTime} and #{endTime}
    </if>
GROUP BY
    DATE( sar.create_time ),
    sar.assist_id
    </select>
    <select id="assistStatisticsMonth" resultType="com.thhy.materials.modules.biz.materials.entity.dto.AssistStatisticsDto">
        SELECT
    sar.assist_id AS assistId,
    sag.assist_name AS assistName,
    sag.assist_model AS assistModel,
    CONCAT(
        CONCAT( YEAR ( sar.create_time ), '-' ),
    IF
    ( MONTH ( sar.create_time )> 9, MONTH ( sar.create_time ), CONCAT( '0', MONTH ( sar.create_time )) )) AS getDate,
    SUM( sar.change_stock ) AS changeStock
FROM
    sys_assist_record sar
    LEFT JOIN sys_assist_good sag ON sar.assist_id = sag.id
WHERE
    sar.stock_type = 2
    AND sar.is_use = 1
        <if test="assistId!=null and assistId!='' ">
            and  sar.assist_id=#{assistId}
        </if>
        <if test="companyId!=null and companyId!='' ">
            and sag.company_id=#{companyId}
        </if>
        <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
            and CONCAT(
            CONCAT( YEAR ( sar.create_time ), '-' ),
            IF
            ( MONTH ( sar.create_time )> 9, MONTH ( sar.create_time ), CONCAT( '0', MONTH ( sar.create_time )) )) between  #{strTime} and #{endTime}
        </if>
GROUP BY
    CONCAT(
        CONCAT( YEAR ( sar.create_time ), '-' ),
    IF
    ( MONTH ( sar.create_time )> 9, MONTH ( sar.create_time ), CONCAT( '0', MONTH ( sar.create_time )) )),
    sar.assist_id
    </select>
    <select id="assistRecordPull" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.materials.entity.dto.AssistGoodPullDto">
        SELECT
        id AS assistId,
        assist_name AS assistName,
        assist_model AS assistModel
        FROM
        sys_assist_good
        WHERE
        is_use =1
        <if test="companyId!=null and companyId!='' ">
            and company_id=#{companyId}
        </if>
    </select>
    <select id="assistRecordPullS"  resultType="com.thhy.materials.modules.biz.materials.entity.dto.AssistGoodPullDto">
        SELECT
        id AS assistId,
        assist_name AS assistName,
        assist_model AS assistModel
        FROM
        sys_assist_good
        WHERE
        is_use =1
        <if test="companyId!=null and companyId!='' ">
            and company_id=#{companyId}
        </if>
        <if test="assistId!=null and assistId!='' ">
            and id=#{assistId}
        </if>
    </select>
</mapper>
hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentGoodsMapper.xml
对比新文件
@@ -0,0 +1,227 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.thhy.materials.modules.biz.embedment.mapper.SysEmbedmentGoodsMapper">
  <resultMap id="BaseResultMap" type="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentGoodsEntity">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Apr 11 08:58:47 CST 2023.
    -->
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="embedment_name" jdbcType="VARCHAR" property="embedmentName" />
    <result column="embedment_type" jdbcType="VARCHAR" property="embedmentType" />
    <result column="embedment_model" jdbcType="VARCHAR" property="embedmentModel" />
    <result column="unit" jdbcType="VARCHAR" property="unit" />
    <result column="stock" jdbcType="INTEGER" property="stock" />
    <result column="position" jdbcType="VARCHAR" property="position" />
    <result column="alarm_count" jdbcType="INTEGER" property="alarmCount" />
    <result column="is_use" jdbcType="INTEGER" property="isUse" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="create_user" jdbcType="VARCHAR" property="createUser" />
  </resultMap>
  <select id="embedmentNameAndType" resultType="java.lang.String">
    select id from sys_embedment_goods where is_use=1
    <if test="embedmentName != null">
      and embedment_name=#{embedmentName}
    </if>
    <if test="embedmentType != null">
      and embedment_type=#{embedmentType}
    </if>
  </select>
  <insert id="insert" >
    insert into sys_embedment_goods
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="embedmentName != null">
        embedment_name,
      </if>
      <if test="embedmentType != null">
        embedment_type,
      </if>
      <if test="embedmentModel != null">
        embedment_model,
      </if>
      <if test="unit != null">
        unit,
      </if>
      <if test="stock != null">
        stock,
      </if>
      <if test="position != null">
        `position`,
      </if>
      <if test="alarmCount != null">
        alarm_count,
      </if>
      <if test="isUse != null">
        is_use,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="companyId != null">
        company_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="embedmentName != null">
        #{embedmentName,jdbcType=VARCHAR},
      </if>
      <if test="embedmentType != null">
        #{embedmentType,jdbcType=VARCHAR},
      </if>
      <if test="embedmentModel != null">
        #{embedmentModel,jdbcType=VARCHAR},
      </if>
      <if test="unit != null">
        #{unit,jdbcType=VARCHAR},
      </if>
      <if test="stock != null">
        #{stock,jdbcType=INTEGER},
      </if>
      <if test="position != null">
        #{position,jdbcType=VARCHAR},
      </if>
      <if test="alarmCount != null">
        #{alarmCount,jdbcType=INTEGER},
      </if>
      <if test="isUse != null">
        #{isUse,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="companyId != null">
        #{companyId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="findAll" resultType="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentGoodsEntity">
    select sag.id,
        sag.embedment_name as embedmentName,
        sag.embedment_type as embedmentType,
        sag.embedment_model as embedmentModel,
        sag.unit as unit,
        sag.stock as stock,
        sag.position as 'position',
        sag.alarm_count as alarmCount,
        sag.is_use as isUse,
        sag.create_time as createTime,
        sag.remark as remark,
        sd.dict_name as dictName
        from sys_embedment_goods sag
        left join  sys_dict sd on sag.assist_type=sd.dict_id
        where  sag.is_use=1
        <if test="assistName!=null and assistName!='' ">
            and sag.assist_name like concat('%',#{assistName},'%')
        </if>
        <if test="companyId!=null and companyId!='' ">
            and sag.company_id=#{companyId}
        </if>
        order by  sag.create_time desc
  </select>
  <select id="findEntity" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentGoodsEntity">
      select sag.id,
       sag.embedment_name as embedmentName,
       sag.embedment_type as embedmentType,
       sag.embedment_model as embedmentModel,
        sag.unit as unit,
        sag.stock as stock,
        sag.position as 'position',
        sag.alarm_count as alarmCount,
        sag.is_use as isUse,
        sag.create_time as createTime,
        sag.remark as remark,
      sd.dict_name as dictName from sys_embedment_goods sag left join  sys_dict sd
      on sag.assist_type=sd.dict_id
      where  sag.is_use=1 and sag.id=#{assistId}
  </select>
  <update id="delete" parameterType="java.lang.String" >
    update sys_embedment_goods set
    is_use=2
    where id=#{id}
  </update>
  <update id="alarmSet">
    update sys_embedment_goods set alarm_count = #{alarmCount}
    where id=#{id}
  </update>
  <select id="getType" resultType="java.util.Map">
    select
    sd.dict_id as dictId,
    sd.dict_type as dictType,
    sd.dict_name as dictName,
    sd.dict_value as dictValue,
    sd.colors as colors,
    sd.create_time as createTime,
    sdt.dict_type_name as dictTypeName
    from sys_dict sd
    left join sys_dict_type sdt on sd.dict_type=sdt.dict_type
    where
    sd.is_use = 1
    and  sd.dict_type='embedment'
  </select>
  <update id="update" >
    update sys_embedment_goods
    <set>
      <if test="embedmentName != null">
        embedment_name = #{embedmentName,jdbcType=VARCHAR},
      </if>
      <if test="embedmentType != null">
        embedment_type = #{embedmentType,jdbcType=VARCHAR},
      </if>
      <if test="embedmentModel != null">
        embedment_model = #{embedmentModel,jdbcType=VARCHAR},
      </if>
      <if test="unit != null">
        unit = #{unit,jdbcType=VARCHAR},
      </if>
      <if test="stock != null">
        stock = #{stock,jdbcType=INTEGER},
      </if>
      <if test="position != null">
        position = #{position,jdbcType=VARCHAR},
      </if>
      <if test="alarmCount != null">
        alarm_count = #{alarmCount,jdbcType=INTEGER},
      </if>
      <if test="isUse != null">
        is_use = #{isUse,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUser != null">
        create_user = #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <select id="assistGood" parameterType="java.lang.String" resultType="java.lang.String">
    select id from sys_assist_record where assist_id=#{assistId} and is_use=1
  </select>
</mapper>
hd/pipe/materialsManage/src/main/resources/mapping/SysEmbedmentRecordMapper.xml
对比新文件
@@ -0,0 +1,282 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.thhy.materials.modules.biz.embedment.mapper.SysEmbedmentRecordMapper">
  <resultMap id="BaseResultMap" type="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentRecordEntity">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Apr 11 09:37:48 CST 2023.
    -->
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="embedment_id" jdbcType="VARCHAR" property="embedmentId" />
    <result column="stock_type" jdbcType="VARCHAR" property="stockType" />
    <result column="change_stock" jdbcType="INTEGER" property="changeStock" />
    <result column="supplier_id" jdbcType="VARCHAR" property="supplierId" />
    <result column="single_price" jdbcType="DECIMAL" property="singlePrice" />
    <result column="amount" jdbcType="DECIMAL" property="amount" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="get_depart" jdbcType="VARCHAR" property="getDepart" />
    <result column="create_user" jdbcType="VARCHAR" property="createUser" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>
    <update id="update" >
        update sys_embedment_record
        <set>
            <if test="embedmentId != null">
                embedment_id = #{embedmentId,jdbcType=VARCHAR},
            </if>
            <if test="stockType != null">
                stock_type = #{stockType,jdbcType=VARCHAR},
            </if>
            <if test="changeStock != null">
                change_stock = #{changeStock,jdbcType=INTEGER},
            </if>
            <if test="supplierId != null">
                supplier_id = #{supplierId,jdbcType=VARCHAR},
            </if>
            <if test="singlePrice != null">
                single_price = #{singlePrice,jdbcType=DECIMAL},
            </if>
            <if test="amount != null">
                amount = #{amount,jdbcType=DECIMAL},
            </if>
            <if test="remark != null">
                remark = #{remark,jdbcType=VARCHAR},
            </if>
            <if test="getDepart != null">
                get_depart = #{getDepart,jdbcType=VARCHAR},
            </if>
            <if test="createUser != null">
                create_user = #{createUser,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="isUse != null">
                is_use = #{isUse,jdbcType=INTEGER},
            </if>
            <if test="companyId != null">
                company_id = #{companyId,jdbcType=VARCHAR},
            </if>
        </set>
        where id = #{id,jdbcType=VARCHAR}
    </update>
  <insert id="insert" >
      insert into sys_embedment_record
      <trim prefix="(" suffix=")" suffixOverrides=",">
          <if test="id != null">
              id,
          </if>
          <if test="embedmentId != null">
              embedment_id,
          </if>
          <if test="stockType != null">
              stock_type,
          </if>
          <if test="changeStock != null">
              change_stock,
          </if>
          <if test="supplierId != null">
              supplier_id,
          </if>
          <if test="singlePrice != null">
              single_price,
          </if>
          <if test="amount != null">
              amount,
          </if>
          <if test="remark != null">
              remark,
          </if>
          <if test="getDepart != null">
              get_depart,
          </if>
          <if test="createUser != null">
              create_user,
          </if>
          <if test="createTime != null">
              create_time,
          </if>
          <if test="isUse != null">
              is_use,
          </if>
          <if test="companyId != null">
              company_id,
          </if>
      </trim>
      <trim prefix="values (" suffix=")" suffixOverrides=",">
          <if test="id != null">
              #{id,jdbcType=VARCHAR},
          </if>
          <if test="embedmentId != null">
              #{embedmentId,jdbcType=VARCHAR},
          </if>
          <if test="stockType != null">
              #{stockType,jdbcType=VARCHAR},
          </if>
          <if test="changeStock != null">
              #{changeStock,jdbcType=INTEGER},
          </if>
          <if test="supplierId != null">
              #{supplierId,jdbcType=VARCHAR},
          </if>
          <if test="singlePrice != null">
              #{singlePrice,jdbcType=DECIMAL},
          </if>
          <if test="amount != null">
              #{amount,jdbcType=DECIMAL},
          </if>
          <if test="remark != null">
              #{remark,jdbcType=VARCHAR},
          </if>
          <if test="getDepart != null">
              #{getDepart,jdbcType=VARCHAR},
          </if>
          <if test="createUser != null">
              #{createUser,jdbcType=VARCHAR},
          </if>
          <if test="createTime != null">
              #{createTime,jdbcType=TIMESTAMP},
          </if>
          <if test="isUse != null">
              #{isUse,jdbcType=INTEGER},
          </if>
          <if test="companyId != null">
              #{companyId,jdbcType=VARCHAR},
          </if>
      </trim>
  </insert>
  <select id="embedmentRecordList" resultType="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentRecordEntity">
      select
      ser.id,
      ser.embedment_id as embedmentId,
      ser.stock_type as stockType,
      ser.change_stock as changeStock,
      ser.supplier_id as supplierId,
      ser.single_price as singlePrice,
      ser.amount as amount,
      ser.remark as remark,
      ser.get_depart as getDepart,
      ser.create_user as createUser,
      ser.create_time as createTime,
      ser.is_use as isUse,
      seg.embedment_name as embedmentName,
      seg.embedment_model as embedmentModel,
      sd.depart_name as departName
      from sys_embedment_record ser
      left join  sys_embedment_goods seg  on ser.embedment_id=seg.id
      left join sys_depart sd on  sd.depart_id=ser.get_depart
      where ser.is_use=1 and ser.stock_type=1
      <if test="embedmentName!=null and embedmentName!='' ">
          and seg.embedment_name like concat('%',#{embedmentName},'%')
      </if>
      <if test="embedmentId!=null and embedmentId!='' ">
          and ser.embedment_id=#{embedmentId}
      </if>
      <if test="companyId!=null and companyId!='' ">
          and ser.company_id=#{companyId}
      </if>
      <if test="supplierId!=null and supplierId!='' ">
          and ser.supplier_id=#{supplierId}
      </if>
      <if test="getDepart!=null and getDepart!='' ">
          and sd.depart_name like concat('%',#{getDepart},'%')
      </if>
      <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
          and ser.create_time between  #{strTime} and #{endTime}
      </if>
      order by sar.create_time desc
  </select>
  <select id="embedmentRecordOutList" resultType="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentRecordEntity">
      select
      ser.id,
      ser.embedment_id as embedmentId,
      ser.stock_type as stockType,
      ser.change_stock as changeStock,
      ser.supplier_id as supplierId,
      ser.single_price as singlePrice,
      ser.amount as amount,
      ser.remark as remark,
      ser.get_depart as getDepart,
      ser.create_user as createUser,
      ser.create_time as createTime,
      ser.is_use as isUse,
      seg.embedment_name as embedmentName,
      seg.embedment_model as embedmentModel,
      sd.depart_name as departName
      from sys_embedment_record ser
      left join  sys_embedment_goods seg  on ser.embedment_id=seg.id
      left join sys_depart sd on  sd.depart_id=ser.get_depart
      where ser.is_use=1 and ser.stock_type=2
      <if test="embedmentName!=null and embedmentName!='' ">
          and seg.embedment_name like concat('%',#{embedmentName},'%')
      </if>
      <if test="embedmentId!=null and embedmentId!='' ">
          and ser.embedment_id=#{embedmentId}
      </if>
      <if test="companyId!=null and companyId!='' ">
          and ser.company_id=#{companyId}
      </if>
      <if test="supplierId!=null and supplierId!='' ">
          and ser.supplier_id=#{supplierId}
      </if>
      <if test="getDepart!=null and getDepart!='' ">
          and sd.depart_name like concat('%',#{getDepart},'%')
      </if>
      <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
          and ser.create_time between  #{strTime} and #{endTime}
      </if>
      order by sar.create_time desc
  </select>
  <select id="embedmentRecordInfo" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.embedment.entity.SysEmbedmentRecordEntity">
              select
                      ser.id,
                      ser.embedment_id as embedmentId,
                      ser.stock_type as stockType,
                      ser.change_stock as changeStock,
                      ser.supplier_id as supplierId,
                      ser.single_price as singlePrice,
                      ser.amount as amount,
                      ser.remark as remark,
                      ser.get_depart as getDepart,
                      ser.create_user as createUser,
                      ser.create_time as createTime,
                      ser.is_use as isUse,
                      seg.embedment_name as embedmentName,
                      seg.embedment_model as embedmentModel,
                      sd.depart_name as departName
            from sys_embedment_record ser
           left join  sys_embedment_goods seg  on ser.embedment_id=seg.id
           left join sys_depart sd on  sd.depart_id=ser.get_depart
            where ser.is_use=1 and ser.id=#{id}
  </select>
  <select id="assistIdSelect" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.materials.entity.SysAssistRecord">
        select
         sar.id,
      sar.assist_id as assistId,
      sar.stock_type as stockType,
      sar.change_stock as changeStock,
      sar.supplier_id as supplierId,
      sar.single_price as singlePrice,
      sar.amount as amount,
      sar.remark as remark,
      sar.get_depart as getDepart,
      sar.create_user as createUser,
      sar.create_time as createTime,
      sar.is_use as isUse
         from  sys_assist_record sar where sar.id=#{id}
  </select>
  <update id="embedmentRecordDel" >
    update  sys_embedment_record set
     is_use=2
    where  id=#{id}
  </update>
</mapper>