init project
This commit is contained in:
54
dal/src/main/java/com/qn/entity/User.java
Normal file
54
dal/src/main/java/com/qn/entity/User.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package com.qn.entity;
|
||||
|
||||
public class User {
|
||||
private String openid;
|
||||
|
||||
private String username;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String avatarUrl;
|
||||
|
||||
public User(String openid, String username, String phone, String avatarUrl) {
|
||||
this.openid = openid;
|
||||
this.username = username;
|
||||
this.phone = phone;
|
||||
this.avatarUrl = avatarUrl;
|
||||
}
|
||||
|
||||
public User() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getOpenid() {
|
||||
return openid;
|
||||
}
|
||||
|
||||
public void setOpenid(String openid) {
|
||||
this.openid = openid == null ? null : openid.trim();
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username == null ? null : username.trim();
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone == null ? null : phone.trim();
|
||||
}
|
||||
|
||||
public String getAvatarUrl() {
|
||||
return avatarUrl;
|
||||
}
|
||||
|
||||
public void setAvatarUrl(String avatarUrl) {
|
||||
this.avatarUrl = avatarUrl == null ? null : avatarUrl.trim();
|
||||
}
|
||||
}
|
||||
410
dal/src/main/java/com/qn/entity/UserExample.java
Normal file
410
dal/src/main/java/com/qn/entity/UserExample.java
Normal file
@@ -0,0 +1,410 @@
|
||||
package com.qn.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UserExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public UserExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andOpenidIsNull() {
|
||||
addCriterion("openid is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOpenidIsNotNull() {
|
||||
addCriterion("openid is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOpenidEqualTo(String value) {
|
||||
addCriterion("openid =", value, "openid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOpenidNotEqualTo(String value) {
|
||||
addCriterion("openid <>", value, "openid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOpenidGreaterThan(String value) {
|
||||
addCriterion("openid >", value, "openid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOpenidGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("openid >=", value, "openid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOpenidLessThan(String value) {
|
||||
addCriterion("openid <", value, "openid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOpenidLessThanOrEqualTo(String value) {
|
||||
addCriterion("openid <=", value, "openid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOpenidLike(String value) {
|
||||
addCriterion("openid like", value, "openid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOpenidNotLike(String value) {
|
||||
addCriterion("openid not like", value, "openid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOpenidIn(List<String> values) {
|
||||
addCriterion("openid in", values, "openid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOpenidNotIn(List<String> values) {
|
||||
addCriterion("openid not in", values, "openid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOpenidBetween(String value1, String value2) {
|
||||
addCriterion("openid between", value1, value2, "openid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOpenidNotBetween(String value1, String value2) {
|
||||
addCriterion("openid not between", value1, value2, "openid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUsernameIsNull() {
|
||||
addCriterion("username is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUsernameIsNotNull() {
|
||||
addCriterion("username is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUsernameEqualTo(String value) {
|
||||
addCriterion("username =", value, "username");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUsernameNotEqualTo(String value) {
|
||||
addCriterion("username <>", value, "username");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUsernameGreaterThan(String value) {
|
||||
addCriterion("username >", value, "username");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUsernameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("username >=", value, "username");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUsernameLessThan(String value) {
|
||||
addCriterion("username <", value, "username");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUsernameLessThanOrEqualTo(String value) {
|
||||
addCriterion("username <=", value, "username");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUsernameLike(String value) {
|
||||
addCriterion("username like", value, "username");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUsernameNotLike(String value) {
|
||||
addCriterion("username not like", value, "username");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUsernameIn(List<String> values) {
|
||||
addCriterion("username in", values, "username");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUsernameNotIn(List<String> values) {
|
||||
addCriterion("username not in", values, "username");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUsernameBetween(String value1, String value2) {
|
||||
addCriterion("username between", value1, value2, "username");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUsernameNotBetween(String value1, String value2) {
|
||||
addCriterion("username not between", value1, value2, "username");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPhoneIsNull() {
|
||||
addCriterion("phone is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPhoneIsNotNull() {
|
||||
addCriterion("phone is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPhoneEqualTo(String value) {
|
||||
addCriterion("phone =", value, "phone");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPhoneNotEqualTo(String value) {
|
||||
addCriterion("phone <>", value, "phone");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPhoneGreaterThan(String value) {
|
||||
addCriterion("phone >", value, "phone");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPhoneGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("phone >=", value, "phone");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPhoneLessThan(String value) {
|
||||
addCriterion("phone <", value, "phone");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPhoneLessThanOrEqualTo(String value) {
|
||||
addCriterion("phone <=", value, "phone");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPhoneLike(String value) {
|
||||
addCriterion("phone like", value, "phone");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPhoneNotLike(String value) {
|
||||
addCriterion("phone not like", value, "phone");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPhoneIn(List<String> values) {
|
||||
addCriterion("phone in", values, "phone");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPhoneNotIn(List<String> values) {
|
||||
addCriterion("phone not in", values, "phone");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPhoneBetween(String value1, String value2) {
|
||||
addCriterion("phone between", value1, value2, "phone");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPhoneNotBetween(String value1, String value2) {
|
||||
addCriterion("phone not between", value1, value2, "phone");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
36
dal/src/main/java/com/qn/mapper/UserMapper.java
Normal file
36
dal/src/main/java/com/qn/mapper/UserMapper.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.qn.mapper;
|
||||
|
||||
import com.qn.entity.User;
|
||||
import com.qn.entity.UserExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface UserMapper {
|
||||
int countByExample(UserExample example);
|
||||
|
||||
int deleteByExample(UserExample example);
|
||||
|
||||
int deleteByPrimaryKey(String openid);
|
||||
|
||||
int insert(User record);
|
||||
|
||||
int insertSelective(User record);
|
||||
|
||||
List<User> selectByExampleWithBLOBs(UserExample example);
|
||||
|
||||
List<User> selectByExample(UserExample example);
|
||||
|
||||
User selectByPrimaryKey(String openid);
|
||||
|
||||
int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") User record, @Param("example") UserExample example);
|
||||
|
||||
int updateByExample(@Param("record") User record, @Param("example") UserExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(User record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(User record);
|
||||
|
||||
int updateByPrimaryKey(User record);
|
||||
}
|
||||
101
dal/src/main/resources/generatorConfig.xml
Normal file
101
dal/src/main/resources/generatorConfig.xml
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE generatorConfiguration
|
||||
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
|
||||
<!-- 配置生成器 -->
|
||||
<generatorConfiguration>
|
||||
|
||||
<!--id:必选,上下文id,用于在生成错误时提示-->
|
||||
<context id="mysql" targetRuntime="MyBatis3">
|
||||
<!-- 生成的Java文件的编码 -->
|
||||
<property name="javaFileEncoding" value="UTF-8"/>
|
||||
<!-- 对注释进行控制 -->
|
||||
<commentGenerator>
|
||||
<!-- suppressDate是去掉生成日期那行注释 -->
|
||||
<property name="suppressDate" value="true"/>
|
||||
<!-- suppressAllComments是去掉所有的注解 -->
|
||||
<property name="suppressAllComments" value="true"/>
|
||||
</commentGenerator>
|
||||
|
||||
<!--jdbc的数据库连接 -->
|
||||
<jdbcConnection
|
||||
driverClass="com.mysql.jdbc.Driver"
|
||||
connectionURL="jdbc:mysql://127.0.0.1:3306/smallapp_point?serverTimezone=GMT%2b8"
|
||||
userId="root"
|
||||
password="123456">
|
||||
</jdbcConnection>
|
||||
|
||||
<!-- java类型处理器
|
||||
用于处理DB中的类型到Java中的类型,默认使用JavaTypeResolverDefaultImpl;
|
||||
注意一点,默认会先尝试使用Integer,Long,Short等来对应DECIMAL和 NUMERIC数据类型;
|
||||
-->
|
||||
<javaTypeResolver type="org.mybatis.generator.internal.types.JavaTypeResolverDefaultImpl">
|
||||
<!--
|
||||
true:使用BigDecimal对应DECIMAL和 NUMERIC数据类型
|
||||
false:默认,
|
||||
scale>0;length>18:使用BigDecimal;
|
||||
scale=0;length[10,18]:使用Long;
|
||||
scale=0;length[5,9]:使用Integer;
|
||||
scale=0;length<5:使用Short;
|
||||
-->
|
||||
<property name="forceBigDecimals" value="false"/>
|
||||
</javaTypeResolver>
|
||||
|
||||
|
||||
<!-- java模型创建器,是必须要的元素
|
||||
负责:1,key类(见context的defaultModelType);2,java类;3,查询类
|
||||
targetPackage:生成的类要放的包,真实的包受enableSubPackages属性控制;
|
||||
targetProject:目标项目,指定一个存在的目录下,生成的内容会放到指定目录中,如果目录不存在,MBG不会自动建目录
|
||||
-->
|
||||
<javaModelGenerator targetPackage="com.qn.entity" targetProject="src/main/java">
|
||||
<!-- 是否允许子包,即targetPackage.schemaName.tableName -->
|
||||
<property name="enableSubPackages" value="true"/>
|
||||
<!-- 是否对model添加 构造函数 -->
|
||||
<property name="constructorBased" value="true"/>
|
||||
<!-- 是否对类CHAR类型的列的数据进行trim操作 -->
|
||||
<property name="trimStrings" value="true"/>
|
||||
<!-- 建立的Model对象是否 不可改变 即生成的Model对象不会有 setter方法,只有构造方法 -->
|
||||
<property name="immutable" value="false"/>
|
||||
</javaModelGenerator>
|
||||
|
||||
<!-- 生成SQL map的XML文件生成器,
|
||||
注意,在Mybatis3之后,我们可以使用mapper.xml文件+Mapper接口(或者不用mapper接口),
|
||||
或者只使用Mapper接口+Annotation,
|
||||
所以,如果 javaClientGenerator配置中配置了需要生成XML的话,这个元素就必须配置
|
||||
targetPackage/targetProject:同javaModelGenerator
|
||||
-->
|
||||
<sqlMapGenerator targetPackage="mybatis.mapper" targetProject="src/main/resources">
|
||||
<!-- 在targetPackage的基础上,根据数据库的schema再生成一层package,最终生成的类放在这个package下,默认为false -->
|
||||
<property name="enableSubPackages" value="true"/>
|
||||
</sqlMapGenerator>
|
||||
|
||||
|
||||
<!-- 对于mybatis来说,即生成Mapper接口,注意,如果没有配置该元素,那么默认不会生成Mapper接口
|
||||
targetPackage/targetProject:同javaModelGenerator
|
||||
type:选择怎么生成mapper接口(在MyBatis3/MyBatis3Simple下):
|
||||
1,ANNOTATEDMAPPER:会生成使用Mapper接口+Annotation的方式创建(SQL生成在annotation中),不会生成对应的XML;
|
||||
2,MIXEDMAPPER:使用混合配置,会生成Mapper接口,并适当添加合适的Annotation,但是XML会生成在XML中;
|
||||
3,XMLMAPPER:会生成Mapper接口,接口完全依赖XML;
|
||||
注意,如果context是MyBatis3Simple:只支持ANNOTATEDMAPPER和XMLMAPPER
|
||||
-->
|
||||
<javaClientGenerator targetPackage="com.qn.mapper" type="XMLMAPPER" targetProject="src/main/java">
|
||||
<!-- 在targetPackage的基础上,根据数据库的schema再生成一层package,最终生成的类放在这个package下,默认为false -->
|
||||
<property name="enableSubPackages" value="true"/>
|
||||
</javaClientGenerator>
|
||||
|
||||
<!-- 选择一个table来生成相关文件,可以有一个或多个table,必须要有table元素
|
||||
tableName(必要):要生成对象的表名;
|
||||
domainObjectName 给表对应的 model 起名字
|
||||
注意:大小写敏感问题。
|
||||
-->
|
||||
<table tableName="tb_gw_user" domainObjectName="User">
|
||||
|
||||
<!--用来修改表中某个列的属性,一个table元素中可以有多个columnOverride元素哈.
|
||||
property属性来指定列要生成的属性名称.
|
||||
-->
|
||||
<!--<columnOverride column="username" property="userName" />-->
|
||||
</table>
|
||||
|
||||
</context>
|
||||
|
||||
</generatorConfiguration>
|
||||
241
dal/src/main/resources/mybatis/mapper/UserMapper.xml
Normal file
241
dal/src/main/resources/mybatis/mapper/UserMapper.xml
Normal file
@@ -0,0 +1,241 @@
|
||||
<?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="com.qn.mapper.UserMapper" >
|
||||
<resultMap id="BaseResultMap" type="com.qn.entity.User" >
|
||||
<constructor >
|
||||
<idArg column="openid" jdbcType="VARCHAR" javaType="java.lang.String" />
|
||||
<arg column="username" jdbcType="VARCHAR" javaType="java.lang.String" />
|
||||
<arg column="phone" jdbcType="VARCHAR" javaType="java.lang.String" />
|
||||
</constructor>
|
||||
</resultMap>
|
||||
<resultMap id="ResultMapWithBLOBs" type="com.qn.entity.User" >
|
||||
<constructor >
|
||||
<idArg column="openid" jdbcType="VARCHAR" javaType="java.lang.String" />
|
||||
<arg column="username" jdbcType="VARCHAR" javaType="java.lang.String" />
|
||||
<arg column="phone" jdbcType="VARCHAR" javaType="java.lang.String" />
|
||||
<arg column="avatar_url" jdbcType="LONGVARCHAR" javaType="java.lang.String" />
|
||||
</constructor>
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause" >
|
||||
<where >
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or" >
|
||||
<if test="criteria.valid" >
|
||||
<trim prefix="(" suffix=")" prefixOverrides="and" >
|
||||
<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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</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="(" suffix=")" prefixOverrides="and" >
|
||||
<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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List" >
|
||||
openid, username, phone
|
||||
</sql>
|
||||
<sql id="Blob_Column_List" >
|
||||
avatar_url
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" resultMap="ResultMapWithBLOBs" parameterType="com.qn.entity.UserExample" >
|
||||
select
|
||||
<if test="distinct" >
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from tb_gw_user
|
||||
<if test="_parameter != null" >
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null" >
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.qn.entity.UserExample" >
|
||||
select
|
||||
<if test="distinct" >
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_gw_user
|
||||
<if test="_parameter != null" >
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null" >
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.String" >
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from tb_gw_user
|
||||
where openid = #{openid,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
|
||||
delete from tb_gw_user
|
||||
where openid = #{openid,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="com.qn.entity.UserExample" >
|
||||
delete from tb_gw_user
|
||||
<if test="_parameter != null" >
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.qn.entity.User" >
|
||||
insert into tb_gw_user (openid, username, phone,
|
||||
avatar_url)
|
||||
values (#{openid,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
|
||||
#{avatarUrl,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.qn.entity.User" >
|
||||
insert into tb_gw_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides="," >
|
||||
<if test="openid != null" >
|
||||
openid,
|
||||
</if>
|
||||
<if test="username != null" >
|
||||
username,
|
||||
</if>
|
||||
<if test="phone != null" >
|
||||
phone,
|
||||
</if>
|
||||
<if test="avatarUrl != null" >
|
||||
avatar_url,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
||||
<if test="openid != null" >
|
||||
#{openid,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="username != null" >
|
||||
#{username,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="phone != null" >
|
||||
#{phone,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="avatarUrl != null" >
|
||||
#{avatarUrl,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.qn.entity.UserExample" resultType="java.lang.Integer" >
|
||||
select count(*) from tb_gw_user
|
||||
<if test="_parameter != null" >
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map" >
|
||||
update tb_gw_user
|
||||
<set >
|
||||
<if test="record.openid != null" >
|
||||
openid = #{record.openid,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.username != null" >
|
||||
username = #{record.username,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.phone != null" >
|
||||
phone = #{record.phone,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.avatarUrl != null" >
|
||||
avatar_url = #{record.avatarUrl,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null" >
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExampleWithBLOBs" parameterType="map" >
|
||||
update tb_gw_user
|
||||
set openid = #{record.openid,jdbcType=VARCHAR},
|
||||
username = #{record.username,jdbcType=VARCHAR},
|
||||
phone = #{record.phone,jdbcType=VARCHAR},
|
||||
avatar_url = #{record.avatarUrl,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null" >
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map" >
|
||||
update tb_gw_user
|
||||
set openid = #{record.openid,jdbcType=VARCHAR},
|
||||
username = #{record.username,jdbcType=VARCHAR},
|
||||
phone = #{record.phone,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null" >
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.qn.entity.User" >
|
||||
update tb_gw_user
|
||||
<set >
|
||||
<if test="username != null" >
|
||||
username = #{username,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="phone != null" >
|
||||
phone = #{phone,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="avatarUrl != null" >
|
||||
avatar_url = #{avatarUrl,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where openid = #{openid,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.qn.entity.User" >
|
||||
update tb_gw_user
|
||||
set username = #{username,jdbcType=VARCHAR},
|
||||
phone = #{phone,jdbcType=VARCHAR},
|
||||
avatar_url = #{avatarUrl,jdbcType=LONGVARCHAR}
|
||||
where openid = #{openid,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.qn.entity.User" >
|
||||
update tb_gw_user
|
||||
set username = #{username,jdbcType=VARCHAR},
|
||||
phone = #{phone,jdbcType=VARCHAR}
|
||||
where openid = #{openid,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
||||
24
dal/src/main/resources/mybatis/mybatis-config.xml
Normal file
24
dal/src/main/resources/mybatis/mybatis-config.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
|
||||
|
||||
<configuration>
|
||||
<settings>
|
||||
<setting name="cacheEnabled" value="true" />
|
||||
<!-- 打印sql日志 -->
|
||||
<setting name="logImpl" value="SLF4J" />
|
||||
</settings>
|
||||
|
||||
<typeAliases>
|
||||
<typeAlias alias="Integer" type="java.lang.Integer" />
|
||||
<typeAlias alias="Byte" type="java.lang.Byte"/>
|
||||
<typeAlias alias="String" type="java.lang.String" />
|
||||
<typeAlias alias="Long" type="java.lang.Long" />
|
||||
<typeAlias alias="HashMap" type="java.util.HashMap" />
|
||||
<typeAlias alias="LinkedHashMap" type="java.util.LinkedHashMap" />
|
||||
<typeAlias alias="ArrayList" type="java.util.ArrayList" />
|
||||
<typeAlias alias="LinkedList" type="java.util.LinkedList" />
|
||||
</typeAliases>
|
||||
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user