huangxiao преди 1 месец
родител
ревизия
67d5df36fd
променени са 2 файла, в които са добавени 7 реда и са изтрити 15 реда
  1. 5 13
      src/main/java/net/mingsoft/tf/www/BrowseAction.java
  2. 2 2
      src/main/resources/application.yml

+ 5 - 13
src/main/java/net/mingsoft/tf/www/BrowseAction.java

@@ -42,14 +42,14 @@ public class BrowseAction {
 
     private void saveBrowseRecordsEntity(BrowseRecordsEntity entity) {
         browseRecordsBiz.save(entity);
-        browseRecordsBiz.update("DELETE FROM mdiy_form_browse_records WHERE id NOT IN (SELECT id FROM (SELECT id FROM mdiy_form_browse_records ORDER BY create_date DESC LIMIT ?) AS tmp)", 30);
+        browseRecordsBiz.update("DELETE FROM mdiy_form_browse_records WHERE id NOT IN (SELECT id FROM (SELECT id FROM mdiy_form_browse_records ORDER BY id desc LIMIT ?) AS tmp)", 30);
     }
 
     private void incrementDailyVisits() {
         Date now = new Date();
         String time = DatePattern.NORM_DATE_FORMAT.format(now);
         if (day.contains(time)) {
-            browseBiz.update("update mdiy_form_browse set BROWSE_VISITS = BROWSE_VISITS + 1 where BROWSE_DATA = now()");
+            browseBiz.update("update mdiy_form_browse set BROWSE_VISITS = BROWSE_VISITS + 1 where BROWSE_DATA = ?", time);
         } else {
             BrowseEntity browseEntity = browseBiz.getOne(new LambdaQueryWrapper<>(BrowseEntity.class).eq(BrowseEntity::getBrowseData, time));
             if (browseEntity == null) {
@@ -65,22 +65,14 @@ public class BrowseAction {
     }
 
     private void incrementVisits(BrowseRecordsEntity entity) {
-        String sql = "";
-        String id = null;
         if (StrUtil.isNotBlank(entity.getRecordsEnterpriseId())) {
-            id = entity.getRecordsEnterpriseId();
-            sql = "update mdiy_form_enterprise set ENTERPRISE_VISITS = ifnull(ENTERPRISE_VISITS, 0) + 1 where id = ?";
+            browseBiz.update("update mdiy_form_enterprise set ENTERPRISE_VISITS = ifnull(ENTERPRISE_VISITS, 0) + 1 where id = ?", entity.getRecordsEnterpriseId());
         }
         if (StrUtil.isNotBlank(entity.getRecordsDesignId())) {
-            id = entity.getRecordsDesignId();
-            sql = "update mdiy_form_design set DESIGN_VISITS = ifnull(DESIGN_VISITS, 0) + 1 where id = ?";
+            browseBiz.update("update mdiy_form_design set DESIGN_VISITS = ifnull(DESIGN_VISITS, 0) + 1 where id = ?", entity.getRecordsDesignId());
         }
         if (StrUtil.isNotBlank(entity.getRecordsProductsId())) {
-            id = entity.getRecordsProductsId();
-            sql = "update mdiy_form_enterprise_products set PRODUCT_VISITS = ifnull(PRODUCT_VISITS, 0) + 1 where id = ?";
-        }
-        if (StrUtil.isNotBlank(sql) && StrUtil.isNotBlank(id)) {
-            browseBiz.update(sql, id);
+            browseBiz.update("update mdiy_form_enterprise_products set PRODUCT_VISITS = ifnull(PRODUCT_VISITS, 0) + 1 where id = ?", entity.getRecordsProductsId());
         }
     }
 }

+ 2 - 2
src/main/resources/application.yml

@@ -19,8 +19,8 @@ server:
 #配置日志
 logging:
   level:
-    net.mingsoft: debug
-    net.mingsoft.base.dao.IBaseDao: debug
+    net.mingsoft: warn
+    net.mingsoft.base.dao.IBaseDao: warn
     org.springframework: error
     springfox.documentation: error
     com.baomidou: error