Skip to content

Commit

Permalink
新增generator模块用于自动生成mapper实体类,更新README
Browse files Browse the repository at this point in the history
  • Loading branch information
techa03 committed Jul 1, 2018
1 parent 4dfdc3b commit 455fec3
Show file tree
Hide file tree
Showing 21 changed files with 425 additions and 34 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ SonarQube | 项目代码质量监控 | [https://www.sonarqube.org/](https://www.
Swagger2 | 项目API文档生成及测试工具 | [http://swagger.io/](http://swagger.io/)
Jmock | mock类生成测试工具 | [http://www.jmock.org/](http://www.jmock.org/)
Jacoco | 测试覆盖率报告插件 | [http://www.eclemma.org/jacoco/](http://www.eclemma.org/jacoco/)
Shiro | 用户权限安全管理框架 | [https://shiro.apache.org/](https://shiro.apache.org/)
### 前端技术:
技术 | 名称 | 官网
----|------|----
Expand All @@ -51,9 +52,9 @@ Bootstrap | 前端框架 | [http://getbootstrap.com/](http://getbootstrap.com/)

1.参照redis官网安装redis,本地默认端口启动activemq,zookeeper(zookeeper这个一定要装啊,不然启动不了,开启服务后倾检查2181端口是否正常开启了);

2.找到seckill.sql文件,在本地mysql数据库中建立seckill仓库并执行seckill.sql完成数据初始化操作;
2.找到seckill.sql文件,在本地mysql数据库中建立seckill仓库并执行seckill.sql完成数据初始化操作,增量脚本为seckill_DDL.sql针对2.0.0-SNAPSHOT后的版本使用

3.到service下的resources/profile/local/jdbc.properties修改数据库配置信息
3.到service下的resources/profile/local/connections.properties根据需要修改数据库以及zookeeper等配置信息

4.二维码图片存放路径配置信息在goods-util中的seckill.properties文件中修改;

Expand Down
1 change: 0 additions & 1 deletion goodsKill-api/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.goodsKill</groupId>
<artifactId>goodsKill-api</artifactId>
<version>${project.version}</version>
<parent>
Expand Down
1 change: 0 additions & 1 deletion goodsKill-dao/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.goodsKill</groupId>
<artifactId>goodsKill-dao</artifactId>
<version>${project.version}</version>
<parent>
Expand Down
12 changes: 10 additions & 2 deletions goodsKill-dao/src/main/java/org/seckill/dao/UserMapper.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package org.seckill.dao;

import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.seckill.entity.User;
import org.seckill.entity.UserExample;

import java.util.List;

public interface UserMapper {
long countByExample(UserExample example);

int deleteByExample(UserExample example);

int deleteByPrimaryKey(Integer id);

int insert(User record);
Expand All @@ -16,6 +20,10 @@ public interface UserMapper {

User selectByPrimaryKey(Integer id);

int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);

int updateByExample(@Param("record") User record, @Param("example") UserExample example);

int updateByPrimaryKeySelective(User record);

int updateByPrimaryKey(User record);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<bean id="propertyConfigurer" class="org.seckill.util.common.util.EncryptPropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:goodsKill-service.properties</value>
<value>classpath:connections.properties</value>
</list>
</property>
</bean>
Expand Down
116 changes: 111 additions & 5 deletions goodsKill-dao/src/main/resources/mapper/UserMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="locked" jdbcType="VARCHAR" property="locked" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
Expand Down Expand Up @@ -37,15 +39,43 @@
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, account, password, create_time, update_time
id, account, password, create_time, update_time, username, locked
</sql>
<select id="selectByExample" parameterType="org.seckill.entity.UserExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
'false' as QUERYID,
<include refid="Base_Column_List" />
from user
<if test="_parameter != null">
Expand All @@ -65,11 +95,19 @@
delete from user
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="org.seckill.entity.UserExample">
delete from user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="org.seckill.entity.User">
insert into user (id, account, password,
create_time, update_time)
create_time, update_time, username,
locked)
values (#{id,jdbcType=INTEGER}, #{account,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{username,jdbcType=VARCHAR},
#{locked,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="org.seckill.entity.User">
insert into user
Expand All @@ -89,6 +127,12 @@
<if test="updateTime != null">
update_time,
</if>
<if test="username != null">
username,
</if>
<if test="locked != null">
locked,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
Expand All @@ -106,8 +150,62 @@
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
<if test="locked != null">
#{locked,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="org.seckill.entity.UserExample" resultType="java.lang.Long">
select count(*) from user
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update user
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.account != null">
account = #{record.account,jdbcType=VARCHAR},
</if>
<if test="record.password != null">
password = #{record.password,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.username != null">
username = #{record.username,jdbcType=VARCHAR},
</if>
<if test="record.locked != null">
locked = #{record.locked,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update user
set id = #{record.id,jdbcType=INTEGER},
account = #{record.account,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
username = #{record.username,jdbcType=VARCHAR},
locked = #{record.locked,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="org.seckill.entity.User">
update user
<set>
Expand All @@ -123,6 +221,12 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="username != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="locked != null">
locked = #{locked,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
Expand All @@ -131,7 +235,9 @@
set account = #{account,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
update_time = #{updateTime,jdbcType=TIMESTAMP},
username = #{username,jdbcType=VARCHAR},
locked = #{locked,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
1 change: 0 additions & 1 deletion goodsKill-entry/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.goodsKill</groupId>
<artifactId>goodsKill-entry</artifactId>
<version>${project.version}</version>
<parent>
Expand Down
70 changes: 63 additions & 7 deletions goodsKill-entry/src/main/java/org/seckill/entity/User.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,75 @@
package org.seckill.entity;

import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
public class User implements Serializable {
private static final long serialVersionUID = 1L;
public class User {
private Integer id;

private String account;

private String password;

private Date createTime;

private Date updateTime;
private String locked;

private String username;

private String locked;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getAccount() {
return account;
}

public void setAccount(String account) {
this.account = account == null ? null : account.trim();
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}

public Date getCreateTime() {
return createTime;
}

public void setCreateTime(Date createTime) {
this.createTime = createTime;
}

public Date getUpdateTime() {
return updateTime;
}

public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}

public String getLocked() {
return locked;
}

public void setLocked(String locked) {
this.locked = locked == null ? null : locked.trim();
}
}
Loading

0 comments on commit 455fec3

Please sign in to comment.