Browse Source

文档列表

5 năm trước cách đây
mục cha
commit
0e7351cfc4

+ 0 - 1
.idea/modules.xml

@@ -2,7 +2,6 @@
 <project version="4">
   <component name="ProjectModuleManager">
     <modules>
-      <module fileurl="file://$PROJECT_DIR$/cloud-model/cloud-model.iml" filepath="$PROJECT_DIR$/cloud-model/cloud-model.iml" />
       <module fileurl="file://$PROJECT_DIR$/cloud-model/cloud-model.iml" filepath="$PROJECT_DIR$/cloud-model/cloud-model.iml" />
       <module fileurl="file://$PROJECT_DIR$/.idea/yunsu.iml" filepath="$PROJECT_DIR$/.idea/yunsu.iml" />
     </modules>

+ 1 - 0
cloud-model/dabao.cmd

@@ -0,0 +1 @@
+mvn clean package -Dmaven.test.skip=true

+ 18 - 0
cloud-model/pom.xml

@@ -90,6 +90,24 @@
             <version>3.8.1</version>
         </dependency>
 
+        <!--读取excel文件-->
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+            <version>3.17</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>3.17</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
+        <!--<dependency>-->
+            <!--<groupId>org.apache.poi</groupId>-->
+            <!--<artifactId>poi</artifactId>-->
+            <!--<version>4.0.1</version>-->
+        <!--</dependency>-->
+
     </dependencies>
 
     <build>

+ 1 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/controller/MouldFileController.java

