新增前端vue
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.BizFolders;
|
||||
|
||||
/**
|
||||
* 文件夹信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface BizFoldersDao extends CrudDao<BizFolders> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.BizMyfiles;
|
||||
|
||||
/**
|
||||
* 文件信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface BizMyfilesDao extends CrudDao<BizMyfiles> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 文件夹信息Entity
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name="biz_folders", alias="a", label="文件夹信息信息", columns={
|
||||
@Column(name="create_time", attrName="createTime", label="记录时间", isUpdate=false, isUpdateForce=true),
|
||||
@Column(name="folder_id", attrName="folderId", label="文件夹标识", isPK=true),
|
||||
@Column(name="folder_name", attrName="folderName", label="文件夹名称", queryType=QueryType.LIKE),
|
||||
@Column(name="parent_id", attrName="parentId", label="父文件夹"),
|
||||
@Column(name="user_name", attrName="userName", label="用户姓名", isQuery=false),
|
||||
@Column(name="login_code", attrName="loginCode", label="用户名称"),
|
||||
@Column(name="update_time", attrName="updateTime", label="更新时间", isQuery=false, isUpdateForce=true),
|
||||
@Column(name="is_deleted", attrName="isDeleted", label="是否删除"),
|
||||
@Column(name="description", attrName="description", label="文件夹描述", queryType=QueryType.LIKE),
|
||||
}, orderBy="a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizFolders extends DataEntity<BizFolders> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String folderId; // 文件夹标识
|
||||
private String folderName; // 文件夹名称
|
||||
private String parentId; // 父文件夹
|
||||
private String userName; // 用户姓名
|
||||
private String loginCode; // 用户名称
|
||||
private Date updateTime; // 更新时间
|
||||
private Integer isDeleted; // 是否删除
|
||||
private String description; // 文件夹描述
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title="记录时间", attrName="createTime", align=Align.CENTER, sort=10, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title="文件夹标识", attrName="folderId", align=Align.CENTER, sort=20),
|
||||
@ExcelField(title="文件夹名称", attrName="folderName", align=Align.CENTER, sort=30),
|
||||
@ExcelField(title="父文件夹", attrName="parentId", align=Align.CENTER, sort=40),
|
||||
@ExcelField(title="用户姓名", attrName="userName", align=Align.CENTER, sort=50),
|
||||
@ExcelField(title="用户名称", attrName="loginCode", align=Align.CENTER, sort=60),
|
||||
@ExcelField(title="更新时间", attrName="updateTime", align=Align.CENTER, sort=70, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title="是否删除", attrName="isDeleted", dictType="sys_yes_no", align=Align.CENTER, sort=80),
|
||||
@ExcelField(title="文件夹描述", attrName="description", align=Align.CENTER, sort=90),
|
||||
})
|
||||
public BizFolders() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizFolders(String id){
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 文件信息Entity
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name="biz_myfiles", alias="a", label="文件信息信息", columns={
|
||||
@Column(name="create_time", attrName="createTime", label="记录时间", isUpdate=false, isUpdateForce=true),
|
||||
@Column(name="id", attrName="tid", label="文件标识", isPK=true),
|
||||
@Column(name="file_name", attrName="fileName", label="原始名称", queryType=QueryType.LIKE),
|
||||
@Column(name="file_path", attrName="filePath", label="存储路径", isQuery=false),
|
||||
@Column(name="file_hash", attrName="fileHash", label="文件MD5"),
|
||||
@Column(name="file_size", attrName="fileSize", label="文件大小", isQuery=false),
|
||||
@Column(name="file_ext", attrName="fileExt", label="文件扩展名", isQuery=false),
|
||||
@Column(name="mime_type", attrName="mimeType", label="文件类型", isQuery=false),
|
||||
@Column(name="folder_id", attrName="folderId", label="文件夹标识"),
|
||||
@Column(name="user_name", attrName="userName", label="用户姓名", isUpdate=false, isQuery=false),
|
||||
@Column(name="login_code", attrName="loginCode", label="用户名称", isUpdate=false),
|
||||
@Column(name="download_count", attrName="downloadCount", label="下载次数", isUpdate=false, isQuery=false, isUpdateForce=true),
|
||||
@Column(name="view_count", attrName="viewCount", label="查看次数", isUpdate=false, isQuery=false, isUpdateForce=true),
|
||||
@Column(name="expire_time", attrName="expireTime", label="过期时间", isQuery=false, isUpdateForce=true),
|
||||
@Column(name="is_delete", attrName="isDelete", label="是否删除", isUpdateForce=true),
|
||||
@Column(name="update_time", attrName="updateTime", label="更新时间", isQuery=false, isUpdateForce=true),
|
||||
}, orderBy="a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizMyfiles extends DataEntity<BizMyfiles> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private Long tid; // 文件标识
|
||||
private String fileName; // 原始名称
|
||||
private String filePath; // 存储路径
|
||||
private String fileHash; // 文件MD5
|
||||
private Long fileSize; // 文件大小
|
||||
private String fileExt; // 文件扩展名
|
||||
private String mimeType; // 文件类型
|
||||
private String folderId; // 文件夹标识
|
||||
private String userName; // 用户姓名
|
||||
private String loginCode; // 用户名称
|
||||
private Integer downloadCount; // 下载次数
|
||||
private Integer viewCount; // 查看次数
|
||||
private Date expireTime; // 过期时间
|
||||
private Integer isDelete; // 是否删除
|
||||
private Date updateTime; // 更新时间
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title="记录时间", attrName="createTime", align=Align.CENTER, sort=10, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title="文件标识", attrName="tid", align=Align.CENTER, sort=20),
|
||||
@ExcelField(title="原始名称", attrName="fileName", align=Align.CENTER, sort=30),
|
||||
@ExcelField(title="存储路径", attrName="filePath", align=Align.CENTER, sort=40),
|
||||
@ExcelField(title="文件MD5", attrName="fileHash", align=Align.CENTER, sort=50),
|
||||
@ExcelField(title="文件大小", attrName="fileSize", align=Align.CENTER, sort=60),
|
||||
@ExcelField(title="文件扩展名", attrName="fileExt", align=Align.CENTER, sort=70),
|
||||
@ExcelField(title="文件类型", attrName="mimeType", align=Align.CENTER, sort=80),
|
||||
@ExcelField(title="文件夹标识", attrName="folderId", align=Align.CENTER, sort=90),
|
||||
@ExcelField(title="用户姓名", attrName="userName", align=Align.CENTER, sort=100),
|
||||
@ExcelField(title="用户名称", attrName="loginCode", align=Align.CENTER, sort=110),
|
||||
@ExcelField(title="下载次数", attrName="downloadCount", align=Align.CENTER, sort=120),
|
||||
@ExcelField(title="查看次数", attrName="viewCount", align=Align.CENTER, sort=130),
|
||||
@ExcelField(title="过期时间", attrName="expireTime", align=Align.CENTER, sort=140, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title="是否删除", attrName="isDelete", dictType="sys_yes_no", align=Align.CENTER, sort=150),
|
||||
@ExcelField(title="更新时间", attrName="updateTime", align=Align.CENTER, sort=160, dataFormat="yyyy-MM-dd hh:mm"),
|
||||
})
|
||||
public BizMyfiles() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizMyfiles(String id){
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.BizFolders;
|
||||
import com.jeesite.modules.biz.dao.BizFoldersDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 文件夹信息Service
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@Service
|
||||
public class BizFoldersService extends CrudService<BizFoldersDao, BizFolders> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizFolders 主键
|
||||
*/
|
||||
@Override
|
||||
public BizFolders get(BizFolders bizFolders) {
|
||||
return super.get(bizFolders);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param bizFolders 查询条件
|
||||
* @param bizFolders page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<BizFolders> findPage(BizFolders bizFolders) {
|
||||
return super.findPage(bizFolders);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizFolders 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizFolders> findList(BizFolders bizFolders) {
|
||||
return super.findList(bizFolders);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizFolders 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(BizFolders bizFolders) {
|
||||
super.save(bizFolders);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<BizFolders> list = ei.getDataList(BizFolders.class);
|
||||
for (BizFolders bizFolders : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(bizFolders);
|
||||
this.save(bizFolders);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + bizFolders.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + bizFolders.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bizFolders 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(BizFolders bizFolders) {
|
||||
super.updateStatus(bizFolders);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizFolders 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(BizFolders bizFolders) {
|
||||
super.delete(bizFolders);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.BizMyfiles;
|
||||
import com.jeesite.modules.biz.dao.BizMyfilesDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.modules.file.utils.FileUploadUtils;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 文件信息Service
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@Service
|
||||
public class BizMyfilesService extends CrudService<BizMyfilesDao, BizMyfiles> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizMyfiles 主键
|
||||
*/
|
||||
@Override
|
||||
public BizMyfiles get(BizMyfiles bizMyfiles) {
|
||||
return super.get(bizMyfiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param bizMyfiles 查询条件
|
||||
* @param bizMyfiles page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<BizMyfiles> findPage(BizMyfiles bizMyfiles) {
|
||||
return super.findPage(bizMyfiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizMyfiles 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizMyfiles> findList(BizMyfiles bizMyfiles) {
|
||||
return super.findList(bizMyfiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizMyfiles 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(BizMyfiles bizMyfiles) {
|
||||
super.save(bizMyfiles);
|
||||
// 保存上传附件
|
||||
FileUploadUtils.saveFileUpload(bizMyfiles, bizMyfiles.getId(), "bizMyfiles_file");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<BizMyfiles> list = ei.getDataList(BizMyfiles.class);
|
||||
for (BizMyfiles bizMyfiles : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(bizMyfiles);
|
||||
this.save(bizMyfiles);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + bizMyfiles.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + bizMyfiles.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bizMyfiles 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(BizMyfiles bizMyfiles) {
|
||||
super.updateStatus(bizMyfiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizMyfiles 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(BizMyfiles bizMyfiles) {
|
||||
super.delete(bizMyfiles);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.BizFolders;
|
||||
import com.jeesite.modules.biz.service.BizFoldersService;
|
||||
|
||||
/**
|
||||
* 文件夹信息Controller
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/folders")
|
||||
public class BizFoldersController extends BaseController {
|
||||
|
||||
private final BizFoldersService bizFoldersService;
|
||||
|
||||
public BizFoldersController(BizFoldersService bizFoldersService) {
|
||||
this.bizFoldersService = bizFoldersService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizFolders get(String folderId, boolean isNewRecord) {
|
||||
return bizFoldersService.get(folderId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizFolders bizFolders, Model model) {
|
||||
model.addAttribute("bizFolders", bizFolders);
|
||||
return "modules/biz/bizFoldersList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizFolders> listData(BizFolders bizFolders, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizFolders.setPage(new Page<>(request, response));
|
||||
Page<BizFolders> page = bizFoldersService.findPage(bizFolders);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizFolders bizFolders, Model model) {
|
||||
model.addAttribute("bizFolders", bizFolders);
|
||||
return "modules/biz/bizFoldersForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizFolders bizFolders) {
|
||||
bizFoldersService.save(bizFolders);
|
||||
return renderResult(Global.TRUE, text("保存文件夹信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizFolders bizFolders, HttpServletResponse response) {
|
||||
List<BizFolders> list = bizFoldersService.findList(bizFolders);
|
||||
String fileName = "文件夹信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("文件夹信息", BizFolders.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizFolders bizFolders = new BizFolders();
|
||||
List<BizFolders> list = ListUtils.newArrayList(bizFolders);
|
||||
String fileName = "文件夹信息模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("文件夹信息", BizFolders.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizFoldersService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizFolders bizFolders) {
|
||||
bizFoldersService.delete(bizFolders);
|
||||
return renderResult(Global.TRUE, text("删除文件夹信息成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.BizMyfiles;
|
||||
import com.jeesite.modules.biz.service.BizMyfilesService;
|
||||
|
||||
/**
|
||||
* 文件信息Controller
|
||||
* @author gaoxq
|
||||
* @version 2025-12-18
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/myfiles")
|
||||
public class BizMyfilesController extends BaseController {
|
||||
|
||||
private final BizMyfilesService bizMyfilesService;
|
||||
|
||||
public BizMyfilesController(BizMyfilesService bizMyfilesService) {
|
||||
this.bizMyfilesService = bizMyfilesService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizMyfiles get(Long tid, boolean isNewRecord) {
|
||||
return bizMyfilesService.get(tid, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizMyfiles bizMyfiles, Model model) {
|
||||
model.addAttribute("bizMyfiles", bizMyfiles);
|
||||
return "modules/biz/bizMyfilesList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizMyfiles> listData(BizMyfiles bizMyfiles, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizMyfiles.setPage(new Page<>(request, response));
|
||||
Page<BizMyfiles> page = bizMyfilesService.findPage(bizMyfiles);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizMyfiles bizMyfiles, Model model) {
|
||||
model.addAttribute("bizMyfiles", bizMyfiles);
|
||||
return "modules/biz/bizMyfilesForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizMyfiles bizMyfiles) {
|
||||
bizMyfilesService.save(bizMyfiles);
|
||||
return renderResult(Global.TRUE, text("保存文件信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizMyfiles bizMyfiles, HttpServletResponse response) {
|
||||
List<BizMyfiles> list = bizMyfilesService.findList(bizMyfiles);
|
||||
String fileName = "文件信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("文件信息", BizMyfiles.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizMyfiles bizMyfiles = new BizMyfiles();
|
||||
List<BizMyfiles> list = ListUtils.newArrayList(bizMyfiles);
|
||||
String fileName = "文件信息模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("文件信息", BizMyfiles.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizMyfilesService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizMyfiles bizMyfiles) {
|
||||
bizMyfilesService.delete(bizMyfiles);
|
||||
return renderResult(Global.TRUE, text("删除文件信息成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user