javababay 2 سال پیش
والد
کامیت
992bd21521

+ 149 - 0
src/main/java/com/steerinfo/ems/tmaintenancefile/controller/TMaintenanceFileController.java

@@ -0,0 +1,149 @@
+package com.steerinfo.ems.tmaintenancefile.controller;
+
+import com.steerinfo.auth.utils.JwtUtil;
+import com.steerinfo.framework.controller.BaseRESTfulController;
+import com.steerinfo.framework.controller.RESTfulResult;
+import com.steerinfo.framework.service.pagehelper.PageList;
+import com.steerinfo.framework.utils.collection.ListUtils;
+import com.steerinfo.ems.tmaintenancefile.model.TMaintenanceFile;
+import com.steerinfo.ems.tmaintenancefile.service.ITMaintenanceFileService;
+import com.steerinfo.ftp.securitytype.model.SecurityType;
+import com.steerinfo.ftp.uploadfile.model.UploadFile;
+import com.steerinfo.ftp.uploadfile.utils.FtpFileUtil;
+import com.steerinfo.ftp.uploadfile.utils.IDutils;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.math.BigDecimal;
+
+/**
+ * TMaintenanceFile RESTful接口:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2022-06-06 02:51
+ * 类描述
+ * 修订历史:
+ * 日期:2022-06-06
+ * 作者:generator
+ * 参考:
+ * 描述:TMaintenanceFile RESTful接口
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+@RestController
+    @RequestMapping("/${api.version}/tmaintenancefiles")
+public class TMaintenanceFileController extends BaseRESTfulController {
+    @Autowired
+    private FtpFileUtil ftpFileUtil;
+    @Autowired
+    ITMaintenanceFileService tMaintenanceFileService;
+
+    @ApiOperation(value="获取列表", notes="分页查询")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
+    })
+    //@RequiresPermissions("tmaintenancefile:view")
+    @GetMapping(value = "/")
+    public RESTfulResult list(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
+        PageList<TMaintenanceFile> list = tMaintenanceFileService.queryForPage(parmas, pageNum, pageSize);
+        return success(list);
+    }
+
+    @ApiOperation(value="获取列表", notes="分页模糊查询")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer")
+    })
+    //@RequiresPermissions("tmaintenancefile:view")
+    @GetMapping(value = "/like/")
+    public RESTfulResult listLike(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
+        PageList<TMaintenanceFile> list = tMaintenanceFileService.queryLikeForPage(parmas, pageNum, pageSize);
+        return success(list);
+    }
+    
+    @ApiOperation(value="创建", notes="根据TMaintenanceFile对象创建")
+    @ApiImplicitParam(name = "tMaintenanceFile", value = "详细实体tMaintenanceFile", required = true, dataType = "TMaintenanceFile")
+    //@RequiresPermissions("tmaintenancefile:create")
+    @PostMapping(value = "/")
+    public RESTfulResult add(@ModelAttribute TMaintenanceFile model){
+        TMaintenanceFile tMaintenanceFile = tMaintenanceFileService.add(model);
+        return success(tMaintenanceFile);
+    }
+
+    @ApiOperation(value="获取详细信息", notes="根据url的id来获取详细信息")
+    @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
+    //@RequiresPermissions("tmaintenancefile:view")
+    @GetMapping(value = "/{id}")
+    public RESTfulResult get(@PathVariable String id){
+        TMaintenanceFile tMaintenanceFile = tMaintenanceFileService.getById(id);
+        return success(tMaintenanceFile);
+    }
+
+    @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的tMaintenanceFile信息来更新详细信息")
+    @ApiImplicitParams({
+        @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String"),
+        @ApiImplicitParam(name = "tMaintenanceFile", value = "详细实体tMaintenanceFile", required = true, dataType = "TMaintenanceFile")
+    })
+    //@RequiresPermissions("tmaintenancefile:update")
+    @PutMapping(value = "/{id}", produces  = "application/json;charset=UTF-8")
+    public RESTfulResult update(@PathVariable String id, @RequestBody TMaintenanceFile model){
+        model.setId(id);
+        TMaintenanceFile tMaintenanceFile = tMaintenanceFileService.modify(model);
+        return success(tMaintenanceFile);
+    }
+
+    @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
+    @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
+    //@RequiresPermissions("tmaintenancefile:delete")
+    @DeleteMapping(value = "/{id}")//String
+    public RESTfulResult delete(@PathVariable String id){
+    	List<String> list = Arrays.asList(id.split(","));
+    	if(ListUtils.isNotEmpty(list)) {
+	    	List<String> ids = ListUtils.convertList(list);
+			  tMaintenanceFileService.delete(ids);
+    	}
+      return success();
+    }
+
+    @PostMapping("/file")
+    public RESTfulResult fileUpload(@ModelAttribute MultipartFile[] files){
+        String filesid = "";
+        for (int i = 0; i < files.length; i++) {
+            try {
+                String userId = JwtUtil.getUseridByToken();
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("/yyyy/MM/dd");
+                String oldName = files[i].getOriginalFilename();
+                String newName = IDutils.getImageName();
+                newName = newName + oldName.substring(oldName.lastIndexOf("."));
+                String filePath = simpleDateFormat.format(new Date());
+                InputStream inputStream = files[i].getInputStream();
+                boolean result = ftpFileUtil.uploadToFtp(inputStream, filePath, newName, false);
+                inputStream.close();
+                if (result) {
+                    TMaintenanceFile uploadFile = new TMaintenanceFile();
+                    uploadFile.setFilename(oldName);
+                    uploadFile.setFilepath(filePath + "/" + newName);
+                    TMaintenanceFile model = tMaintenanceFileService.add(uploadFile);
+                    if (model != null) {
+                        filesid += "," + model.getId();
+                    }
+                } else {
+                    return failed(null, "上传文件失败");
+                }
+            } catch (Exception e) {
+                e.getMessage();
+            }
+        }
+
+            return success(filesid);
+    }
+}

+ 10 - 0
src/main/java/com/steerinfo/ems/tmaintenancefile/mapper/TMaintenanceFileMapper.java

@@ -0,0 +1,10 @@
+package com.steerinfo.ems.tmaintenancefile.mapper;
+
+import com.steerinfo.ems.tmaintenancefile.model.TMaintenanceFile;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import java.math.*;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface TMaintenanceFileMapper extends IBaseMapper<TMaintenanceFile, String> {
+}

+ 162 - 0
src/main/java/com/steerinfo/ems/tmaintenancefile/mapper/TMaintenanceFileMapper.xml

@@ -0,0 +1,162 @@
+<?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.steerinfo.ems.tmaintenancefile.mapper.TMaintenanceFileMapper">
+  <resultMap id="BaseResultMap" type="com.steerinfo.ems.tmaintenancefile.model.TMaintenanceFile">
+    <id column="ID" jdbcType="VARCHAR" property="id" />
+    <result column="FILENAME" jdbcType="VARCHAR" property="filename" />
+    <result column="FILEPATH" jdbcType="VARCHAR" property="filepath" />
+  </resultMap>
+  <sql id="columns">
+    ID, FILENAME, FILEPATH
+  </sql>
+  <sql id="columns_alias">
+    t.ID, t.FILENAME, t.FILEPATH
+  </sql>
+  <sql id="select">
+    SELECT <include refid="columns"/> FROM T_MAINTENANCE_FILE
+  </sql>
+  <sql id="select_alias">
+    SELECT <include refid="columns_alias"/> FROM T_MAINTENANCE_FILE t
+  </sql>
+  <sql id="where">
+    <where> 
+      <if test="id != null and id != ''">
+        and ID = #{id}
+      </if>
+      <if test="filename != null and filename != ''">
+        and FILENAME = #{filename}
+      </if>
+      <if test="filepath != null and filepath != ''">
+        and FILEPATH = #{filepath}
+      </if>
+    </where>
+  </sql>
+  <sql id="whereLike">
+    <where> 
+      <if test="id != null and id != ''">
+        and ID LIKE '%${id}%'
+      </if>
+      <if test="filename != null and filename != ''">
+        and FILENAME LIKE '%${filename}%'
+      </if>
+      <if test="filepath != null and filepath != ''">
+        and FILEPATH LIKE '%${filepath}%'
+      </if>
+    </where>
+  </sql>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from T_MAINTENANCE_FILE
+    where ID = #{id,jdbcType=VARCHAR}
+  </delete>
+  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+    delete from T_MAINTENANCE_FILE
+    where 1!=1 
+      <if test="filename != null and filename != ''">
+        or FILENAME = #{filename}
+      </if>
+      <if test="filepath != null and filepath != ''">
+        or FILEPATH = #{filepath}
+      </if>
+  </delete>
+  <insert id="insert" parameterType="com.steerinfo.ems.tmaintenancefile.model.TMaintenanceFile">
+    insert into T_MAINTENANCE_FILE (ID, FILENAME, FILEPATH
+      )
+    values (#{id,jdbcType=VARCHAR}, #{filename,jdbcType=VARCHAR}, #{filepath,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.steerinfo.ems.tmaintenancefile.model.TMaintenanceFile">
+    insert into T_MAINTENANCE_FILE
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        ID,
+      </if>
+      <if test="filename != null">
+        FILENAME,
+      </if>
+      <if test="filepath != null">
+        FILEPATH,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="filename != null">
+        #{filename,jdbcType=VARCHAR},
+      </if>
+      <if test="filepath != null">
+        #{filepath,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.tmaintenancefile.model.TMaintenanceFile">
+    update T_MAINTENANCE_FILE
+    set FILENAME = #{filename,jdbcType=VARCHAR},
+      FILEPATH = #{filepath,jdbcType=VARCHAR}
+    where ID = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.tmaintenancefile.model.TMaintenanceFile">
+    update T_MAINTENANCE_FILE
+    <set>
+      <if test="filename != null">
+        FILENAME = #{filename,jdbcType=VARCHAR},
+      </if>
+      <if test="filepath != null">
+        FILEPATH = #{filepath,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where ID = #{id,jdbcType=VARCHAR}
+  </update>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    <include refid="select"/>
+    where ID = #{id,jdbcType=VARCHAR}
+  </select>
+  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select"/>
+    <include refid="where"/>
+  </select>
+  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select"/>
+    <include refid="whereLike"/>
+  </select>
+  <insert id="batchInsert" parameterType="java.util.List">
+    insert into T_MAINTENANCE_FILE 
+      (ID, 
+      FILENAME, FILEPATH)
+    ( <foreach collection="list" item="item" separator="union all"> 
+   select  
+      #{item.id,jdbcType=VARCHAR}, 
+      #{item.filename,jdbcType=VARCHAR}, #{item.filepath,jdbcType=VARCHAR} from dual  
+   </foreach> )
+  </insert>
+  <update id="batchUpdate" parameterType="java.util.List">
+     update T_MAINTENANCE_FILE
+     set
+       ID=
+       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
+          when #{item.id,jdbcType=VARCHAR} then #{item.id,jdbcType=VARCHAR}
+       </foreach>
+       ,FILENAME=
+       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
+          when #{item.id,jdbcType=VARCHAR} then #{item.filename,jdbcType=VARCHAR}
+       </foreach>
+       ,FILEPATH=
+       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
+          when #{item.id,jdbcType=VARCHAR} then #{item.filepath,jdbcType=VARCHAR}
+       </foreach>
+     where ID in 
+     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+    #{item.id,jdbcType=VARCHAR}
+     </foreach> 
+  </update>
+  <delete id="batchDelete" parameterType="java.util.List">
+    delete from T_MAINTENANCE_FILE
+    where ID in 
+    <foreach collection="list" item="id" open="(" close=")" separator=",">
+      #{id}
+    </foreach>
+  </delete>
+  <!-- 友情提示!!!-->
+  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+  
+</mapper>

+ 66 - 0
src/main/java/com/steerinfo/ems/tmaintenancefile/model/TMaintenanceFile.java

@@ -0,0 +1,66 @@
+package com.steerinfo.ems.tmaintenancefile.model;
+
+import com.steerinfo.framework.model.IBasePO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel(value="null")
+public class TMaintenanceFile implements IBasePO<String> {
+    /**
+     * 文件ID(ID,VARCHAR,255)
+     */
+    @ApiModelProperty(value="文件ID",required=true)
+    private String id;
+
+    /**
+     * 文件名(FILENAME,VARCHAR,255)
+     */
+    @ApiModelProperty(value="文件名",required=false)
+    private String filename;
+
+    /**
+     * 文件路径(FILEPATH,VARCHAR,255)
+     */
+    @ApiModelProperty(value="文件路径",required=false)
+    private String filepath;
+
+    private static final long serialVersionUID = 1L;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id == null ? null : id.trim();
+    }
+
+    public String getFilename() {
+        return filename;
+    }
+
+    public void setFilename(String filename) {
+        this.filename = filename == null ? null : filename.trim();
+    }
+
+    public String getFilepath() {
+        return filepath;
+    }
+
+    public void setFilepath(String filepath) {
+        this.filepath = filepath == null ? null : filepath.trim();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", filename=").append(filename);
+        sb.append(", filepath=").append(filepath);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 23 - 0
src/main/java/com/steerinfo/ems/tmaintenancefile/service/ITMaintenanceFileService.java