@@ -53,6 +53,7 @@ public class MouldFileController {
      * 参数: token 用户身份凭证,
      * mouldId 模具id ,
      * blongType 文档类型(0-模具文档 1-零件文档 2-试模验收 2-保养方案 3-模具更新 4-模具报废),
+     * 注:blongType 为 1 时需要多传  partId 零件id
      * file 文件信息,dwgType 图档类型0-2D,1-3D(上传零件文档和模具文档时传该参数)
      *
      * @return

+ 60 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/controller/PartController.java

@@ -0,0 +1,60 @@
+package com.hssx.cloudmodel.controller;
+
+
+import com.hssx.cloudmodel.entity.vo.UserVO;
+import com.hssx.cloudmodel.service.PartService;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+import io.swagger.annotations.ApiOperation;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author 吴涛涛
+ * @since 2019-08-13
+ */
+@Controller
+@RequestMapping("/part")
+public class PartController {
+
+    @Autowired
+    PartService partService;
+
+    /**
+     * 零件 Excel 导入
+     *  file excel文件 token 用户身份凭证 mouldId 模具id
+     * @param file
+     * @throws Exception
+     */
+    @ApiOperation("公司列表")
+    @RequestMapping(value = "/importAppLogin")
+    @ResponseBody
+    public HttpRespMsg importAppLogin(
+            @RequestParam(value = "file", required = false) MultipartFile file,
+            UserVO userVO) {
+        HttpRespMsg msg = new HttpRespMsg();
+           msg =  partService.importPartExcel(file,userVO);
+           return msg;
+    }
+}
+

+ 16 - 4
cloud-model/src/main/java/com/hssx/cloudmodel/entity/MouldFile.java

@@ -6,8 +6,6 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
-import com.fasterxml.jackson.annotation.JsonFormat;
-
 import java.io.Serializable;
 
 /**
@@ -16,7 +14,7 @@ import java.io.Serializable;
  * </p>
  *
  * @author 吴涛涛
- * @since 2019-08-10
+ * @since 2019-08-13
  */
 @TableName("tb_mould_file")
 public class MouldFile extends Model<MouldFile> {
@@ -45,7 +43,6 @@ public class MouldFile extends Model<MouldFile> {
      * 上传时间
      */
     @TableField("indate")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime indate;
 
     /**
@@ -138,6 +135,12 @@ public class MouldFile extends Model<MouldFile> {
     @TableField("dwg_type")
     private Integer dwgType;
 
+    /**
+     * 零件id(只对零件文档有效)
+     */
+    @TableField("part_id")
+    private Integer partId;
+
 
     public Integer getId() {
         return id;
@@ -291,6 +294,14 @@ public class MouldFile extends Model<MouldFile> {
         this.dwgType = dwgType;
     }
 
+    public Integer getPartId() {
+        return partId;
+    }
+
+    public void setPartId(Integer partId) {
+        this.partId = partId;
+    }
+
     @Override
     protected Serializable pkVal() {
         return this.id;
@@ -318,6 +329,7 @@ public class MouldFile extends Model<MouldFile> {
         ", fileType2=" + fileType2 +
         ", fileSize2=" + fileSize2 +
         ", dwgType=" + dwgType +
+        ", partId=" + partId +
         "}";
     }
 }

+ 155 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/Part.java

@@ -0,0 +1,155 @@
+package com.hssx.cloudmodel.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-13
+ */
+@TableName("tb_part")
+public class Part extends Model<Part> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 零件表主键
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 零件编号
+     */
+    @TableField("part_no")
+    private String partNo;
+
+    /**
+     * 零件名称
+     */
+    @TableField("part_name")
+    private String partName;
+
+    /**
+     * 添加的时间
+     */
+    @TableField("indate")
+    private LocalDateTime indate;
+
+    /**
+     * 零件寿命 单位:年
+     */
+    @TableField("part_life")
+    private Integer partLife;
+
+    /**
+     * 是否为易损件0-否,1-是
+     */
+    @TableField("is_vulnerable")
+    private Integer isVulnerable;
+
+    /**
+     * 上传人id
+     */
+    @TableField("creator_id")
+    private Integer creatorId;
+
+    /**
+     * 上传人名字
+     */
+    @TableField("creator")
+    private String creator;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getPartNo() {
+        return partNo;
+    }
+
+    public void setPartNo(String partNo) {
+        this.partNo = partNo;
+    }
+
+    public String getPartName() {
+        return partName;
+    }
+
+    public void setPartName(String partName) {
+        this.partName = partName;
+    }
+
+    public LocalDateTime getIndate() {
+        return indate;
+    }
+
+    public void setIndate(LocalDateTime indate) {
+        this.indate = indate;
+    }
+
+    public Integer getPartLife() {
+        return partLife;
+    }
+
+    public void setPartLife(Integer partLife) {
+        this.partLife = partLife;
+    }
+
+    public Integer getIsVulnerable() {
+        return isVulnerable;
+    }
+
+    public void setIsVulnerable(Integer isVulnerable) {
+        this.isVulnerable = isVulnerable;
+    }
+
+    public Integer getCreatorId() {
+        return creatorId;
+    }
+
+    public void setCreatorId(Integer creatorId) {
+        this.creatorId = creatorId;
+    }
+
+    public String getCreator() {
+        return creator;
+    }
+
+    public void setCreator(String creator) {
+        this.creator = creator;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+    @Override
+    public String toString() {
+        return "Part{" +
+        "id=" + id +
+        ", partNo=" + partNo +
+        ", partName=" + partName +
+        ", indate=" + indate +
+        ", partLife=" + partLife +
+        ", isVulnerable=" + isVulnerable +
+        ", creatorId=" + creatorId +
+        ", creator=" + creator +
+        "}";
+    }
+}

+ 1 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/entity/vo/UserVO.java

@@ -24,6 +24,7 @@ public class UserVO extends User {
     private String powers;
     private Integer mouldId;//模具id
     private String ids;//模具ids
+    private Integer partId;//零件id
     /**
      * 图档类型0-2D,1-3D
      */

+ 16 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/mapper/PartMapper.java

@@ -0,0 +1,16 @@
+package com.hssx.cloudmodel.mapper;
+
+import com.hssx.cloudmodel.entity.Part;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-13
+ */
+public interface PartMapper extends BaseMapper<Part> {
+
+}

+ 22 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/PartService.java

@@ -0,0 +1,22 @@
+package com.hssx.cloudmodel.service;
+
+import com.hssx.cloudmodel.entity.Part;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.hssx.cloudmodel.entity.vo.UserVO;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-13
+ */
+public interface PartService extends IService<Part> {
+
+    HttpRespMsg importPartExcel(MultipartFile file, UserVO userVO);
+}

+ 4 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java

@@ -131,6 +131,10 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                             projectFile = null;
                         }
                     }
+                    //零件文档时存上零件id
+                    if(blongType == 1 && null != userVO.getPartId()){
+                        projectFile.setPartId(userVO.getPartId());
+                    }
                     //上传零件文档和上传模具文档的时候需要区分是否为2D或者3D
                     if (userVO.getDwgType() != null) {
                         projectFile.setDwgType(userVO.getDwgType());

+ 137 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/PartServiceImpl.java

@@ -0,0 +1,137 @@
+package com.hssx.cloudmodel.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.hssx.cloudmodel.entity.Mould;
+import com.hssx.cloudmodel.entity.Part;
+import com.hssx.cloudmodel.entity.User;
+import com.hssx.cloudmodel.entity.vo.UserVO;
+import com.hssx.cloudmodel.mapper.MouldMapper;
+import com.hssx.cloudmodel.mapper.PartMapper;
+import com.hssx.cloudmodel.mapper.UserMapper;
+import com.hssx.cloudmodel.service.PartService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-08-13
+ */
+@Service
+public class PartServiceImpl extends ServiceImpl<PartMapper, Part> implements PartService {
+    @Resource
+    PartMapper partMapper;
+    @Resource
+    UserMapper userMapper;
+    @Resource
+    MouldMapper mouldMapper;
+    @Override
+    public HttpRespMsg importPartExcel(MultipartFile file, UserVO userVO) {
+        HttpRespMsg msg = new HttpRespMsg();
+        User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
+        if(user != null){
+            try {
+                File f = null;
+                if ("".equals(file) || file.getSize() <= 0) {
+                    file = null;
+                } else {
+                    //获取输入流
+                    InputStream ins = file.getInputStream();
+                    //新建一个文件
+                    f = new File(file.getOriginalFilename());
+                    //输入流转file
+                    inputStreamToFile(ins, f);
+                }
+                Mould mould = mouldMapper.selectById(userVO.getMouldId());
+                //根据文件创建工作簿
+                XSSFWorkbook wookbook = new XSSFWorkbook(f);
+                XSSFSheet sheet = wookbook.getSheetAt(0);
+                int s = sheet.getLastRowNum();
+                // 遍历当前sheet中的所有行,第一行是数据对应的字段,不是数据,
+                // 故从第二行开始遍历拿数据(如果有标题的话,则从第三行开始拿数据)
+                for (int j = 1; j < sheet.getLastRowNum() + 1; j++) {
+                    XSSFRow row = sheet.getRow(j);
+                    //新建零件
+                    Part part = new Part();
+                    // 遍历所有的列,下面的10是excle表格里共有10列即对应了10个字段
+                    for (int y = 0; y < 2; y++) {
+                        XSSFCell cell = row.getCell(y);
+                        cell.setCellType(Cell.CELL_TYPE_STRING);
+                        //取出当前列的值
+                        String value = cell.getStringCellValue();
+                        //判断第几列插入数据,后面就是从列中取数据往对象里放,然后插入到数据库里
+                        if (value == null && "".equals(value)) {
+                            log.error("数据不可为空");
+                            msg.setError("数据不可为空");
+                            return msg;
+                        } else if (y == 0) {
+                            //零件编号
+                            part.setPartNo(value);
+                        } else if (y == 1) {
+                            //零件名称
+                            part.setPartName(value);
+                        } else if (y == 2) {
+                            //零件寿命
+                            part.setPartLife(Integer.parseInt(value));
+                            if(Integer.parseInt(value)<mould.getSettingLife()){
+                                part.setIsVulnerable(1);
+                            }
+                        }
+                    }
+                    part.setCreatorId(user.getId());
+                    part.setCreator(user.getUsername());
+                    partMapper.insert(part);
+                }
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                msg.setError(e.getMessage());
+                return msg;
+            }
+        }else{
+            msg.setError("用户不存在或者未登录");
+        }
+        return msg;
+    }
+    /**
+     * 输入流转file
+     *
+     * @param ins
+     * @param file
+     */
+    public static void inputStreamToFile(InputStream ins, File file) {
+        try {
+            OutputStream os = new FileOutputStream(file);
+            int bytesRead = 0;
+            byte[] buffer = new byte[8192];
+            while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
+                os.write(buffer, 0, bytesRead);
+            }
+            os.close();
+            ins.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/util/CodeGenerator.java

@@ -204,7 +204,7 @@ public class CodeGenerator {
         //若想要生成的实体类继承某个Controller,则可打开下面注释。写上需要继承的Controller的位置即可
 //        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
         //此处user是表名,多个英文逗号分割
-        strategy.setInclude("tb_mould_maintain");
+        strategy.setInclude("tb_part");
 //        strategy.setExclude();//数据库表全生成
 //        strategy.setInclude(scanner("user").split(","));//表名,多个英文逗号分割
         strategy.setControllerMappingHyphenStyle(true);

+ 45 - 3
cloud-model/src/main/java/com/hssx/cloudmodel/util/MD5Util.java

@@ -23,8 +23,50 @@ public class MD5Util {
     }
 
     public static void main(String[] args) {
-        String password = "000000";
-        System.out.println(MD5Util.getPassword(password));
-        System.out.println(UUID.randomUUID().toString().replaceAll("-", ""));;
+//        String password = "000000";
+//        System.out.println(MD5Util.getPassword(password));
+//        System.out.println(UUID.randomUUID().toString().replaceAll("-", ""));;
+        //需要压缩的文件--包括文件地址和文件名
+        String [] path ={"D:\\666\\1.jpg","D:\\666\\MouldFileMapper.xml"};
+        // 要生成的压缩文件地址和文件名称
+        String desPath = "D:\\666\\new.zip";
+        File zipFile = new File(desPath);
+        ZipOutputStream zipStream = null;
+        FileInputStream zipSource = null;
+        BufferedInputStream bufferStream = null;
+        try {
+            //构造最终压缩包的输出流
+            zipStream = new ZipOutputStream(new FileOutputStream(zipFile));
+            for(int i =1;i<path.length;i++){
+                File file = new File(path[i]);
+                //将需要压缩的文件格式化为输入流
+                zipSource = new FileInputStream(file);
+                //压缩条目不是具体独立的文件,而是压缩包文件列表中的列表项,称为条目,就像索引一样
+                ZipEntry zipEntry = new ZipEntry("2222.jpg");
+                //定位该压缩条目位置,开始写入文件到压缩包中
+                zipStream.putNextEntry(zipEntry);
+                //输入缓冲流
+                bufferStream = new BufferedInputStream(zipSource, 1024 * 10);
+                int read = 0;
+                //创建读写缓冲区
+                byte[] buf = new byte[1024 * 10];
+                while((read = bufferStream.read(buf, 0, 1024 * 10)) != -1)
+                {
+                    zipStream.write(buf, 0, read);
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            //关闭流
+            try {
+                if(null != bufferStream) bufferStream.close();
+                if(null != zipStream) zipStream.close();
+                if(null != zipSource) zipSource.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
     }
 }

+ 51 - 0
cloud-model/src/main/resources/application-prod.properties

@@ -0,0 +1,51 @@
+# ####################################################################################################
+# 服务端配置
+server.port=9099
+server.servlet.context-path=/
+server.tomcat.uri-encoding=UTF-8
+# ####################################################################################################
+# thymeleaf 配置
+spring.thymeleaf.cache=false
+spring.thymeleaf.jackson.time-zone=GMT+8
+spring.thymeleaf.jackson.date-format=yyyy-MM-dd HH:mm:ss
+# ####################################################################################################
+# 数据源配置
+spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
+spring.datasource.url=jdbc:mysql://118.190.47.230:3306/cloud_model?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+spring.datasource.username=root
+spring.datasource.password=p011430seya10
+#spring.datasource.druid.test-on-borrow=true
+#spring.datasource.druid.test-while-idle=true
+# ####################################################################################################
+# MyBatis 配置
+mybatis.mapper-locations=mappers/*Mapper.xml
+mybatis.type-aliases-package=com.hssx.cloudmodel.entity/*
+# 控制台输出SQL语句
+logging.level.com.hssx.cloudmodel.mapper = debug
+# ####################################################################################################
+#配置Session
+spring.session.store-type=none
+# ####################################################################################################
+#成功页面跳转
+spring.thymeleaf.prefix=classpath:/static/
+######################################################################################################
+## redis 配置
+#spring.redis.host=localhost
+#spring.redis.port=6379
+######################################################################################################
+# 文件上传路径
+upload.path=E:/staticproject/cloudmodel
+######################################################################################################
+# 文件上传路径
+download.path=D:/mould/download/
+#######################################################################################################
+# 配置上传文件的大小设置
+# Single file max size  即单个文件大小
+spring.servlet.multipart.max-file-size=10MB
+spring.servlet.multipart.max-request-size=100MB
+##################SpringBoot连接池配置########
+spring.datasource.hikari.minimum-idle=3
+spring.datasource.hikari.maximum-pool-size=10
+spring.datasource.hikari.max-lifetime =30000
+spring.datasource.hikari.connection-test-query=SELECT 1
+

+ 30 - 0
cloud-model/src/main/resources/application-prod.yml

@@ -0,0 +1,30 @@
+
+##########
+logging:
+  level:
+    root: info
+    org.mybatis: debug
+    java.sql: debug
+    org.springframework.web: trace
+    #打印sql语句
+    com.example.plus.mapper: debug
+##########
+mybatis-plus:
+#  mapper-locations: classpath:mapper/*/*.xml
+#  #实体扫描,多个package用逗号或者分号分隔
+#  typeAliasesPackage: com.hssx.cloudmodel
+  global-config:
+    #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+    id-type: 0
+    #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+    field-strategy: 2
+    db-column-underline: true
+    refresh-mapper:
+#################插入和更新非null判断
+    db-config:
+      insert-strategy: not_null
+      update-strategy: not_null
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+

+ 12 - 8
cloud-model/src/main/resources/mapper/MouldFileMapper.xml

@@ -23,7 +23,9 @@
         <result column="file_type_2" property="fileType2" />
         <result column="file_size_2" property="fileSize2" />
         <result column="dwg_type" property="dwgType" />
+        <result column="part_id" property="partId" />
     </resultMap>
+
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMapVO" type="com.hssx.cloudmodel.entity.vo.MouldFileVO">
         <id column="id" property="id" />
@@ -68,19 +70,19 @@
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, uplodtor_id, uploadtor, indate, model_id, sparepart_id, project_id, file_url, file_name, blong_type, content, state, file_type, file_size, file_url_2, file_name_2, file_type_2, file_size_2, dwg_type
+        id, uplodtor_id, uploadtor, indate, model_id, sparepart_id, project_id, file_url, file_name, blong_type, content, state, file_type, file_size, file_url_2, file_name_2, file_type_2, file_size_2, dwg_type,part_id
     </sql>
 
     <select id="getFileListByProjectId" resultMap="BaseResultMapVO">
         select
-            id,model_no,model_name
+        id,model_no,model_name
         from
-            tb_mould
+        tb_mould
         <where>
             project_id in
-        <foreach collection="list" index="index" open="(" item="item" close=")" separator=",">
-            #{item}
-        </foreach>
+            <foreach collection="list" index="index" open="(" item="item" close=")" separator=",">
+                #{item}
+            </foreach>
             <if test="userVO.keyName != null and userVO.keyName != ''">
                 and model_name like concat('%',#{userVO.keyName},'%')
             </if>
@@ -88,9 +90,9 @@
     </select>
     <select id="getFileListByMouldId" resultMap="BaseResultMapApprovedVO">
         select
-            id,model_no,model_name
+        id,model_no,model_name
         from
-            tb_mould
+        tb_mould
         <where>
             id  = #{id}
         </where>
@@ -225,4 +227,6 @@
         and
             state = 3
     </select>
+
+
 </mapper>

+ 22 - 0
cloud-model/src/main/resources/mapper/PartMapper.xml

@@ -0,0 +1,22 @@
+<?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.hssx.cloudmodel.mapper.PartMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.Part">
+        <id column="id" property="id" />
+        <result column="part_no" property="partNo" />
+        <result column="part_name" property="partName" />
+        <result column="indate" property="indate" />
+        <result column="part_life" property="partLife" />
+        <result column="is_vulnerable" property="isVulnerable" />
+        <result column="creator_id" property="creatorId" />
+        <result column="creator" property="creator" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, part_no, part_name, indate, part_life, is_vulnerable, creator_id, creator
+    </sql>
+
+</mapper>