Commit 3d252dcb authored by muhong's avatar muhong

修改mybatis配置和足迹表结构

parent 8757b2a1
......@@ -50,9 +50,9 @@
<!--数据库链接地址账号密码-->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://pc-bp18q94o1mukb67hy.mysql.polardb.rds.aliyuncs.com:3306/video_dev?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=UTC&amp;verifyServerCertificate=false&amp;useSSL=false"
userId="video_dev"
password="VS1xaA37hyu1wJSw"/>
connectionURL="jdbc:mysql://pc-bp1l2k9j6ck1gr923.mysql.polardb.rds.aliyuncs.com:3306/quanku?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=UTC&amp;verifyServerCertificate=false&amp;useSSL=false"
userId="quanku"
password="3N0W8i0b1Wm35MJ5"/>
<!-- 类型转换 -->
<javaTypeResolver>
......@@ -63,16 +63,16 @@
<!--生成Model类存放位置-->
<javaModelGenerator targetPackage="com.wwdz.ch.db.domain" targetProject="src/main/java">
<javaModelGenerator targetPackage="com.wwdz.ch.db.domain" targetProject="ch-dao/src/main/java">
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<sqlMapGenerator targetPackage="com.wwdz.ch.db.dao" targetProject="src/main/resources"/>
<sqlMapGenerator targetPackage="com.wwdz.ch.db.dao" targetProject="ch-dao/src/main/resources"/>
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.dao"
targetProject="src/main/java"/>
targetProject="ch-dao/src/main/java"/>
<table tableName="business_return" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<table tableName="favorites_coins_relation" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<generatedKey column="id" sqlStatement="Mysql" identity="true" />
</table>
......
......@@ -61,6 +61,31 @@
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.28</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>com.itfsw</groupId>
<artifactId>mybatis-generator-plugin</artifactId>
<version>1.2.12</version>
</dependency>
</dependencies>
......
......@@ -44,11 +44,11 @@ public class Footprint {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dts_footprint.goods_id
* This field corresponds to the database column dts_footprint.coins_id
*
* @mbg.generated
*/
private Long goodsId;
private Long coinsId;
/**
*
......@@ -127,26 +127,26 @@ public class Footprint {
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column dts_footprint.goods_id
* This method returns the value of the database column dts_footprint.coins_id
*
* @return the value of dts_footprint.goods_id
* @return the value of dts_footprint.coins_id
*
* @mbg.generated
*/
public Long getGoodsId() {
return goodsId;
public Long getCoinsId() {
return coinsId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column dts_footprint.goods_id
* This method sets the value of the database column dts_footprint.coins_id
*
* @param goodsId the value for dts_footprint.goods_id
* @param coinsId the value for dts_footprint.coins_id
*
* @mbg.generated
*/
public void setGoodsId(Long goodsId) {
this.goodsId = goodsId;
public void setCoinsId(Long coinsId) {
this.coinsId = coinsId;
}
/**
......@@ -235,7 +235,7 @@ public class Footprint {
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", userId=").append(userId);
sb.append(", goodsId=").append(goodsId);
sb.append(", coinsId=").append(coinsId);
sb.append(", addTime=").append(addTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", deleted=").append(deleted);
......@@ -263,7 +263,7 @@ public class Footprint {
Footprint other = (Footprint) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getGoodsId() == null ? other.getGoodsId() == null : this.getGoodsId().equals(other.getGoodsId()))
&& (this.getCoinsId() == null ? other.getCoinsId() == null : this.getCoinsId().equals(other.getCoinsId()))
&& (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()));
......@@ -281,7 +281,7 @@ public class Footprint {
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getGoodsId() == null) ? 0 : getGoodsId().hashCode());
result = prime * result + ((getCoinsId() == null) ? 0 : getCoinsId().hashCode());
result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
......@@ -309,7 +309,7 @@ public class Footprint {
public enum Column {
id("id", "id", "BIGINT", false),
userId("user_id", "userId", "BIGINT", false),
goodsId("goods_id", "goodsId", "BIGINT", false),
coinsId("coins_id", "coinsId", "BIGINT", false),
addTime("add_time", "addTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false),
deleted("deleted", "deleted", "BIT", false);
......
......@@ -502,18 +502,18 @@ public class FootprintExample {
return (Criteria) this;
}
public Criteria andGoodsIdIsNull() {
addCriterion("goods_id is null");
public Criteria andCoinsIdIsNull() {
addCriterion("coins_id is null");
return (Criteria) this;
}
public Criteria andGoodsIdIsNotNull() {
addCriterion("goods_id is not null");
public Criteria andCoinsIdIsNotNull() {
addCriterion("coins_id is not null");
return (Criteria) this;
}
public Criteria andGoodsIdEqualTo(Long value) {
addCriterion("goods_id =", value, "goodsId");
public Criteria andCoinsIdEqualTo(Long value) {
addCriterion("coins_id =", value, "coinsId");
return (Criteria) this;
}
......@@ -524,13 +524,13 @@ public class FootprintExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andGoodsIdEqualToColumn(Footprint.Column column) {
addCriterion(new StringBuilder("goods_id = ").append(column.getEscapedColumnName()).toString());
public Criteria andCoinsIdEqualToColumn(Footprint.Column column) {
addCriterion(new StringBuilder("coins_id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andGoodsIdNotEqualTo(Long value) {
addCriterion("goods_id <>", value, "goodsId");
public Criteria andCoinsIdNotEqualTo(Long value) {
addCriterion("coins_id <>", value, "coinsId");
return (Criteria) this;
}
......@@ -541,13 +541,13 @@ public class FootprintExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andGoodsIdNotEqualToColumn(Footprint.Column column) {
addCriterion(new StringBuilder("goods_id <> ").append(column.getEscapedColumnName()).toString());
public Criteria andCoinsIdNotEqualToColumn(Footprint.Column column) {
addCriterion(new StringBuilder("coins_id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andGoodsIdGreaterThan(Long value) {
addCriterion("goods_id >", value, "goodsId");
public Criteria andCoinsIdGreaterThan(Long value) {
addCriterion("coins_id >", value, "coinsId");
return (Criteria) this;
}
......@@ -558,13 +558,13 @@ public class FootprintExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andGoodsIdGreaterThanColumn(Footprint.Column column) {
addCriterion(new StringBuilder("goods_id > ").append(column.getEscapedColumnName()).toString());
public Criteria andCoinsIdGreaterThanColumn(Footprint.Column column) {
addCriterion(new StringBuilder("coins_id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andGoodsIdGreaterThanOrEqualTo(Long value) {
addCriterion("goods_id >=", value, "goodsId");
public Criteria andCoinsIdGreaterThanOrEqualTo(Long value) {
addCriterion("coins_id >=", value, "coinsId");
return (Criteria) this;
}
......@@ -575,13 +575,13 @@ public class FootprintExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andGoodsIdGreaterThanOrEqualToColumn(Footprint.Column column) {
addCriterion(new StringBuilder("goods_id >= ").append(column.getEscapedColumnName()).toString());
public Criteria andCoinsIdGreaterThanOrEqualToColumn(Footprint.Column column) {
addCriterion(new StringBuilder("coins_id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andGoodsIdLessThan(Long value) {
addCriterion("goods_id <", value, "goodsId");
public Criteria andCoinsIdLessThan(Long value) {
addCriterion("coins_id <", value, "coinsId");
return (Criteria) this;
}
......@@ -592,13 +592,13 @@ public class FootprintExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andGoodsIdLessThanColumn(Footprint.Column column) {
addCriterion(new StringBuilder("goods_id < ").append(column.getEscapedColumnName()).toString());
public Criteria andCoinsIdLessThanColumn(Footprint.Column column) {
addCriterion(new StringBuilder("coins_id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andGoodsIdLessThanOrEqualTo(Long value) {
addCriterion("goods_id <=", value, "goodsId");
public Criteria andCoinsIdLessThanOrEqualTo(Long value) {
addCriterion("coins_id <=", value, "coinsId");
return (Criteria) this;
}
......@@ -609,28 +609,28 @@ public class FootprintExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andGoodsIdLessThanOrEqualToColumn(Footprint.Column column) {
addCriterion(new StringBuilder("goods_id <= ").append(column.getEscapedColumnName()).toString());
public Criteria andCoinsIdLessThanOrEqualToColumn(Footprint.Column column) {
addCriterion(new StringBuilder("coins_id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andGoodsIdIn(List<Long> values) {
addCriterion("goods_id in", values, "goodsId");
public Criteria andCoinsIdIn(List<Long> values) {
addCriterion("coins_id in", values, "coinsId");
return (Criteria) this;
}
public Criteria andGoodsIdNotIn(List<Long> values) {
addCriterion("goods_id not in", values, "goodsId");
public Criteria andCoinsIdNotIn(List<Long> values) {
addCriterion("coins_id not in", values, "coinsId");
return (Criteria) this;
}
public Criteria andGoodsIdBetween(Long value1, Long value2) {
addCriterion("goods_id between", value1, value2, "goodsId");
public Criteria andCoinsIdBetween(Long value1, Long value2) {
addCriterion("coins_id between", value1, value2, "coinsId");
return (Criteria) this;
}
public Criteria andGoodsIdNotBetween(Long value1, Long value2) {
addCriterion("goods_id not between", value1, value2, "goodsId");
public Criteria andCoinsIdNotBetween(Long value1, Long value2) {
addCriterion("coins_id not between", value1, value2, "coinsId");
return (Criteria) this;
}
......
......@@ -19,7 +19,7 @@ public class MyBatisGeneratorRun {
public void generator() throws Exception{
List<String> warnings = new ArrayList<String>();
boolean overwrite = true;
InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream("mybatis-generator/generatorConfig_new.xml");
InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream("ch-dao/mybatis-generator/generatorConfig_new.xml");
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(resourceAsStream);
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
......
......@@ -39,7 +39,7 @@ public class DtsFootprintService {
footprintMapper.insertSelective(footprint);
}
public List<Footprint> querySelective(String userId, String goodsId, Integer page, Integer size, String sort,
public List<Footprint> querySelective(String userId, String coinsId, Integer page, Integer size, String sort,
String order) {
FootprintExample example = new FootprintExample();
FootprintExample.Criteria criteria = example.createCriteria();
......@@ -47,8 +47,8 @@ public class DtsFootprintService {
if (!StringUtils.isEmpty(userId)) {
criteria.andUserIdEqualTo(Long.valueOf(userId));
}
if (!StringUtils.isEmpty(goodsId)) {
criteria.andGoodsIdEqualTo(Long.valueOf(goodsId));
if (!StringUtils.isEmpty(coinsId)) {
criteria.andCoinsIdEqualTo(Long.valueOf(coinsId));
}
criteria.andDeletedEqualTo(false);
......
......@@ -8,7 +8,7 @@
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="goods_id" jdbcType="BIGINT" property="goodsId" />
<result column="coins_id" jdbcType="BIGINT" property="coinsId" />
<result column="add_time" jdbcType="TIMESTAMP" property="addTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="deleted" jdbcType="BIT" property="deleted" />
......@@ -84,7 +84,7 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, user_id, goods_id, add_time, update_time, deleted
id, user_id, coins_id, add_time, update_time, deleted
</sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.FootprintExample" resultMap="BaseResultMap">
<!--
......@@ -121,7 +121,7 @@
</foreach>
</when>
<otherwise>
id, user_id, goods_id, add_time, update_time, deleted
id, user_id, coins_id, add_time, update_time, deleted
</otherwise>
</choose>
from footprint
......@@ -180,7 +180,7 @@
</foreach>
</when>
<otherwise>
id, user_id, goods_id, add_time, update_time, deleted
id, user_id, coins_id, add_time, update_time, deleted
</otherwise>
</choose>
from footprint
......@@ -212,9 +212,9 @@
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into footprint (user_id, goods_id, add_time,
insert into footprint (user_id, coins_id, add_time,
update_time, deleted)
values (#{userId,jdbcType=BIGINT}, #{goodsId,jdbcType=BIGINT}, #{addTime,jdbcType=TIMESTAMP},
values (#{userId,jdbcType=BIGINT}, #{coinsId,jdbcType=BIGINT}, #{addTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.Footprint">
......@@ -230,8 +230,8 @@
<if test="userId != null">
user_id,
</if>
<if test="goodsId != null">
goods_id,
<if test="coinsId != null">
coins_id,
</if>
<if test="addTime != null">
add_time,
......@@ -247,8 +247,8 @@
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="goodsId != null">
#{goodsId,jdbcType=BIGINT},
<if test="coinsId != null">
#{coinsId,jdbcType=BIGINT},
</if>
<if test="addTime != null">
#{addTime,jdbcType=TIMESTAMP},
......@@ -284,8 +284,8 @@
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.goodsId != null">
goods_id = #{record.goodsId,jdbcType=BIGINT},
<if test="record.coinsId != null">
coins_id = #{record.coinsId,jdbcType=BIGINT},
</if>
<if test="record.addTime != null">
add_time = #{record.addTime,jdbcType=TIMESTAMP},
......@@ -309,7 +309,7 @@
update footprint
set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
goods_id = #{record.goodsId,jdbcType=BIGINT},
coins_id = #{record.coinsId,jdbcType=BIGINT},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
deleted = #{record.deleted,jdbcType=BIT}
......@@ -327,8 +327,8 @@
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="goodsId != null">
goods_id = #{goodsId,jdbcType=BIGINT},
<if test="coinsId != null">
coins_id = #{coinsId,jdbcType=BIGINT},
</if>
<if test="addTime != null">
add_time = #{addTime,jdbcType=TIMESTAMP},
......@@ -349,7 +349,7 @@
-->
update footprint
set user_id = #{userId,jdbcType=BIGINT},
goods_id = #{goodsId,jdbcType=BIGINT},
coins_id = #{coinsId,jdbcType=BIGINT},
add_time = #{addTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
deleted = #{deleted,jdbcType=BIT}
......@@ -386,7 +386,7 @@
</foreach>
</when>
<otherwise>
id, user_id, goods_id, add_time, update_time, deleted
id, user_id, coins_id, add_time, update_time, deleted
</otherwise>
</choose>
from footprint
......
......@@ -107,10 +107,10 @@ public class WxFootprintController {
for (Footprint footprint : footprintList) {
Map<String, Object> c = new HashMap<String, Object>();
c.put("id", footprint.getId());
c.put("goodsId", footprint.getGoodsId());
c.put("coinsId", footprint.getCoinsId());
c.put("addTime", footprint.getAddTime());
Item item = itemService.findById(footprint.getGoodsId().longValue());
Item item = itemService.findById(footprint.getCoinsId().longValue());
c.put("name", item.getName());
c.put("retailPrice", item.getPrice());
c.put("image", item.getImages().split(";")[0]);
......
......@@ -110,7 +110,7 @@ public class WxGoodsController {
executorService.execute(() -> {
Footprint footprint = new Footprint();
footprint.setUserId(userId);
footprint.setGoodsId(id);
footprint.setCoinsId(id);
footprintService.add(footprint);
short num = 1;
productService.addBrowse(id.intValue(), num);// 新增商品点击量
......
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