From d4e3dd0097fb059cc03fc122c6c0395bec7af4f8 Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Wed, 12 Jun 2024 14:35:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E9=80=81=E4=BF=AE=E6=94=B9,=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=8F=91=E5=B8=83=E8=AE=B0=E5=BD=95=E7=AE=A1=E7=90=86?= =?UTF-8?q?=EF=BC=8C=E5=8F=91=E5=B8=83=E6=B8=A0=E9=81=93=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DcFileDownloadController.java | 98 ++++++++++++++++++ .../zc/business/domain/DcFileDownload.java | 71 +++++++++++++ .../business/mapper/DcFileDownloadMapper.java | 61 ++++++++++++ .../service/IDcFileDownloadService.java | 61 ++++++++++++ .../impl/DcFileDownloadServiceImpl.java | 99 +++++++++++++++++++ .../mapper/business/DcFileDownloadMapper.xml | 78 +++++++++++++++ 6 files changed, 468 insertions(+) create mode 100644 zc-business/src/main/java/com/zc/business/controller/DcFileDownloadController.java create mode 100644 zc-business/src/main/java/com/zc/business/domain/DcFileDownload.java create mode 100644 zc-business/src/main/java/com/zc/business/mapper/DcFileDownloadMapper.java create mode 100644 zc-business/src/main/java/com/zc/business/service/IDcFileDownloadService.java create mode 100644 zc-business/src/main/java/com/zc/business/service/impl/DcFileDownloadServiceImpl.java create mode 100644 zc-business/src/main/resources/mapper/business/DcFileDownloadMapper.xml diff --git a/zc-business/src/main/java/com/zc/business/controller/DcFileDownloadController.java b/zc-business/src/main/java/com/zc/business/controller/DcFileDownloadController.java new file mode 100644 index 00000000..9d5397f6 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/DcFileDownloadController.java @@ -0,0 +1,98 @@ +package com.zc.business.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.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.zc.business.domain.DcFileDownload; +import com.zc.business.service.IDcFileDownloadService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 文件管理Controller + * + * @author ruoyi + * @date 2024-06-12 + */ +@RestController +@RequestMapping("/business/download") +public class DcFileDownloadController extends BaseController { + @Autowired + private IDcFileDownloadService dcFileDownloadService; + + /** + * 查询文件管理列表 + */ + @PreAuthorize("@ss.hasPermi('business:download:list')") + @GetMapping("/list") + public TableDataInfo list(DcFileDownload dcFileDownload) { + startPage(); + List list = dcFileDownloadService.selectDcFileDownloadList(dcFileDownload); + return getDataTable(list); + } + + /** + * 导出文件管理列表 + */ + @PreAuthorize("@ss.hasPermi('business:download:export')") + @Log(title = "文件管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DcFileDownload dcFileDownload) { + List list = dcFileDownloadService.selectDcFileDownloadList(dcFileDownload); + ExcelUtil util = new ExcelUtil<>(DcFileDownload.class); + util.exportExcel(response, list, "文件管理数据"); + } + + /** + * 获取文件管理详细信息 + */ + @PreAuthorize("@ss.hasPermi('business:download:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(dcFileDownloadService.selectDcFileDownloadById(id)); + } + + /** + * 新增文件管理 + */ + @PreAuthorize("@ss.hasPermi('business:download:add')") + @Log(title = "文件管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DcFileDownload dcFileDownload) { + return toAjax(dcFileDownloadService.insertDcFileDownload(dcFileDownload)); + } + + /** + * 修改文件管理 + */ + @PreAuthorize("@ss.hasPermi('business:download:edit')") + @Log(title = "文件管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DcFileDownload dcFileDownload) { + return toAjax(dcFileDownloadService.updateDcFileDownload(dcFileDownload)); + } + + /** + * 删除文件管理 + */ + @PreAuthorize("@ss.hasPermi('business:download:remove')") + @Log(title = "文件管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(dcFileDownloadService.deleteDcFileDownloadByIds(ids)); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/DcFileDownload.java b/zc-business/src/main/java/com/zc/business/domain/DcFileDownload.java new file mode 100644 index 00000000..38fbe723 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/DcFileDownload.java @@ -0,0 +1,71 @@ +package com.zc.business.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 文件管理对象 dc_file_download + * + * @author ruoyi + * @date 2024-06-12 + */ +public class DcFileDownload extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** 文件名称 */ + @Excel(name = "文件名称") + private String fileName; + + /** 文件地址 */ + @Excel(name = "文件地址") + private String fileAddress; + + + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setFileName(String fileName) + { + this.fileName = fileName; + } + + public String getFileName() + { + return fileName; + } + public void setFileAddress(String fileAddress) + { + this.fileAddress = fileAddress; + } + + public String getFileAddress() + { + return fileAddress; + } + + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("fileName", getFileName()) + .append("fileAddress", getFileAddress()) + .append("createTime", getCreateTime()) + .append("createBy", getCreateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcFileDownloadMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcFileDownloadMapper.java new file mode 100644 index 00000000..f17bec7e --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/mapper/DcFileDownloadMapper.java @@ -0,0 +1,61 @@ +package com.zc.business.mapper; + +import java.util.List; +import com.zc.business.domain.DcFileDownload; + +/** + * 文件管理Mapper接口 + * + * @author ruoyi + * @date 2024-06-12 + */ +public interface DcFileDownloadMapper +{ + /** + * 查询文件管理 + * + * @param id 文件管理主键 + * @return 文件管理 + */ + public DcFileDownload selectDcFileDownloadById(Long id); + + /** + * 查询文件管理列表 + * + * @param dcFileDownload 文件管理 + * @return 文件管理集合 + */ + List selectDcFileDownloadList(DcFileDownload dcFileDownload); + + /** + * 新增文件管理 + * + * @param dcFileDownload 文件管理 + * @return 结果 + */ + int insertDcFileDownload(DcFileDownload dcFileDownload); + + /** + * 修改文件管理 + * + * @param dcFileDownload 文件管理 + * @return 结果 + */ + int updateDcFileDownload(DcFileDownload dcFileDownload); + + /** + * 删除文件管理 + * + * @param id 文件管理主键 + * @return 结果 + */ + int deleteDcFileDownloadById(Long id); + + /** + * 批量删除文件管理 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + int deleteDcFileDownloadByIds(Long[] ids); +} diff --git a/zc-business/src/main/java/com/zc/business/service/IDcFileDownloadService.java b/zc-business/src/main/java/com/zc/business/service/IDcFileDownloadService.java new file mode 100644 index 00000000..f5ce7c0a --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/IDcFileDownloadService.java @@ -0,0 +1,61 @@ +package com.zc.business.service; + +import java.util.List; +import com.zc.business.domain.DcFileDownload; + +/** + * 文件管理Service接口 + * + * @author ruoyi + * @date 2024-06-12 + */ +public interface IDcFileDownloadService +{ + /** + * 查询文件管理 + * + * @param id 文件管理主键 + * @return 文件管理 + */ + public DcFileDownload selectDcFileDownloadById(Long id); + + /** + * 查询文件管理列表 + * + * @param dcFileDownload 文件管理 + * @return 文件管理集合 + */ + List selectDcFileDownloadList(DcFileDownload dcFileDownload); + + /** + * 新增文件管理 + * + * @param dcFileDownload 文件管理 + * @return 结果 + */ + int insertDcFileDownload(DcFileDownload dcFileDownload); + + /** + * 修改文件管理 + * + * @param dcFileDownload 文件管理 + * @return 结果 + */ + int updateDcFileDownload(DcFileDownload dcFileDownload); + + /** + * 批量删除文件管理 + * + * @param ids 需要删除的文件管理主键集合 + * @return 结果 + */ + int deleteDcFileDownloadByIds(Long[] ids); + + /** + * 删除文件管理信息 + * + * @param id 文件管理主键 + * @return 结果 + */ + int deleteDcFileDownloadById(Long id); +} diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcFileDownloadServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcFileDownloadServiceImpl.java new file mode 100644 index 00000000..2ad1c9db --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcFileDownloadServiceImpl.java @@ -0,0 +1,99 @@ +package com.zc.business.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zc.business.mapper.DcFileDownloadMapper; +import com.zc.business.domain.DcFileDownload; +import com.zc.business.service.IDcFileDownloadService; + +/** + * 文件管理Service业务层处理 + * + * @author ruoyi + * @date 2024-06-12 + */ +@Service +public class DcFileDownloadServiceImpl implements IDcFileDownloadService +{ + @Autowired + private DcFileDownloadMapper dcFileDownloadMapper; + + /** + * 查询文件管理 + * + * @param id 文件管理主键 + * @return 文件管理 + */ + @Override + public DcFileDownload selectDcFileDownloadById(Long id) + { + return dcFileDownloadMapper.selectDcFileDownloadById(id); + } + + /** + * 查询文件管理列表 + * + * @param dcFileDownload 文件管理 + * @return 文件管理 + */ + @Override + public List selectDcFileDownloadList(DcFileDownload dcFileDownload) + { + return dcFileDownloadMapper.selectDcFileDownloadList(dcFileDownload); + } + + /** + * 新增文件管理 + * + * @param dcFileDownload 文件管理 + * @return 结果 + */ + @Override + public int insertDcFileDownload(DcFileDownload dcFileDownload) + { + dcFileDownload.setCreateTime(DateUtils.getNowDate()); + dcFileDownload.setCreateBy(SecurityUtils.getUsername()); + return dcFileDownloadMapper.insertDcFileDownload(dcFileDownload); + } + + /** + * 修改文件管理 + * + * @param dcFileDownload 文件管理 + * @return 结果 + */ + @Override + public int updateDcFileDownload(DcFileDownload dcFileDownload) + { + dcFileDownload.setUpdateTime(DateUtils.getNowDate()); + dcFileDownload.setUpdateBy(SecurityUtils.getUsername()); + return dcFileDownloadMapper.updateDcFileDownload(dcFileDownload); + } + + /** + * 批量删除文件管理 + * + * @param ids 需要删除的文件管理主键 + * @return 结果 + */ + @Override + public int deleteDcFileDownloadByIds(Long[] ids) + { + return dcFileDownloadMapper.deleteDcFileDownloadByIds(ids); + } + + /** + * 删除文件管理信息 + * + * @param id 文件管理主键 + * @return 结果 + */ + @Override + public int deleteDcFileDownloadById(Long id) + { + return dcFileDownloadMapper.deleteDcFileDownloadById(id); + } +} diff --git a/zc-business/src/main/resources/mapper/business/DcFileDownloadMapper.xml b/zc-business/src/main/resources/mapper/business/DcFileDownloadMapper.xml new file mode 100644 index 00000000..d780de17 --- /dev/null +++ b/zc-business/src/main/resources/mapper/business/DcFileDownloadMapper.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + select id, file_name, file_address, create_time, create_by, update_time, update_by from dc_file_download + + + + + + + + insert into dc_file_download + + file_name, + file_address, + create_time, + create_by, + update_time, + update_by, + + + #{fileName}, + #{fileAddress}, + #{createTime}, + #{createBy}, + #{updateTime}, + #{updateBy}, + + + + + update dc_file_download + + file_name = #{fileName}, + file_address = #{fileAddress}, + create_time = #{createTime}, + create_by = #{createBy}, + update_time = #{updateTime}, + update_by = #{updateBy}, + + where id = #{id} + + + + delete from dc_file_download where id = #{id} + + + + delete from dc_file_download where id in + + #{id} + + +