Bladeren bron

数据下载

wanggaokun 1 jaar geleden
bovenliggende
commit
7c7c75ee00

+ 104 - 0
PHM-admin/phm-manage/src/main/java/com/phm/manage/controller/DataDownResultController.java

@@ -0,0 +1,104 @@
+package com.phm.manage.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.phm.common.annotation.Log;
+import com.phm.common.core.controller.BaseController;
+import com.phm.common.core.domain.AjaxResult;
+import com.phm.common.enums.BusinessType;
+import com.phm.manage.domain.DataDownResult;
+import com.phm.manage.service.IDataDownResultService;
+import com.phm.common.utils.poi.ExcelUtil;
+import com.phm.common.core.page.TableDataInfo;
+
+/**
+ * 数据下载Controller
+ * 
+ * @author phm
+ * @date 2023-08-24
+ */
+@RestController
+@RequestMapping("/manage/dataDown")
+public class DataDownResultController extends BaseController
+{
+    @Autowired
+    private IDataDownResultService dataDownResultService;
+
+    /**
+     * 查询数据下载列表
+     */
+    @PreAuthorize("@ss.hasPermi('manage:dataDown:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(DataDownResult dataDownResult)
+    {
+        startPage();
+        List<DataDownResult> list = dataDownResultService.selectDataDownResultList(dataDownResult);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出数据下载列表
+     */
+    @PreAuthorize("@ss.hasPermi('manage:dataDown:export')")
+    @Log(title = "数据下载", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, DataDownResult dataDownResult)
+    {
+        List<DataDownResult> list = dataDownResultService.selectDataDownResultList(dataDownResult);
+        ExcelUtil<DataDownResult> util = new ExcelUtil<DataDownResult>(DataDownResult.class);
+        util.exportExcel(response, list, "数据下载数据");
+    }
+
+    /**
+     * 获取数据下载详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('manage:dataDown:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(dataDownResultService.selectDataDownResultById(id));
+    }
+
+    /**
+     * 新增数据下载
+     */
+    @PreAuthorize("@ss.hasPermi('manage:dataDown:add')")
+    @Log(title = "数据下载", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody DataDownResult dataDownResult)
+    {
+        return toAjax(dataDownResultService.insertDataDownResult(dataDownResult));
+    }
+
+    /**
+     * 修改数据下载
+     */
+    @PreAuthorize("@ss.hasPermi('manage:dataDown:edit')")
+    @Log(title = "数据下载", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody DataDownResult dataDownResult)
+    {
+        return toAjax(dataDownResultService.updateDataDownResult(dataDownResult));
+    }
+
+    /**
+     * 删除数据下载
+     */
+    @PreAuthorize("@ss.hasPermi('manage:dataDown:remove')")
+    @Log(title = "数据下载", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(dataDownResultService.deleteDataDownResultByIds(ids));
+    }
+}

+ 97 - 0
PHM-admin/phm-manage/src/main/java/com/phm/manage/domain/DataDownResult.java

@@ -0,0 +1,97 @@
+package com.phm.manage.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.phm.common.annotation.Excel;
+import com.phm.common.core.domain.BaseEntity;
+
+/**
+ * 数据下载对象 phm_data_down_result
+ * 
+ * @author phm
+ * @date 2023-08-24
+ */
+public class DataDownResult extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 唯一ID */
+    private Long id;
+
+    /** 指令 */
+    @Excel(name = "指令")
+    private String order;
+
+    /** 下载的数据名称 */
+    @Excel(name = "下载的数据名称")
+    private String name;
+
+    /** 保存路径 */
+    @Excel(name = "保存路径")
+    private String path;
+
+    /** 数据是否删除(1:删除,0有效) */
+    private Long isDelete;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setOrder(String order) 
+    {
+        this.order = order;
+    }
+
+    public String getOrder() 
+    {
+        return order;
+    }
+    public void setName(String name) 
+    {
+        this.name = name;
+    }
+
+    public String getName() 
+    {
+        return name;
+    }
+    public void setPath(String path) 
+    {
+        this.path = path;
+    }
+
+    public String getPath() 
+    {
+        return path;
+    }
+    public void setIsDelete(Long isDelete) 
+    {
+        this.isDelete = isDelete;
+    }
+
+    public Long getIsDelete() 
+    {
+        return isDelete;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("order", getOrder())
+            .append("name", getName())
+            .append("path", getPath())
+            .append("remark", getRemark())
+            .append("isDelete", getIsDelete())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 61 - 0
PHM-admin/phm-manage/src/main/java/com/phm/manage/mapper/DataDownResultMapper.java

@@ -0,0 +1,61 @@
+package com.phm.manage.mapper;
+
+import java.util.List;
+import com.phm.manage.domain.DataDownResult;
+
+/**
+ * 数据下载Mapper接口
+ * 
+ * @author phm
+ * @date 2023-08-24
+ */
+public interface DataDownResultMapper 
+{
+    /**
+     * 查询数据下载
+     * 
+     * @param id 数据下载主键
+     * @return 数据下载
+     */
+    public DataDownResult selectDataDownResultById(Long id);
+
+    /**
+     * 查询数据下载列表
+     * 
+     * @param dataDownResult 数据下载
+     * @return 数据下载集合
+     */
+    public List<DataDownResult> selectDataDownResultList(DataDownResult dataDownResult);
+
+    /**
+     * 新增数据下载
+     * 
+     * @param dataDownResult 数据下载
+     * @return 结果
+     */
+    public int insertDataDownResult(DataDownResult dataDownResult);
+
+    /**
+     * 修改数据下载
+     * 
+     * @param dataDownResult 数据下载
+     * @return 结果
+     */
+    public int updateDataDownResult(DataDownResult dataDownResult);
+
+    /**
+     * 删除数据下载
+     * 
+     * @param id 数据下载主键
+     * @return 结果
+     */
+    public int deleteDataDownResultById(Long id);
+
+    /**
+     * 批量删除数据下载
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteDataDownResultByIds(Long[] ids);
+}

+ 61 - 0
PHM-admin/phm-manage/src/main/java/com/phm/manage/service/IDataDownResultService.java

@@ -0,0 +1,61 @@
+package com.phm.manage.service;
+
+import java.util.List;
+import com.phm.manage.domain.DataDownResult;
+
+/**
+ * 数据下载Service接口
+ * 
+ * @author phm
+ * @date 2023-08-24
+ */
+public interface IDataDownResultService 
+{
+    /**
+     * 查询数据下载
+     * 
+     * @param id 数据下载主键
+     * @return 数据下载
+     */
+    public DataDownResult selectDataDownResultById(Long id);
+
+    /**
+     * 查询数据下载列表
+     * 
+     * @param dataDownResult 数据下载
+     * @return 数据下载集合
+     */
+    public List<DataDownResult> selectDataDownResultList(DataDownResult dataDownResult);
+
+    /**
+     * 新增数据下载
+     * 
+     * @param dataDownResult 数据下载
+     * @return 结果
+     */
+    public int insertDataDownResult(DataDownResult dataDownResult);
+
+    /**
+     * 修改数据下载
+     * 
+     * @param dataDownResult 数据下载
+     * @return 结果
+     */
+    public int updateDataDownResult(DataDownResult dataDownResult);
+
+    /**
+     * 批量删除数据下载
+     * 
+     * @param ids 需要删除的数据下载主键集合
+     * @return 结果
+     */
+    public int deleteDataDownResultByIds(Long[] ids);
+
+    /**
+     * 删除数据下载信息
+     * 
+     * @param id 数据下载主键
+     * @return 结果
+     */
+    public int deleteDataDownResultById(Long id);
+}

+ 96 - 0
PHM-admin/phm-manage/src/main/java/com/phm/manage/service/impl/DataDownResultServiceImpl.java

@@ -0,0 +1,96 @@
+package com.phm.manage.service.impl;
+
+import java.util.List;
+import com.phm.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.phm.manage.mapper.DataDownResultMapper;
+import com.phm.manage.domain.DataDownResult;
+import com.phm.manage.service.IDataDownResultService;
+
+/**
+ * 数据下载Service业务层处理
+ * 
+ * @author phm
+ * @date 2023-08-24
+ */
+@Service
+public class DataDownResultServiceImpl implements IDataDownResultService 
+{
+    @Autowired
+    private DataDownResultMapper dataDownResultMapper;
+
+    /**
+     * 查询数据下载
+     * 
+     * @param id 数据下载主键
+     * @return 数据下载
+     */
+    @Override
+    public DataDownResult selectDataDownResultById(Long id)
+    {
+        return dataDownResultMapper.selectDataDownResultById(id);
+    }
+
+    /**
+     * 查询数据下载列表
+     * 
+     * @param dataDownResult 数据下载
+     * @return 数据下载
+     */
+    @Override
+    public List<DataDownResult> selectDataDownResultList(DataDownResult dataDownResult)
+    {
+        return dataDownResultMapper.selectDataDownResultList(dataDownResult);
+    }
+
+    /**
+     * 新增数据下载
+     * 
+     * @param dataDownResult 数据下载
+     * @return 结果
+     */
+    @Override
+    public int insertDataDownResult(DataDownResult dataDownResult)
+    {
+        dataDownResult.setCreateTime(DateUtils.getNowDate());
+        return dataDownResultMapper.insertDataDownResult(dataDownResult);
+    }
+
+    /**
+     * 修改数据下载
+     * 
+     * @param dataDownResult 数据下载
+     * @return 结果
+     */
+    @Override
+    public int updateDataDownResult(DataDownResult dataDownResult)
+    {
+        dataDownResult.setUpdateTime(DateUtils.getNowDate());
+        return dataDownResultMapper.updateDataDownResult(dataDownResult);
+    }
+
+    /**
+     * 批量删除数据下载
+     * 
+     * @param ids 需要删除的数据下载主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDataDownResultByIds(Long[] ids)
+    {
+        return dataDownResultMapper.deleteDataDownResultByIds(ids);
+    }
+
+    /**
+     * 删除数据下载信息
+     * 
+     * @param id 数据下载主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDataDownResultById(Long id)
+    {
+        return dataDownResultMapper.deleteDataDownResultById(id);
+    }
+}

+ 2 - 0
PHM-admin/phm-manage/src/main/resources/mapper/manage/AfterAnalysisResultMapper.xml

@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     
     <resultMap type="AfterAnalysisResult" id="AfterAnalysisResultResult">
         <result property="id"    column="id"    />
+        <result property="remark"    column="remark"    />
         <result property="isDelete"    column="is_delete"    />
         <result property="createdBy"    column="created_by"    />
         <result property="createdTime"    column="created_time"    />
@@ -20,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectAfterAnalysisResultList" parameterType="AfterAnalysisResult" resultMap="AfterAnalysisResultResult">
         <include refid="selectAfterAnalysisResultVo"/>
         <where>  
+            <if test="remark != null "> and remark = #{remark}</if>
             <if test="isDelete != null "> and is_delete = #{isDelete}</if>
             <if test="createdBy != null  and createdBy != ''"> and created_by = #{createdBy}</if>
             <if test="createdTime != null "> and created_time = #{createdTime}</if>

+ 95 - 0
PHM-admin/phm-manage/src/main/resources/mapper/manage/DataDownResultMapper.xml

@@ -0,0 +1,95 @@
+<?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.phm.manage.mapper.DataDownResultMapper">
+    
+    <resultMap type="DataDownResult" id="DataDownResultResult">
+        <result property="id"    column="id"    />
+        <result property="order"    column="order"    />
+        <result property="name"    column="name"    />
+        <result property="path"    column="path"    />
+        <result property="remark"    column="remark"    />
+        <result property="isDelete"    column="is_delete"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectDataDownResultVo">
+        select id, order, name, path, remark, is_delete, create_by, create_time, update_by, update_time from phm_data_down_result
+    </sql>
+
+    <select id="selectDataDownResultList" parameterType="DataDownResult" resultMap="DataDownResultResult">
+        <include refid="selectDataDownResultVo"/>
+        <where>  
+            <if test="order != null  and order != ''"> and order = #{order}</if>
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+            <if test="path != null  and path != ''"> and path = #{path}</if>
+            <if test="remark != null  and remark != ''"> and remark = #{remark}</if>
+            <if test="createBy != null  and createBy != ''"> and create_by = #{createBy}</if>
+            <if test="createTime != null "> and create_time = #{createTime}</if>
+            <if test="updateBy != null  and updateBy != ''"> and update_by = #{updateBy}</if>
+            <if test="updateTime != null "> and update_time = #{updateTime}</if>
+        </where>
+    </select>
+    
+    <select id="selectDataDownResultById" parameterType="Long" resultMap="DataDownResultResult">
+        <include refid="selectDataDownResultVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertDataDownResult" parameterType="DataDownResult" useGeneratedKeys="true" keyProperty="id">
+        insert into phm_data_down_result
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="order != null">order,</if>
+            <if test="name != null">name,</if>
+            <if test="path != null">path,</if>
+            <if test="remark != null">remark,</if>
+            <if test="isDelete != null">is_delete,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="order != null">#{order},</if>
+            <if test="name != null">#{name},</if>
+            <if test="path != null">#{path},</if>
+            <if test="remark != null">#{remark},</if>
+            <if test="isDelete != null">#{isDelete},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateDataDownResult" parameterType="DataDownResult">
+        update phm_data_down_result
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="order != null">order = #{order},</if>
+            <if test="name != null">name = #{name},</if>
+            <if test="path != null">path = #{path},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="isDelete != null">is_delete = #{isDelete},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteDataDownResultById" parameterType="Long">
+        delete from phm_data_down_result where id = #{id}
+    </delete>
+
+    <delete id="deleteDataDownResultByIds" parameterType="String">
+        delete from phm_data_down_result where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>