无关风月
2025-04-11 75942ecc2e438012c5ea876715966ace593565a0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.ruoyi.study.service.impl;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.study.domain.TIntegralRecord;
import com.ruoyi.study.mapper.TIntegralRecordMapper;
import com.ruoyi.study.service.ITIntegralRecordService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * <p>
 * 自主游戏 服务实现类
 * </p>
 *
 * @author 无关风月
 * @since 2024-04-26
 */
@Service
public class TIntegralRecordServiceImpl extends ServiceImpl<TIntegralRecordMapper, TIntegralRecord> implements ITIntegralRecordService {
 
    @Resource
    private TokenService tokenService;
 
    @Override
    public IPage<TIntegralRecord> integralDetail(Page<TIntegralRecord> page, Integer userId, String time) {
 
        return baseMapper.integralDetail(userId, time, page);
    }
 
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Boolean add(String integral, String method, Integer gameId, Integer storyId, Integer difficulty, Integer storyType) {
        TIntegralRecord integralRecord = new TIntegralRecord();
        integralRecord.setIntegral(integral);
        integralRecord.setMethod(method);
        integralRecord.setUserId(tokenService.getLoginUserStudy().getUserid());
        integralRecord.setGameId(gameId);
        integralRecord.setStoryId(storyId);
        integralRecord.setGameDifficulty(difficulty);
        integralRecord.setStoryType(storyType);
        return this.save(integralRecord);
    }
}