瀏覽代碼

fix 空指针

zoujiajian 3 年之前
父節點
當前提交
d43e431102
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      netflix-dao/src/main/java/com/cyksj/mapper/market/sign/UserPointsRecordMapper.java

+ 4 - 4
netflix-dao/src/main/java/com/cyksj/mapper/market/sign/UserPointsRecordMapper.java

@@ -12,16 +12,16 @@ public interface UserPointsRecordMapper extends BaseMapper<UserPointsRecord> {
 	@Update("update user set active_points = active_points + #{points} where id = #{userId}")
 	void updateUserPoints(@Param("userId") Long userId, @Param("points") Integer points);
 
-	@Select("select sum(points) from user_points_record ur where created_time between #{yesZeroDate} and #{thisZeroDate} and points > 0")
+	@Select("select ifnull(sum(points),0) from user_points_record ur where created_time between #{yesZeroDate} and #{thisZeroDate} and points > 0")
 	Integer getTodayNumOfPoints(@Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate);
 
-	@Select("select sum(points) from user_points_record ur where points > 0")
+	@Select("select ifnull(sum(points),0) from user_points_record ur where points > 0")
 	Integer getSumOfPoints();
 
-	@Select("select sum(points) from user_points_record ur where created_time between #{yesZeroDate} and #{thisZeroDate} and points < 0")
+	@Select("select ifnull(sum(points),0) from user_points_record ur where created_time between #{yesZeroDate} and #{thisZeroDate} and points < 0")
 	Integer getTodayUseOfPoints(@Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate);
 
-	@Select("select sum(points) from user_points_record ur where points < 0")
+	@Select("select ifnull(sum(points),0) from user_points_record ur where points < 0")
 	Integer getSumUseOfPoints();
 
 	@Select("select count(*) from user_points_record ur where created_time between #{yesZeroDate} and #{thisZeroDate} and points < 0 and remark = #{remark}")