账单-查询-调整查询条件顺序-uid_create_time

This commit is contained in:
khalil
2024-10-31 14:30:06 +08:00
parent 4b8473626f
commit c771712e73
2 changed files with 7 additions and 5 deletions

View File

@@ -93,14 +93,16 @@
<select id="roomPerNumBySendGiftRecordIds" resultType="java.lang.Double">
select IFNULL(sum(amount),0.0) from bill_record
where create_time between #{startTime} and #{endTime}
where uid = #{uid}
and create_time between #{startTime} and #{endTime}
and obj_type = 11
<if test="giftRecordIds != null and giftRecordIds.size >0">
and obj_id in
<foreach collection="giftRecordIds" item="objId" open="(" close=")" separator=",">
#{objId}
</foreach>
</if>
and uid = #{uid} and target_uid = #{targetUid} and obj_type = 11 limit 1
and target_uid = #{targetUid} limit 1
</select>
<insert id="batchInsert">

View File

@@ -370,8 +370,8 @@ public class BillRecordService extends ServiceImpl<BillRecordMapper, BillRecord>
objTypes.sort(Comparator.naturalOrder());
QueryWrapper<BillRecord> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(BillRecord::getUid, uid)
.in(BillRecord::getObjType, objTypes)
.between(BillRecord::getCreateTime, start, nextDate)
.in(BillRecord::getObjType, objTypes)
.orderByDesc(BillRecord::getCreateTime);
Page<BillRecord> page = new Page<>(pageNo, pageSize);
billRecordMapper.selectPage(page, wrapper);
@@ -384,8 +384,8 @@ public class BillRecordService extends ServiceImpl<BillRecordMapper, BillRecord>
QueryWrapper<BillRecord> wrapper = new QueryWrapper<>();
wrapper.lambda()
.eq(BillRecord::getUid, uid)
.in(BillRecord::getObjType, objTypes)
.between(BillRecord::getCreateTime, start, nextDate);
.between(BillRecord::getCreateTime, start, nextDate)
.in(BillRecord::getObjType, objTypes);
// TODO 针对活动支出记录为负号进行处理,暂时先处理 需优化
String objType = CollectionUtil.join(NEED_ABS_OBJ_TPYES, ",");