Commit b01e502c by 宋祥

1.预览和下载记录数+1

parent 53857b14
package com.baosight.hggp.hg.wd.constant;
/**
* @author:songx
* @date:2024/8/16,15:51
*/
public class HgWdSqlConstant {
/**
* HGWD001 SQL定义
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class HgWd001 {
// 预览自增
public static final String PREVIEW_INCR = "HGWD001.previewIncr";
// 下载自增
public static final String DOWNLOAD_INCR = "HGWD001.downloadIncr";
}
}
......@@ -91,6 +91,9 @@ public class ServiceHGWD001B extends ServiceBase {
try {
List<HGWD001B> fWd001bs = MapUtils.toDaoEPBases(inInfo, HGWD001B.class);
for (HGWD001B fWd001b : fWd001bs) {
// 预览记录+1
HGWDTools.HgWd001.previewIncr(fWd001b.getFileId());
// 新增
DaoUtils.insert(HGWD001B.INSERT, fWd001b);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
......
......@@ -88,6 +88,9 @@ public class ServiceHGWD001C extends ServiceBase {
try {
List<HGWD001C> fWd001cs = MapUtils.toDaoEPBases(inInfo, HGWD001C.class);
for (HGWD001C fWd001c : fWd001cs) {
// 下载记录+1
HGWDTools.HgWd001.previewIncr(fWd001c.getFileId());
// 新增
DaoUtils.insert(HGWD001C.INSERT, fWd001c);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
......
......@@ -173,4 +173,23 @@
WHERE ID = #id#
</update>
<!-- 预览自增 -->
<update id="previewIncr">
UPDATE ${hggpSchema}.HGWD001
SET
PREVIEW_NUM = PREVIEW_NUM + 1,
<include refid="SqlBase.updateRevise"/>
WHERE FILE_ID = #fileId#
</update>
<!-- 下载自增 -->
<update id="downloadIncr">
UPDATE ${hggpSchema}.HGWD001
SET
DOWNLOAD_NUM = DOWNLOAD_NUM + 1,
<include refid="SqlBase.updateRevise"/>
WHERE FILE_ID = #fileId#
</update>
</sqlMap>
......@@ -2,7 +2,9 @@ package com.baosight.hggp.hg.wd.tools;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.sb.domain.HGSB002;
import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.util.AssertUtils;
......@@ -36,6 +38,30 @@ public class HGWDTools {
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 预览记录自增
*
* @param fileId
*/
public static void previewIncr(String fileId) {
AssertUtils.isNull(fileId, "文件ID不能为空");
Map queryMap = new HashMap();
queryMap.put(HGWD001.FIELD_FILE_ID, fileId);
DaoUtils.update(HgWdSqlConstant.HgWd001.PREVIEW_INCR, queryMap);
}
/**
* 下载记录自增
*
* @param fileId
*/
public static void downloadIncr(String fileId) {
AssertUtils.isNull(fileId, "文件ID不能为空");
Map queryMap = new HashMap();
queryMap.put(HGWD001.FIELD_FILE_ID, fileId);
DaoUtils.update(HgWdSqlConstant.HgWd001.DOWNLOAD_INCR, queryMap);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment