使用maven插件生成记住登录代码

This commit is contained in:
lsy
2017-12-24 13:13:01 +08:00
parent 69a16c9c3c
commit c89f069288
6 changed files with 177 additions and 12 deletions
+1 -1
View File
@@ -130,7 +130,7 @@
<configuration>
<!--冗余的-->
<verbose>true</verbose>
<overwrite>true</overwrite>
<overwrite>false</overwrite>
</configuration>
</plugin>
<plugin>
@@ -0,0 +1,17 @@
package com.micro.fast.upms.dao;
import com.micro.fast.upms.pojo.PersistentLogins;
public interface PersistentLoginsMapper {
int deleteByPrimaryKey(String series);
int insert(PersistentLogins record);
int insertSelective(PersistentLogins record);
PersistentLogins selectByPrimaryKey(String series);
int updateByPrimaryKeySelective(PersistentLogins record);
int updateByPrimaryKey(PersistentLogins record);
}
@@ -0,0 +1,73 @@
package com.micro.fast.upms.pojo;
import java.io.Serializable;
import java.util.Date;
public class PersistentLogins implements Serializable {
private String series;
private String username;
private String token;
private Date lastUsed;
private static final long serialVersionUID = 1L;
public PersistentLogins(String series, String username, String token, Date lastUsed) {
this.series = series;
this.username = username;
this.token = token;
this.lastUsed = lastUsed;
}
public PersistentLogins() {
super();
}
public String getSeries() {
return series;
}
public void setSeries(String series) {
this.series = series == null ? null : series.trim();
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token == null ? null : token.trim();
}
public Date getLastUsed() {
return lastUsed;
}
public void setLastUsed(Date lastUsed) {
this.lastUsed = lastUsed;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", series=").append(series);
sb.append(", username=").append(username);
sb.append(", token=").append(token);
sb.append(", lastUsed=").append(lastUsed);
sb.append("]");
return sb.toString();
}
}
+1 -10
View File
@@ -66,15 +66,6 @@
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<table tableName="upms_user_role" domainObjectName="UpmsUserRole" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="upms_log" domainObjectName="UpmsLog" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="upms_system" domainObjectName="UpmsSystem" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="upms_organization" domainObjectName="UpmsOrganization" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="upms_role_permission" domainObjectName="UpmsRolePermission" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="upms_permission" domainObjectName="UpmsPermission" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="upms_user" domainObjectName="UpmsUser" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="upms_user_organization" domainObjectName="UpmsUserOrganization" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="upms_role" domainObjectName="UpmsRole" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="upms_user_permission" domainObjectName="UpmsUserPermission" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="persistent_logins" domainObjectName="PersistentLogins" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
</context>
</generatorConfiguration>
@@ -0,0 +1,84 @@
<?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.micro.fast.upms.dao.PersistentLoginsMapper" >
<resultMap id="BaseResultMap" type="com.micro.fast.upms.pojo.PersistentLogins" >
<constructor >
<idArg column="series" jdbcType="VARCHAR" javaType="java.lang.String" />
<arg column="username" jdbcType="VARCHAR" javaType="java.lang.String" />
<arg column="token" jdbcType="VARCHAR" javaType="java.lang.String" />
<arg column="last_used" jdbcType="TIMESTAMP" javaType="java.util.Date" />
</constructor>
</resultMap>
<sql id="Base_Column_List" >
series, username, token, last_used
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from persistent_logins
where series = #{series,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from persistent_logins
where series = #{series,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.micro.fast.upms.pojo.PersistentLogins" >
insert into persistent_logins (series, username, token,
last_used)
values (#{series,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, #{token,jdbcType=VARCHAR},
#{lastUsed,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.micro.fast.upms.pojo.PersistentLogins" >
insert into persistent_logins
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="series != null" >
series,
</if>
<if test="username != null" >
username,
</if>
<if test="token != null" >
token,
</if>
<if test="lastUsed != null" >
last_used,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="series != null" >
#{series,jdbcType=VARCHAR},
</if>
<if test="username != null" >
#{username,jdbcType=VARCHAR},
</if>
<if test="token != null" >
#{token,jdbcType=VARCHAR},
</if>
<if test="lastUsed != null" >
#{lastUsed,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.micro.fast.upms.pojo.PersistentLogins" >
update persistent_logins
<set >
<if test="username != null" >
username = #{username,jdbcType=VARCHAR},
</if>
<if test="token != null" >
token = #{token,jdbcType=VARCHAR},
</if>
<if test="lastUsed != null" >
last_used = #{lastUsed,jdbcType=TIMESTAMP},
</if>
</set>
where series = #{series,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.micro.fast.upms.pojo.PersistentLogins" >
update persistent_logins
set username = #{username,jdbcType=VARCHAR},
token = #{token,jdbcType=VARCHAR},
last_used = #{lastUsed,jdbcType=TIMESTAMP}
where series = #{series,jdbcType=VARCHAR}
</update>
</mapper>
@@ -6,4 +6,4 @@ db.username=root
db.password=studyj2e
mybatisGenerator.pojoPackage=com.micro.fast.upms.pojo
mybatisGenerator.daoPackage=com.micro.fast.upms.dao
mybatisGenerator.tablesPrefix=upms
mybatisGenerator.tablesPrefix=persistent