@@ -0,0 +1,23 @@
+package com.steerinfo.ems.tmaintenancefile.service;
+
+import com.steerinfo.framework.service.IBaseService;
+import com.steerinfo.ems.tmaintenancefile.model.TMaintenanceFile;
+import java.util.Date;
+import java.math.BigDecimal;
+
+/**
+ * TMaintenanceFile服务接口:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2022-06-06 02:51
+ * 类描述
+ * 修订历史:
+ * 日期:2022-06-06
+ * 作者:generator
+ * 参考:
+ * 描述:TMaintenanceFile服务接口
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+public interface ITMaintenanceFileService extends IBaseService<TMaintenanceFile, String>{
+
+}

+ 36 - 0
src/main/java/com/steerinfo/ems/tmaintenancefile/service/impl/TMaintenanceFileServiceImpl.java

@@ -0,0 +1,36 @@
+package com.steerinfo.ems.tmaintenancefile.service.impl;
+
+import com.steerinfo.framework.mapper.IBaseMapper;
+import com.steerinfo.framework.service.impl.BaseServiceImpl;
+import com.steerinfo.ems.tmaintenancefile.model.TMaintenanceFile;
+import com.steerinfo.ems.tmaintenancefile.mapper.TMaintenanceFileMapper;
+import com.steerinfo.ems.tmaintenancefile.service.ITMaintenanceFileService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.Date;
+import java.math.BigDecimal;
+
+/**
+ * TMaintenanceFile服务实现:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2022-06-06 02:51
+ * 类描述
+ * 修订历史:
+ * 日期:2022-06-06
+ * 作者:generator
+ * 参考:
+ * 描述:TMaintenanceFile服务实现
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+@Service(value = "tMaintenanceFileService")
+public class TMaintenanceFileServiceImpl extends BaseServiceImpl<TMaintenanceFile, String> implements ITMaintenanceFileService {
+
+    @Autowired
+    private TMaintenanceFileMapper tMaintenanceFileMapper;
+
+    @Override
+    protected IBaseMapper<TMaintenanceFile, String> getMapper() {
+        return tMaintenanceFileMapper;
+    }
+}

+ 6 - 6
src/main/java/com/steerinfo/ems/tprocessinfor/controller/TProcessinforController.java

@@ -107,7 +107,7 @@ public class TProcessinforController extends BaseRESTfulController {
     }
 
 
-    @ApiOperation(value="获取树状数据", notes="获取TRmWorkproc的树形数据")
+    @ApiOperation(value="获取树状数据", notes="获取TProcessinfor的树形数据")
     @GetMapping(value = "/gettree/")
     public RESTfulResult getTree(@RequestParam HashMap parameters){
         TreeUtils treeUtils = new TreeUtils();
@@ -141,7 +141,7 @@ public class TProcessinforController extends BaseRESTfulController {
     }
 
     @ApiOperation(value="批量更新详细信息", notes="根据传过来的tRmWorkproc数组信息来更新详细信息")
-    @ApiImplicitParam(name = "tRmWorkproc", value = "详细实体tRmWorkproc", required = true, dataType = "TRmWorkproc")
+    @ApiImplicitParam(name = "tProcessinfor", value = "详细实体tProcessinfor", required = true, dataType = "TProcessinfor")
     //@RequiresPermissions("trmworkproc:update")
     @PutMapping(value = "/", produces  = "application/json;charset=UTF-8")
     public RESTfulResult batchupdate(@RequestBody TProcessinfor[] model){
@@ -190,7 +190,7 @@ public class TProcessinforController extends BaseRESTfulController {
     @ApiOperation(value="更新详细信息", notes="根据url的id来指定更新对象,并根据传过来的tRmWorkproc信息来更新详细信息")
     @ApiImplicitParams({
             @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String"),
-            @ApiImplicitParam(name = "tRmWorkproc", value = "详细实体tRmWorkproc", required = true, dataType = "TRmWorkproc")
+            @ApiImplicitParam(name = "tProcessinfor", value = "详细实体tProcessinfor", required = true, dataType = "tProcessinfor")
     })
     //@RequiresPermissions("trmworkproc:update")
     @PutMapping(value = "/{id}", produces  = "application/json;charset=UTF-8")
@@ -200,8 +200,8 @@ public class TProcessinforController extends BaseRESTfulController {
         }
         LOGGER.info("工序维护表修改前数据是" + tProcessinforService.getById(id).toString());
         model.setId(id);
-        TProcessinfor tRmWorkproc = tProcessinforService.modify(model);
-        LOGGER.info("工序维护表修改后数据是" + tRmWorkproc.toString());
-        return success(tRmWorkproc);
+        TProcessinfor tProcessinfor = tProcessinforService.modify(model);
+        LOGGER.info("工序维护表修改后数据是" + tProcessinfor.toString());
+        return success(tProcessinfor);
     }
 }