提交 41b321f5 编写于 作者: 9 90-nk

遇到了无法解决的报错,麻烦小傅哥帮忙看一下

上级 8f7e1057
...@@ -25,10 +25,8 @@ ...@@ -25,10 +25,8 @@
<developers> <developers>
<developer> <developer>
<name>xiaofuge</name> <name>郭雨</name>
<email>184172133@qq.com</email> <email>964587616@qq.com</email>
<organization>fuzhengwei</organization>
<organizationUrl>https://github.com/fuzhengwei</organizationUrl>
</developer> </developer>
</developers> </developers>
......
package cn.bugstack; package cn.bugstack;
import org.apache.ibatis.annotations.Mapper;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Configurable; import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication @SpringBootApplication
@Configurable @Configurable
@EnableScheduling
public class Application { public class Application {
public static void main(String[] args){ public static void main(String[] args){
......
...@@ -17,7 +17,7 @@ spring: ...@@ -17,7 +17,7 @@ spring:
datasource: datasource:
username: root username: root
password: root password: root
url: jdbc:mysql://192.168.119.130/big_market?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC&useSSL=true url: jdbc:mysql://117.7.2:3306/big_market?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC&useSSL=true
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
hikari: hikari:
pool-name: Retail_HikariCP pool-name: Retail_HikariCP
...@@ -30,9 +30,9 @@ spring: ...@@ -30,9 +30,9 @@ spring:
connection-test-query: SELECT 1 connection-test-query: SELECT 1
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
#mybatis: mybatis:
# mapper-locations: classpath:/mybatis/mapper/*.xml mapper-locations: classpath:/mybatis/mapper/*.xml
# config-location: classpath:/mybatis/config/mybatis-config.xml config-location: classpath:/mybatis/config/mybatis-config.xml
# 日志 # 日志
logging: logging:
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.bugstack.infrastructure.persistent.dao.IStrategyAwardDao">
<resultMap id="dataMap" type="cn.bugstack.infrastructure.persistent.po.StrategyAward">
<id column="id" property="id"/>
<result column="strategy_id" property="strategyId"/>
<result column="award_id" property="awardId"/>
<result column="award_title" property="awardTitle"/>
<result column="award_subtitle" property="awardSubtitle"/>
<result column="award_count" property="awardCount"/>
<result column="award_count_surplus" property="awardCountSurplus"/>
<result column="award_rate" property="awardRate"/>
<result column="rule_models" property="ruleModels"/>
<result column="sort" property="sort"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<select id="queryStrategyAwardList" resultMap="dataMap">
select strategy_id
from strategy_award
limit 10
</select>
<select id="queryStrategyAwardListByStrategyId" parameterType="java.lang.Long" resultMap="dataMap">
select strategy_id, award_id, award_title, award_subtitle, award_count, award_count_surplus, award_rate, sort
from strategy_award
where strategy_id = #{strategyId}
order by sort asc
</select>
<select id="queryStrategyAwardRuleModels" parameterType="cn.bugstack.infrastructure.persistent.po.StrategyAward" resultType="java.lang.String">
select rule_models from strategy_award
where strategy_id = #{strategyId} and award_id = #{awardId}
</select>
<update id="updateStrategyAwardStock" parameterType="cn.bugstack.infrastructure.persistent.po.StrategyAward">
update strategy_award
set award_count_surplus = award_count_surplus - 1
where strategy_id = #{strategyId} and award_id = #{awardId} and award_count_surplus > 0
</update>
<select id="queryStrategyAward" parameterType="cn.bugstack.infrastructure.persistent.po.StrategyAward" resultMap="dataMap">
select strategy_id, award_id, award_title, award_subtitle, award_count, award_count_surplus, award_rate, rule_models, sort
from strategy_award
where strategy_id = #{strategyId} and award_id = #{awardId}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.bugstack.infrastructure.persistent.dao.IStrategyDao">
<resultMap id="dataMap" type="cn.bugstack.infrastructure.persistent.po.Strategy">
<id column="id" property="id"/>
<result column="strategy_id" property="strategyId"/>
<result column="strategy_desc" property="strategyDesc"/>
<result column="rule_models" property="ruleModels"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<select id="queryStrategyList" resultMap="dataMap">
select strategy_id
from strategy
limit 10
</select>
<select id="queryStrategyByStrategyId" parameterType="java.lang.Long" resultMap="dataMap">
select strategy_id, strategy_desc, rule_models
from strategy
where strategy_id = #{strategyId}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.bugstack.infrastructure.persistent.dao.IStrategyRuleDao">
<resultMap id="dataMap" type="cn.bugstack.infrastructure.persistent.po.StrategyRule">
<id column="id" property="id"/>
<result column="strategy_id" property="strategyId"/>
<result column="award_id" property="awardId"/>
<result column="rule_type" property="ruleType"/>
<result column="rule_model" property="ruleModel"/>
<result column="rule_value" property="ruleValue"/>
<result column="rule_desc" property="ruleDesc"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<select id="queryStrategyRuleList" resultMap="dataMap">
select strategy_id
from strategy_rule
limit 10
</select>
<select id="queryStrategyRule" parameterType="cn.bugstack.infrastructure.persistent.po.StrategyRule" resultMap="dataMap">
select strategy_id, award_id, rule_type, rule_model, rule_value, rule_desc
from strategy_rule
where strategy_id = #{strategyId} and rule_model = #{ruleModel}
</select>
<select id="queryStrategyRuleValue" parameterType="cn.bugstack.infrastructure.persistent.po.StrategyRule" resultType="java.lang.String">
select rule_value from strategy_rule
where strategy_id = #{strategyId} and rule_model = #{ruleModel}
<if test="awardId != null">
and award_id = #{awardId}
</if>
</select>
</mapper>
package cn.bugstack.test; package cn.bugstack.test.infrastructure;
import cn.bugstack.infrastructure.persistent.dao.IAwardDao; import cn.bugstack.infrastructure.persistent.dao.IAwardDao;
import cn.bugstack.infrastructure.persistent.po.Award; import cn.bugstack.infrastructure.persistent.po.Award;
...@@ -6,6 +6,8 @@ import com.alibaba.fastjson2.JSON; ...@@ -6,6 +6,8 @@ import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
......
package cn.bugstack.infrastructure.persistent.dao;
import cn.bugstack.infrastructure.persistent.po.Award;
import org.apache.ibatis.annotations.Mapper;
import javax.annotation.Resource;
import java.util.List;
/**
* @author Hugohimself
* @description 奖品表DAO
*/
@Mapper
public interface IAwardDao {
List<Award> queryAwardList();
}
package cn.bugstack.infrastructure.persistent.dao;
import cn.bugstack.infrastructure.persistent.po.StrategyAward;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Hugohimself
* @description 抽奖策略奖品明细配置 - 概率、规则 DAO
*/
@Mapper
public interface IStrategyAwardDao {
List<StrategyAward> queryStrategyAwardList();
List<StrategyAward> queryStrategyAwardListByStrategyId(Long strategyId);
String queryStrategyAwardRuleModels(StrategyAward strategyAward);
void updateStrategyAwardStock(StrategyAward strategyAward);
StrategyAward queryStrategyAward(StrategyAward strategyAwardReq);
}
package cn.bugstack.infrastructure.persistent.dao;
import cn.bugstack.infrastructure.persistent.po.Strategy;
import cn.bugstack.infrastructure.persistent.po.StrategyAward;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Hugohimself
* @description 抽奖策略 DAO
*/
@Mapper
public interface IStrategyDao {
List<Strategy> queryStrategyList();
Strategy queryStrategyByStrategyId(Long strategyId);
}
package cn.bugstack.infrastructure.persistent.dao;
import cn.bugstack.infrastructure.persistent.po.StrategyRule;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* @author Hugohimself
* @description 策略规则 DAO
*/
@Mapper
public interface IStrategyRuleDao {
List<StrategyRule> queryStrategyRuleList();
StrategyRule queryStrategyRule(StrategyRule strategyRuleReq);
String queryStrategyRuleValue(StrategyRule strategyRule);
}
package cn.bugstack.infrastructure.persistent.po;
import lombok.Data;
import java.util.Date;
/**
* @author Hugohimself
* @description 奖品表
*/
@Data
public class Award {
/** 自增ID */
private Long id;
/** 抽奖奖品ID - 内部流转使用 */
private Integer awardId;
/** 奖品对接标识 - 每一个都是一个对应的发奖策略 */
private String awardKey;
/** 奖品配置信息 */
private String awardConfig;
/** 奖品内容描述 */
private String awardDesc;
/** 创建时间 */
private Date createTime;
/** 更新时间 */
private Date updateTime;
}
package cn.bugstack.infrastructure.persistent.po;
import lombok.Data;
import java.util.Date;
/**
* @author Hugohimself
* @description 策略规则
*/
@Data
public class StrategyRule {
/** 自增ID */
private Long id;
/** 抽奖策略ID */
private Long strategyId;
/** 抽奖奖品ID【规则类型为策略,则不需要奖品ID】 */
private Integer awardId;
/** 抽象规则类型;1-策略规则、2-奖品规则 */
private Integer ruleType;
/** 抽奖规则类型【rule_random - 随机值计算、rule_lock - 抽奖几次后解锁、rule_luck_award - 幸运奖(兜底奖品)】 */
private String ruleModel;
/** 抽奖规则比值 */
private String ruleValue;
/** 抽奖规则描述 */
private String ruleDesc;
/** 创建时间 */
private Date createTime;
/** 更新时间 */
private Date updateTime;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册