| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Override |
| | | public IPage<TIntegralRecord> integralDetail(Page<TIntegralRecord> page, Integer userId, String time) { |
| | | return baseMapper.integralDetail(userId, time, page); |
| | | IPage<TIntegralRecord> tIntegralRecordIPage = baseMapper.integralDetail(userId, time, page); |
| | | List<TIntegralRecord> records = tIntegralRecordIPage.getRecords(); |
| | | for (TIntegralRecord record : records) { |
| | | if (!record.getIntegral().equals("0") && (!record.getIntegral().contains("-"))){ |
| | | record.setIntegral("+" + record.getIntegral()); |
| | | } |
| | | } |
| | | tIntegralRecordIPage.setRecords(records); |
| | | return tIntegralRecordIPage; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean add(String integral, String method, Integer gameId, Integer storyId) { |
| | | 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); |
| | | } |
| | | } |