wangsixiang
6 months ago
6 changed files with 468 additions and 0 deletions
@ -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<DcFileDownload> 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<DcFileDownload> list = dcFileDownloadService.selectDcFileDownloadList(dcFileDownload); |
|||
ExcelUtil<DcFileDownload> 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)); |
|||
} |
|||
} |
@ -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(); |
|||
} |
|||
} |
@ -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<DcFileDownload> 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); |
|||
} |
@ -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<DcFileDownload> 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); |
|||
} |
@ -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<DcFileDownload> 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); |
|||
} |
|||
} |
@ -0,0 +1,78 @@ |
|||
<?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.zc.business.mapper.DcFileDownloadMapper"> |
|||
|
|||
<resultMap type="DcFileDownload" id="DcFileDownloadResult"> |
|||
<result property="id" column="id" /> |
|||
<result property="fileName" column="file_name" /> |
|||
<result property="fileAddress" column="file_address" /> |
|||
<result property="createTime" column="create_time" /> |
|||
<result property="createBy" column="create_by" /> |
|||
<result property="updateTime" column="update_time" /> |
|||
<result property="updateBy" column="update_by" /> |
|||
</resultMap> |
|||
|
|||
<sql id="selectDcFileDownloadVo"> |
|||
select id, file_name, file_address, create_time, create_by, update_time, update_by from dc_file_download |
|||
</sql> |
|||
|
|||
<select id="selectDcFileDownloadList" parameterType="DcFileDownload" resultMap="DcFileDownloadResult"> |
|||
<include refid="selectDcFileDownloadVo"/> |
|||
<where> |
|||
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if> |
|||
<if test="fileAddress != null and fileAddress != ''"> and file_address = #{fileAddress}</if> |
|||
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectDcFileDownloadById" parameterType="Long" resultMap="DcFileDownloadResult"> |
|||
<include refid="selectDcFileDownloadVo"/> |
|||
where id = #{id} |
|||
</select> |
|||
|
|||
<insert id="insertDcFileDownload" parameterType="DcFileDownload" useGeneratedKeys="true" keyProperty="id"> |
|||
insert into dc_file_download |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="fileName != null">file_name,</if> |
|||
<if test="fileAddress != null">file_address,</if> |
|||
<if test="createTime != null">create_time,</if> |
|||
<if test="createBy != null">create_by,</if> |
|||
<if test="updateTime != null">update_time,</if> |
|||
<if test="updateBy != null">update_by,</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="fileName != null">#{fileName},</if> |
|||
<if test="fileAddress != null">#{fileAddress},</if> |
|||
<if test="createTime != null">#{createTime},</if> |
|||
<if test="createBy != null">#{createBy},</if> |
|||
<if test="updateTime != null">#{updateTime},</if> |
|||
<if test="updateBy != null">#{updateBy},</if> |
|||
</trim> |
|||
</insert> |
|||
|
|||
<update id="updateDcFileDownload" parameterType="DcFileDownload"> |
|||
update dc_file_download |
|||
<trim prefix="SET" suffixOverrides=","> |
|||
<if test="fileName != null">file_name = #{fileName},</if> |
|||
<if test="fileAddress != null">file_address = #{fileAddress},</if> |
|||
<if test="createTime != null">create_time = #{createTime},</if> |
|||
<if test="createBy != null">create_by = #{createBy},</if> |
|||
<if test="updateTime != null">update_time = #{updateTime},</if> |
|||
<if test="updateBy != null">update_by = #{updateBy},</if> |
|||
</trim> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<delete id="deleteDcFileDownloadById" parameterType="Long"> |
|||
delete from dc_file_download where id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="deleteDcFileDownloadByIds" parameterType="String"> |
|||
delete from dc_file_download where id in |
|||
<foreach item="id" collection="array" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
</mapper> |
Loading…
Reference in new issue