幼儿入园系列文件-列表页
This commit is contained in:
@ -0,0 +1,97 @@
|
||||
package com.ruoyi.project.benyi.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.project.benyi.domain.ByFiles;
|
||||
import com.ruoyi.project.benyi.service.IByFilesService;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 文件管理Controller
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2020-08-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/benyi/files")
|
||||
public class ByFilesController extends BaseController {
|
||||
@Autowired
|
||||
private IByFilesService byFilesService;
|
||||
|
||||
/**
|
||||
* 查询文件管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:files:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ByFiles byFiles) {
|
||||
startPage();
|
||||
List<ByFiles> list = byFilesService.selectByFilesList(byFiles);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出文件管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:files:export')")
|
||||
@Log(title = "文件管理", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(ByFiles byFiles) {
|
||||
List<ByFiles> list = byFilesService.selectByFilesList(byFiles);
|
||||
ExcelUtil<ByFiles> util = new ExcelUtil<ByFiles>(ByFiles.class);
|
||||
return util.exportExcel(list, "files");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:files:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(byFilesService.selectByFilesById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文件管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:files:add')")
|
||||
@Log(title = "文件管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ByFiles byFiles) {
|
||||
return toAjax(byFilesService.insertByFiles(byFiles));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文件管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:files:edit')")
|
||||
@Log(title = "文件管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ByFiles byFiles) {
|
||||
return toAjax(byFilesService.updateByFiles(byFiles));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:files:remove')")
|
||||
@Log(title = "文件管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(byFilesService.deleteByFilesByIds(ids));
|
||||
}
|
||||
}
|
112
ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByFiles.java
Normal file
112
ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByFiles.java
Normal file
@ -0,0 +1,112 @@
|
||||
package com.ruoyi.project.benyi.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
|
||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 文件管理对象 by_files
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2020-08-12
|
||||
*/
|
||||
public class ByFiles extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
@Excel(name = "文件名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 文件类型
|
||||
*/
|
||||
@Excel(name = "文件类型")
|
||||
private String filetype;
|
||||
|
||||
/**
|
||||
* 文件所属类型
|
||||
*/
|
||||
@Excel(name = "文件所属类型")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
@Excel(name = "文件路径")
|
||||
private String fileurl;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Excel(name = "创建人")
|
||||
private Long createuserid;
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setFiletype(String filetype) {
|
||||
this.filetype = filetype;
|
||||
}
|
||||
|
||||
public String getFiletype() {
|
||||
return filetype;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setFileurl(String fileurl) {
|
||||
this.fileurl = fileurl;
|
||||
}
|
||||
|
||||
public String getFileurl() {
|
||||
return fileurl;
|
||||
}
|
||||
|
||||
public void setCreateuserid(Long createuserid) {
|
||||
this.createuserid = createuserid;
|
||||
}
|
||||
|
||||
public Long getCreateuserid() {
|
||||
return createuserid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("filetype", getFiletype())
|
||||
.append("type", getType())
|
||||
.append("fileurl", getFileurl())
|
||||
.append("createuserid", getCreateuserid())
|
||||
.append("createTime", getCreateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.project.benyi.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.project.benyi.domain.ByFiles;
|
||||
|
||||
/**
|
||||
* 文件管理Mapper接口
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2020-08-12
|
||||
*/
|
||||
public interface ByFilesMapper {
|
||||
/**
|
||||
* 查询文件管理
|
||||
*
|
||||
* @param id 文件管理ID
|
||||
* @return 文件管理
|
||||
*/
|
||||
public ByFiles selectByFilesById(Long id);
|
||||
|
||||
/**
|
||||
* 查询文件管理列表
|
||||
*
|
||||
* @param byFiles 文件管理
|
||||
* @return 文件管理集合
|
||||
*/
|
||||
public List<ByFiles> selectByFilesList(ByFiles byFiles);
|
||||
|
||||
/**
|
||||
* 新增文件管理
|
||||
*
|
||||
* @param byFiles 文件管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertByFiles(ByFiles byFiles);
|
||||
|
||||
/**
|
||||
* 修改文件管理
|
||||
*
|
||||
* @param byFiles 文件管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateByFiles(ByFiles byFiles);
|
||||
|
||||
/**
|
||||
* 删除文件管理
|
||||
*
|
||||
* @param id 文件管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByFilesById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除文件管理
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByFilesByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.project.benyi.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.project.benyi.domain.ByFiles;
|
||||
|
||||
/**
|
||||
* 文件管理Service接口
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2020-08-12
|
||||
*/
|
||||
public interface IByFilesService {
|
||||
/**
|
||||
* 查询文件管理
|
||||
*
|
||||
* @param id 文件管理ID
|
||||
* @return 文件管理
|
||||
*/
|
||||
public ByFiles selectByFilesById(Long id);
|
||||
|
||||
/**
|
||||
* 查询文件管理列表
|
||||
*
|
||||
* @param byFiles 文件管理
|
||||
* @return 文件管理集合
|
||||
*/
|
||||
public List<ByFiles> selectByFilesList(ByFiles byFiles);
|
||||
|
||||
/**
|
||||
* 新增文件管理
|
||||
*
|
||||
* @param byFiles 文件管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertByFiles(ByFiles byFiles);
|
||||
|
||||
/**
|
||||
* 修改文件管理
|
||||
*
|
||||
* @param byFiles 文件管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateByFiles(ByFiles byFiles);
|
||||
|
||||
/**
|
||||
* 批量删除文件管理
|
||||
*
|
||||
* @param ids 需要删除的文件管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByFilesByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除文件管理信息
|
||||
*
|
||||
* @param id 文件管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByFilesById(Long id);
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package com.ruoyi.project.benyi.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.project.benyi.mapper.ByFilesMapper;
|
||||
import com.ruoyi.project.benyi.domain.ByFiles;
|
||||
import com.ruoyi.project.benyi.service.IByFilesService;
|
||||
|
||||
/**
|
||||
* 文件管理Service业务层处理
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2020-08-12
|
||||
*/
|
||||
@Service
|
||||
public class ByFilesServiceImpl implements IByFilesService {
|
||||
@Autowired
|
||||
private ByFilesMapper byFilesMapper;
|
||||
|
||||
/**
|
||||
* 查询文件管理
|
||||
*
|
||||
* @param id 文件管理ID
|
||||
* @return 文件管理
|
||||
*/
|
||||
@Override
|
||||
public ByFiles selectByFilesById(Long id) {
|
||||
return byFilesMapper.selectByFilesById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文件管理列表
|
||||
*
|
||||
* @param byFiles 文件管理
|
||||
* @return 文件管理
|
||||
*/
|
||||
@Override
|
||||
public List<ByFiles> selectByFilesList(ByFiles byFiles) {
|
||||
return byFilesMapper.selectByFilesList(byFiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文件管理
|
||||
*
|
||||
* @param byFiles 文件管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertByFiles(ByFiles byFiles) {
|
||||
byFiles.setCreateTime(DateUtils.getNowDate());
|
||||
return byFilesMapper.insertByFiles(byFiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文件管理
|
||||
*
|
||||
* @param byFiles 文件管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateByFiles(ByFiles byFiles) {
|
||||
return byFilesMapper.updateByFiles(byFiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除文件管理
|
||||
*
|
||||
* @param ids 需要删除的文件管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteByFilesByIds(Long[] ids) {
|
||||
return byFilesMapper.deleteByFilesByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件管理信息
|
||||
*
|
||||
* @param id 文件管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteByFilesById(Long id) {
|
||||
return byFilesMapper.deleteByFilesById(id);
|
||||
}
|
||||
}
|
81
ruoyi/src/main/resources/mybatis/benyi/ByFilesMapper.xml
Normal file
81
ruoyi/src/main/resources/mybatis/benyi/ByFilesMapper.xml
Normal file
@ -0,0 +1,81 @@
|
||||
<?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.ruoyi.project.benyi.mapper.ByFilesMapper">
|
||||
|
||||
<resultMap type="ByFiles" id="ByFilesResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="filetype" column="filetype"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="fileurl" column="fileurl"/>
|
||||
<result property="createuserid" column="createuserid"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectByFilesVo">
|
||||
select id, name, filetype, type, fileurl, createuserid, create_time from by_files
|
||||
</sql>
|
||||
|
||||
<select id="selectByFilesList" parameterType="ByFiles" resultMap="ByFilesResult">
|
||||
<include refid="selectByFilesVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
||||
<if test="filetype != null and filetype != ''">and filetype = #{filetype}</if>
|
||||
<if test="type != null and type != ''">and type = #{type}</if>
|
||||
<if test="fileurl != null and fileurl != ''">and fileurl = #{fileurl}</if>
|
||||
<if test="createuserid != null ">and createuserid = #{createuserid}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectByFilesById" parameterType="Long" resultMap="ByFilesResult">
|
||||
<include refid="selectByFilesVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertByFiles" parameterType="ByFiles" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into by_files
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="filetype != null and filetype != ''">filetype,</if>
|
||||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="fileurl != null and fileurl != ''">fileurl,</if>
|
||||
<if test="createuserid != null ">createuserid,</if>
|
||||
<if test="createTime != null ">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="filetype != null and filetype != ''">#{filetype},</if>
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="fileurl != null and fileurl != ''">#{fileurl},</if>
|
||||
<if test="createuserid != null ">#{createuserid},</if>
|
||||
<if test="createTime != null ">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateByFiles" parameterType="ByFiles">
|
||||
update by_files
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="filetype != null and filetype != ''">filetype = #{filetype},</if>
|
||||
<if test="type != null and type != ''">type = #{type},</if>
|
||||
<if test="fileurl != null and fileurl != ''">fileurl = #{fileurl},</if>
|
||||
<if test="createuserid != null ">createuserid = #{createuserid},</if>
|
||||
<if test="createTime != null ">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteByFilesById" parameterType="Long">
|
||||
delete from by_files where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByFilesByIds" parameterType="String">
|
||||
delete from by_files where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user