教培档案下载记录删除定时器
parent
f06f50a620
commit
0e449c4aba
|
@ -0,0 +1,73 @@
|
|||
package com.zcloud.mapper.datasource.system;
|
||||
|
||||
import com.zcloud.entity.Page;
|
||||
import com.zcloud.entity.PageData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明:附件上传日志
|
||||
* 作者:luoxiaobao
|
||||
* 时间:2022-08-24
|
||||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
public interface FileUploadLogMapper {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
void save(PageData pd);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
void delete(PageData pd);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
void edit(PageData pd);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param page
|
||||
* @throws Exception
|
||||
*/
|
||||
List<PageData> datalistPage(Page page);
|
||||
|
||||
/**
|
||||
* 列表(全部)
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
List<PageData> listAll(PageData pd);
|
||||
|
||||
/**
|
||||
* 通过id获取数据
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
PageData findById(PageData pd);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ArrayDATA_IDS
|
||||
* @throws Exception
|
||||
*/
|
||||
void deleteAll(String[] ArrayDATA_IDS);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.zcloud.mapper.dsno2.education;
|
||||
|
||||
import com.zcloud.entity.Page;
|
||||
import com.zcloud.entity.PageData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明:档案文件
|
||||
* 作者:luoxiaobao
|
||||
* 时间:2023-08-25
|
||||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
public interface ArchivesPdfFileMapper {
|
||||
|
||||
|
||||
/**列表(N天之前)
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
List<PageData> listAllDaysAgo(PageData pd);
|
||||
|
||||
/**删除
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
void deleteDaysAgo(PageData pd);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.zcloud.scheduled.education;
|
||||
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.service.education.ArchivesPdfFileService;
|
||||
import com.zcloud.util.Smb;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 档案文件删除(三天前的删除)
|
||||
*/
|
||||
@Component
|
||||
public class ArchivesDelScheduled {
|
||||
@Autowired
|
||||
private ArchivesPdfFileService archivesPdfFileService;
|
||||
@Autowired
|
||||
private Smb smb;
|
||||
|
||||
|
||||
@Scheduled(cron = "0 30 0 * * ?") // 每天晚上12:30执行
|
||||
// @Scheduled(cron ="0/30 * * * * ?") // 测试 每5分钟执行一次
|
||||
public void scheduled() {
|
||||
try {
|
||||
System.out.println("--------------------------开始删除档案文件-------------------------");
|
||||
try {
|
||||
PageData pd = new PageData();
|
||||
pd.put("DAYNUM", 3);
|
||||
List<PageData> deleteList = archivesPdfFileService.listAllDaysAgo(pd);
|
||||
if(deleteList != null && deleteList.size() > 0){
|
||||
for(PageData delete : deleteList){
|
||||
smb.deleteFile(delete.getString("FILE_PATH"));
|
||||
archivesPdfFileService.deleteDaysAgo(delete);
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.zcloud.service.education;
|
||||
|
||||
import com.zcloud.entity.Page;
|
||||
import com.zcloud.entity.PageData;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明:档案文件
|
||||
* 作者:luoxiaobao
|
||||
* 时间:2023-08-25
|
||||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
public interface ArchivesPdfFileService {
|
||||
|
||||
/**列表(全部N天以前)
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
List<PageData> listAllDaysAgo(PageData pd)throws Exception;
|
||||
|
||||
/**删除
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
void deleteDaysAgo(PageData pd)throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.zcloud.service.education.impl;
|
||||
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.mapper.dsno2.education.ArchivesPdfFileMapper;
|
||||
import com.zcloud.service.education.ArchivesPdfFileService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 说明:档案文件
|
||||
* 作者:luoxiaobao
|
||||
* 时间:2023-08-25
|
||||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
@Service
|
||||
@Transactional //开启事物
|
||||
public class ArchivesPdfFileServiceImpl implements ArchivesPdfFileService {
|
||||
|
||||
@Resource
|
||||
private ArchivesPdfFileMapper archivespdffileMapper;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 列表(N天前)
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<PageData> listAllDaysAgo(PageData pd) throws Exception {
|
||||
return archivespdffileMapper.listAllDaysAgo(pd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteDaysAgo(PageData pd) throws Exception {
|
||||
archivespdffileMapper.deleteDaysAgo(pd);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
package com.zcloud.service.system;
|
||||
|
||||
import com.zcloud.entity.Page;
|
||||
import com.zcloud.entity.PageData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明:附件上传日志
|
||||
* 作者:luoxiaobao
|
||||
* 时间:2022-08-24
|
||||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
public interface FileUploadLogService {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public void save(PageData pd) throws Exception;
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public void delete(PageData pd) throws Exception;
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public void edit(PageData pd) throws Exception;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param page
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<PageData> list(Page page) throws Exception;
|
||||
|
||||
/**
|
||||
* 列表(全部)
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<PageData> listAll(PageData pd) throws Exception;
|
||||
|
||||
/**
|
||||
* 通过id获取数据
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public PageData findById(PageData pd) throws Exception;
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ArrayDATA_IDS
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteAll(String[] ArrayDATA_IDS) throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.zcloud.service.system.impl;
|
||||
|
||||
import com.zcloud.entity.Page;
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.mapper.datasource.system.FileUploadLogMapper;
|
||||
import com.zcloud.service.system.FileUploadLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 说明:附件上传日志
|
||||
* 作者:luoxiaobao
|
||||
* 时间:2022-08-24
|
||||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
@Service
|
||||
@Transactional //开启事物
|
||||
public class FileUploadLogServiceImpl implements FileUploadLogService {
|
||||
|
||||
@Autowired
|
||||
private FileUploadLogMapper fileuploadlogMapper;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public void save(PageData pd) throws Exception {
|
||||
fileuploadlogMapper.save(pd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public void delete(PageData pd) throws Exception {
|
||||
fileuploadlogMapper.delete(pd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public void edit(PageData pd) throws Exception {
|
||||
fileuploadlogMapper.edit(pd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param page
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<PageData> list(Page page) throws Exception {
|
||||
return fileuploadlogMapper.datalistPage(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表(全部)
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<PageData> listAll(PageData pd) throws Exception {
|
||||
return fileuploadlogMapper.listAll(pd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id获取数据
|
||||
*
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public PageData findById(PageData pd) throws Exception {
|
||||
return fileuploadlogMapper.findById(pd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ArrayDATA_IDS
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteAll(String[] ArrayDATA_IDS) throws Exception {
|
||||
fileuploadlogMapper.deleteAll(ArrayDATA_IDS);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package com.zcloud.util;
|
||||
|
||||
import com.aliyun.oss.ClientException;
|
||||
import com.aliyun.oss.OSS;
|
||||
import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.aliyun.oss.OSSException;
|
||||
import com.aliyun.oss.model.OSSObject;
|
||||
import com.jcraft.jsch.ChannelSftp;
|
||||
import com.jcraft.jsch.JSchException;
|
||||
import com.jcraft.jsch.SftpATTRS;
|
||||
import com.jcraft.jsch.SftpException;
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.service.system.FileUploadLogService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.*;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class Smb {
|
||||
@Autowired
|
||||
private FileUploadLogService fileUploadLogService;
|
||||
|
||||
private static String endpoint = "https://oss-cn-zhangjiakou.aliyuncs.com";
|
||||
// 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
|
||||
private static String accessKeyId = "LTAI5tK134ZzXPEwykAdpVn2";
|
||||
private static String accessKeySecret = "XCEMY8FG52cXImFMeIiH4tDJ9BIN3N";
|
||||
// 填写Bucket名称。
|
||||
private static String bucketName = "qyag";
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @throws SftpException
|
||||
* @throws JSchException
|
||||
*/
|
||||
public void deleteFile(String directoryFile) throws Exception {
|
||||
|
||||
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
|
||||
|
||||
try {
|
||||
// 删除文件或目录。如果要删除目录,目录必须为空。
|
||||
ossClient.deleteObject(bucketName, "YTHFile" + directoryFile);
|
||||
} catch (OSSException oe) {
|
||||
PageData pd = new PageData();
|
||||
pd.put("FILE_PATH", directoryFile);
|
||||
fileUploadLogService.delete(pd);
|
||||
System.out.println("Caught an OSSException, which means your request made it to OSS, "
|
||||
+ "but was rejected with an error response for some reason.");
|
||||
System.out.println("Error Message:" + oe.getErrorMessage());
|
||||
System.out.println("Error Code:" + oe.getErrorCode());
|
||||
System.out.println("Request ID:" + oe.getRequestId());
|
||||
System.out.println("Host ID:" + oe.getHostId());
|
||||
} catch (ClientException ce) {
|
||||
System.out.println("Caught an ClientException, which means the client encountered "
|
||||
+ "a serious internal problem while trying to communicate with OSS, "
|
||||
+ "such as not being able to access the network.");
|
||||
System.out.println("Error Message:" + ce.getMessage());
|
||||
} finally {
|
||||
if (ossClient != null) {
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 填写Object完整路径,例如exampledir/exampleobject.txt。Object完整路径中不能包含Bucket名称。
|
||||
String objectName = "exampledir/exampleobject.txt";
|
||||
|
||||
// 创建OSSClient实例。
|
||||
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
|
||||
|
||||
try {
|
||||
// 调用ossClient.getObject返回一个OSSObject实例,该实例包含文件内容及文件元信息。
|
||||
OSSObject ossObject = ossClient.getObject(bucketName, objectName);
|
||||
// 调用ossObject.getObjectContent获取文件输入流,可读取此输入流获取其内容。
|
||||
InputStream content = ossObject.getObjectContent();
|
||||
if (content != null) {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(content));
|
||||
while (true) {
|
||||
String line = reader.readLine();
|
||||
if (line == null) break;
|
||||
System.out.println("\n" + line);
|
||||
}
|
||||
// 数据读取完成后,获取的流必须关闭,否则会造成连接泄漏,导致请求无连接可用,程序无法正常工作。
|
||||
content.close();
|
||||
}
|
||||
} catch (OSSException oe) {
|
||||
System.out.println("Caught an OSSException, which means your request made it to OSS, "
|
||||
+ "but was rejected with an error response for some reason.");
|
||||
System.out.println("Error Message:" + oe.getErrorMessage());
|
||||
System.out.println("Error Code:" + oe.getErrorCode());
|
||||
System.out.println("Request ID:" + oe.getRequestId());
|
||||
System.out.println("Host ID:" + oe.getHostId());
|
||||
} catch (ClientException ce) {
|
||||
System.out.println("Caught an ClientException, which means the client encountered "
|
||||
+ "a serious internal problem while trying to communicate with OSS, "
|
||||
+ "such as not being able to access the network.");
|
||||
System.out.println("Error Message:" + ce.getMessage());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (ossClient != null) {
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
<?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.zcloud.mapper.datasource.system.FileUploadLogMapper">
|
||||
|
||||
<!--表名 -->
|
||||
<sql id="tableName">
|
||||
BUS_FILEUPLOADLOG
|
||||
</sql>
|
||||
|
||||
<!--数据字典表名 -->
|
||||
<sql id="dicTableName">
|
||||
SYS_DICTIONARIES
|
||||
</sql>
|
||||
|
||||
<!-- 字段 -->
|
||||
<sql id="Field">
|
||||
f
|
||||
.
|
||||
CORPINFO_ID
|
||||
,
|
||||
f.CREATTIME,
|
||||
f.FILE_PATH,
|
||||
f.FILE_SIZE,
|
||||
f.FILEUPLOADLOG_ID
|
||||
</sql>
|
||||
|
||||
<!-- 字段用于新增 -->
|
||||
<sql id="Field2">
|
||||
CORPINFO_ID
|
||||
,
|
||||
CREATTIME,
|
||||
FILE_PATH,
|
||||
FILE_SIZE,
|
||||
FILEUPLOADLOG_ID
|
||||
</sql>
|
||||
|
||||
<!-- 字段值 -->
|
||||
<sql id="FieldValue">
|
||||
#{CORPINFO_ID}
|
||||
,
|
||||
#{CREATTIME},
|
||||
#{FILE_PATH},
|
||||
#{FILE_SIZE},
|
||||
#{FILEUPLOADLOG_ID}
|
||||
</sql>
|
||||
|
||||
<!-- 新增-->
|
||||
<insert id="save" parameterType="pd">
|
||||
insert into
|
||||
<include refid="tableName"></include>
|
||||
(
|
||||
<include refid="Field2"></include>
|
||||
) values (
|
||||
<include refid="FieldValue"></include>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 删除-->
|
||||
<delete id="delete" parameterType="pd">
|
||||
delete from
|
||||
<include refid="tableName"></include>
|
||||
where FILE_PATH = #{FILE_PATH}
|
||||
</delete>
|
||||
|
||||
<!-- 修改 -->
|
||||
<update id="edit" parameterType="pd">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
CORPINFO_ID = #{CORPINFO_ID},
|
||||
CREATTIME = #{CREATTIME},
|
||||
FILE_PATH = #{FILE_PATH},
|
||||
FILE_SIZE = #{FILE_SIZE},
|
||||
FILEUPLOADLOG_ID = FILEUPLOADLOG_ID
|
||||
where
|
||||
FILEUPLOADLOG_ID = #{FILEUPLOADLOG_ID}
|
||||
</update>
|
||||
|
||||
<!-- 通过ID获取数据 -->
|
||||
<select id="findById" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
f
|
||||
where
|
||||
f.FILEUPLOADLOG_ID = #{FILEUPLOADLOG_ID}
|
||||
</select>
|
||||
|
||||
<!-- 列表 -->
|
||||
<select id="datalistPage" parameterType="page" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
f
|
||||
where f.ISDELETE = '0'
|
||||
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
|
||||
and
|
||||
(
|
||||
<!-- 根据需求自己加检索条件
|
||||
字段1 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||||
or
|
||||
字段2 LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||||
-->
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 列表(全部) -->
|
||||
<select id="listAll" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
f
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 批量删除 -->
|
||||
<delete id="deleteAll" parameterType="String">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
ISDELETE = '1'
|
||||
where
|
||||
FILEUPLOADLOG_ID in
|
||||
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,88 @@
|
|||
<?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.zcloud.mapper.datasource.archives.ArchivesPdfFileMapper">
|
||||
|
||||
<!--表名 -->
|
||||
<sql id="tableName">
|
||||
BUS_ARCHIVES_PDF_FILE
|
||||
</sql>
|
||||
|
||||
<!--数据字典表名 -->
|
||||
<sql id="dicTableName">
|
||||
SYS_DICTIONARIES
|
||||
</sql>
|
||||
|
||||
<!-- 字段 -->
|
||||
<sql id="Field">
|
||||
f.TABLE_NAME,
|
||||
f.TABLE_ID,
|
||||
f.FILE_PATH,
|
||||
f.TYPE,
|
||||
f.STATUS,
|
||||
f.ERRORMSG,
|
||||
f.CREATOR,
|
||||
f.CREATTIME,
|
||||
f.ARCHIVES_PDF_FILE_ID,
|
||||
f.DESCR,
|
||||
f.METHOD_NAME,
|
||||
f.CLASS_NAME,
|
||||
f.PARAM_NAME
|
||||
</sql>
|
||||
|
||||
<!-- 字段用于新增 -->
|
||||
<sql id="Field2">
|
||||
TABLE_NAME,
|
||||
TABLE_ID,
|
||||
FILE_PATH,
|
||||
TYPE,
|
||||
STATUS,
|
||||
ERRORMSG,
|
||||
CREATOR,
|
||||
CREATTIME,
|
||||
ARCHIVES_PDF_FILE_ID,
|
||||
DESCR,
|
||||
METHOD_NAME,
|
||||
CLASS_NAME,
|
||||
PARAM_NAME
|
||||
</sql>
|
||||
|
||||
<!-- 字段值 -->
|
||||
<sql id="FieldValue">
|
||||
#{TABLE_NAME},
|
||||
#{TABLE_ID},
|
||||
#{FILE_PATH},
|
||||
#{TYPE},
|
||||
#{STATUS},
|
||||
#{ERRORMSG},
|
||||
#{CREATOR},
|
||||
#{CREATTIME},
|
||||
#{ARCHIVES_PDF_FILE_ID},
|
||||
#{DESCR},
|
||||
#{METHOD_NAME},
|
||||
#{CLASS_NAME},
|
||||
#{PARAM_NAME}
|
||||
</sql>
|
||||
|
||||
<!-- 列表(全部) -->
|
||||
<select id="listAllDaysAgo" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>
|
||||
from
|
||||
<include refid="tableName"></include> f
|
||||
where f.STATUS = '1'
|
||||
and f.FILE_PATH is not null
|
||||
and DATE_FORMAT(f.CREATTIME, '%Y-%m-%d' ) < DATE_FORMAT( DATE_SUB(NOW(), INTERVAL ${DAYNUM} DAY), '%Y-%m-%d' )
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!-- 删除-->
|
||||
<delete id="deleteDaysAgo" parameterType="pd">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
STATUS = '-2'
|
||||
where
|
||||
ARCHIVES_PDF_FILE_ID = #{ARCHIVES_PDF_FILE_ID}
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue