Commit bdfc06c2 authored by zhaobiyan's avatar zhaobiyan

会员积分模块

parent 659913ee
package cn.iocoder.yudao.framework.snowflake.config;
import cn.hutool.core.lang.generator.SnowflakeGenerator;
import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration;
import cn.iocoder.yudao.framework.redis.helper.RedisHelper;
import io.micrometer.core.instrument.util.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.annotation.Resource;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* @author zhaobiyan
*/
@Slf4j
@Configuration
@AutoConfigureAfter(YudaoRedisAutoConfiguration.class)
public class SnowFlakeConfiguration {
@Resource
private RedisHelper redisHelper;
@Bean
public SnowflakeGenerator snowflakeGenerator() throws UnknownHostException {
String hostAddress = InetAddress.getLocalHost().getHostAddress();
log.info("snow flask configuration, host address:{}", hostAddress);
String workId = redisHelper.get("snowflake:work:id:" + hostAddress);
if (StringUtils.isBlank(workId)) {
Long nextWorkId = redisHelper.incrBy("incr:work:id", 1);
redisHelper.set("snowflake:work:id:" + hostAddress, String.valueOf(nextWorkId));
workId = String.valueOf(nextWorkId);
}
return new SnowflakeGenerator(Long.parseLong(workId), 0);
}
}
......@@ -25,4 +25,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
cn.iocoder.yudao.framework.pay.config.YudaoPayAutoConfiguration,\
cn.iocoder.yudao.framework.customizer.CustomizationAutoConfiguration,\
cn.iocoder.yudao.framework.i18n.config.LocaleAutoConfiguration,\
cn.iocoder.yudao.framework.limiter.RedisLimiterConfiguration
cn.iocoder.yudao.framework.limiter.RedisLimiterConfiguration,\
cn.iocoder.yudao.framework.snowflake.config.SnowFlakeConfiguration
package cn.iocoder.yudao.module.member.dal.mysql.memberUserScore;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore.MemberUserScoreDO;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreQueryVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 会员积分 Mapper
* @author 系统管理员
*/
@Mapper
public interface MemberUserScoreMapper extends AbstractMapper<MemberUserScoreDO> {
@Override
default PageResult<MemberUserScoreDO> selectPage(PageVO page, Object object) {
if (object instanceof MemberUserScoreQueryVO) {
MemberUserScoreQueryVO vo = (MemberUserScoreQueryVO)object;
return selectPage(page, new LambdaQuery<MemberUserScoreDO>()
.eqIfPresent(MemberUserScoreDO::getMemberId, vo.getMemberId())
.eqIfPresent(MemberUserScoreDO::getHoldScore, vo.getHoldScore())
.eqIfPresent(MemberUserScoreDO::getUsedScore, vo.getUsedScore())
.eqIfPresent(MemberUserScoreDO::getExpiredScore, vo.getExpiredScore())
.betweenIfPresent(MemberUserScoreDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
.orderByDesc(MemberUserScoreDO::getId));
}
return null;
}
@Override
default List<MemberUserScoreDO> selectList(Object object) {
if (object instanceof MemberUserScoreQueryVO) {
MemberUserScoreQueryVO vo = (MemberUserScoreQueryVO)object;
return selectList(new LambdaQuery<MemberUserScoreDO>()
.eqIfPresent(MemberUserScoreDO::getMemberId, vo.getMemberId())
.eqIfPresent(MemberUserScoreDO::getHoldScore, vo.getHoldScore())
.eqIfPresent(MemberUserScoreDO::getUsedScore, vo.getUsedScore())
.eqIfPresent(MemberUserScoreDO::getExpiredScore, vo.getExpiredScore())
.betweenIfPresent(MemberUserScoreDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
.orderByDesc(MemberUserScoreDO::getId));
}
return null;
}
}
......@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.member.service.memberUserScore;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.member.convert.memberUserScore.MemberUserScoreConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore.MemberUserScoreDO;
import cn.iocoder.yudao.module.member.dal.mysql.memberUserScore.MemberUserScoreMapper;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreBackVO;
......@@ -46,7 +45,6 @@ public class MemberUserScoreServiceImpl extends AbstractService<MemberUserScoreM
@Override
public PageResult<MemberUserScoreBackVO> getUserScorePage(MemberUserScoreQueryVO query, PageVO page) {
PageResult<MemberUserScoreBackVO> pageResult = new PageResult<>();
pageResult.set
return pageResult;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment