Bladeren bron

banner统计

huangzhiguo 1 jaar geleden
bovenliggende
commit
f1be6f8364

+ 1 - 1
src/main/java/com/caimei365/commodity/controller/StatisticsTypeApi.java

@@ -28,7 +28,7 @@ public class StatisticsTypeApi {
         if (null == typeId) {
             return ResponseJson.error("类别id为空,统计失败"+typeId);
         }
-        return ResponseJson.success(statisticsTypeService.alterTypeNumber(typeId, bannerId));
+        return statisticsTypeService.alterTypeNumber(typeId, bannerId);
     }
 
 }

+ 1 - 1
src/main/java/com/caimei365/commodity/mapper/StatisticsTypeMapper.java

@@ -18,5 +18,5 @@ public interface StatisticsTypeMapper {
     /**
      * 修改类型数量
      */
-    int updataTypeNumber(@Param("typeId") Integer typeId, @Param("bannerId")Integer bannerId);
+    void insertTypeNumber(@Param("typeId") Integer typeId, @Param("bannerId")Integer bannerId);
 }

+ 5 - 3
src/main/java/com/caimei365/commodity/service/impl/StatisticsTypeServiceImpl.java

@@ -3,6 +3,7 @@ package com.caimei365.commodity.service.impl;
 import com.caimei365.commodity.mapper.StatisticsTypeMapper;
 import com.caimei365.commodity.model.ResponseJson;
 import com.caimei365.commodity.service.StatisticsTypeService;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -14,6 +15,7 @@ import java.util.Date;
  * @创建时间 2022/8/30
  * @描述
  */
+@Slf4j
 @Service
 public class StatisticsTypeServiceImpl implements StatisticsTypeService {
 
@@ -26,10 +28,10 @@ public class StatisticsTypeServiceImpl implements StatisticsTypeService {
     @Override
     public ResponseJson alterTypeNumber(Integer typeId, Integer bannerId) {
         // 统计为 banner 进入时应记录 bannerId 统计 banner 点击次数
-        if (1 == typeId) {
+        if (1 == typeId && null == bannerId) {
             return ResponseJson.error(-1, "bannerId不能为空", null);
         }
-        int i = typeMapper.updataTypeNumber(typeId, bannerId);
-        return ResponseJson.success(i);
+        typeMapper.insertTypeNumber(typeId, bannerId);
+        return ResponseJson.success();
     }
 }

+ 1 - 1
src/main/resources/mapper/StatisticsTypeMapper.xml

@@ -1,7 +1,7 @@
 <?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.caimei365.commodity.mapper.StatisticsTypeMapper">
-    <update id="updataTypeNumber" parameterType="com.caimei365.commodity.model.po.StatisticsTypePo">
+    <update id="insertTypeNumber" parameterType="com.caimei365.commodity.model.po.StatisticsTypePo">
         insert into cm_statistics_type(typeId, bannerId, clickTime) values (#{typeId}, #{bannerId}, now())
     </update>
 </mapper>