package com.xcong.excoin.modules.fish.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.xcong.excoin.common.entity.FebsResponse; import com.xcong.excoin.common.entity.QueryRequest; import com.xcong.excoin.modules.fish.dto.MemberDto; import com.xcong.excoin.modules.fish.entity.CannonAccountMoneyChange; import com.xcong.excoin.modules.fish.entity.CannonExchangeRatio; import com.xcong.excoin.modules.fish.entity.CannonSetting; import com.xcong.excoin.modules.fish.mapper.CannonExchangeRatioMapper; import com.xcong.excoin.modules.fish.mapper.CannonSettingMapper; import com.xcong.excoin.modules.fish.service.FishService; import com.xcong.excoin.modules.fish.vo.CannonAccountMoneyChangeVo; import com.xcong.excoin.modules.fish.vo.MemberVo; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @Slf4j @Service @RequiredArgsConstructor public class FishServiceImpl extends ServiceImpl implements FishService { private final CannonExchangeRatioMapper cannonExchangeRatioMapper; private final CannonSettingMapper cannonSettingMapper; @Override public IPage exchangeRatio(CannonExchangeRatio cannonExchangeRatio, QueryRequest request) { Page page = new Page<>(request.getPageNum(), request.getPageSize()); IPage cannonExchangeRatioIPage = cannonExchangeRatioMapper.findExchangeRatioInPage(page, cannonExchangeRatio); return cannonExchangeRatioIPage; } @Override public CannonExchangeRatio getExchangeRatioInfoById(long id) { CannonExchangeRatio cannonExchangeRatio = cannonExchangeRatioMapper.selectById(id); return cannonExchangeRatio; } @Override public IPage cannonList(CannonSetting cannonSetting, QueryRequest request) { Page page = new Page<>(request.getPageNum(), request.getPageSize()); IPage cannonSettingIPage = cannonExchangeRatioMapper.findCannonSettingInPage(page, cannonSetting); return cannonSettingIPage; } @Override public void cannonAdd(CannonSetting cannonSetting) { CannonSetting cannonSettingNew = new CannonSetting(); cannonSettingNew.setName(cannonSetting.getName()); cannonSettingNew.setCode(cannonSetting.getCode()); cannonSettingNew.setExchangePrice(cannonSetting.getExchangePrice()); cannonSettingNew.setGoldConsume(cannonSetting.getGoldConsume()); cannonSettingNew.setCannonImg(cannonSetting.getCannonImg()); cannonSettingNew.setBulletImg(cannonSettingNew.getBulletImg()); cannonSettingMapper.insert(cannonSettingNew); } @Override public CannonSetting getCannonInfoById(long id) { return cannonSettingMapper.selectById(id); } @Override public FebsResponse cannonUpdate(CannonSetting cannonSetting) { cannonSettingMapper.updateById(cannonSetting); return new FebsResponse().success(); } @Override public FebsResponse exchangeRatioUpdate(CannonExchangeRatio cannonExchangeRatio) { Long id = cannonExchangeRatio.getId(); CannonExchangeRatio cannonExchangeRatioOld = cannonExchangeRatioMapper.selectById(id); cannonExchangeRatioOld.setCoinRatio(cannonExchangeRatio.getCoinRatio()); cannonExchangeRatioMapper.updateById(cannonExchangeRatioOld); return new FebsResponse().success(); } @Override public IPage accountList(CannonAccountMoneyChange cannonAccountMoneyChange, QueryRequest request) { Page page = new Page<>(request.getPageNum(), request.getPageSize()); IPage cannonAccountMoneyChangeVoIPage = cannonExchangeRatioMapper.findCannonAccountMoneyChangeInPage(page, cannonAccountMoneyChange); return cannonAccountMoneyChangeVoIPage; } @Override public IPage memberList(MemberDto memberDto, QueryRequest request) { Page page = new Page<>(request.getPageNum(), request.getPageSize()); IPage memberVos = cannonExchangeRatioMapper.findMemberVoInPage(page, memberDto); return memberVos; } }