Browse Source

fix 空指针

zoujiajian 3 năm trước cách đây
mục cha
commit
d43e431102

+ 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}")