Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bigsys
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bigsys
Commits
3b329be9
Commit
3b329be9
authored
Sep 08, 2017
by
fangzhipeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
构建通用dao层
parent
39920b72
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1392 additions
and
64 deletions
+1392
-64
bigsys-auth/bigsys-auth-project/pom.xml
bigsys-auth/bigsys-auth-project/pom.xml
+20
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/ShiroConfig.java
...ct/src/main/java/com/bigsys/auth/project/ShiroConfig.java
+1
-1
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/controller/UserController.java
...va/com/bigsys/auth/project/controller/UserController.java
+25
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/dao/AppInfoMapper.java
...in/java/com/bigsys/auth/project/db/dao/AppInfoMapper.java
+1
-2
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/dao/UserMapper.java
.../main/java/com/bigsys/auth/project/db/dao/UserMapper.java
+31
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/dao/UserMapper.xml
...c/main/java/com/bigsys/auth/project/db/dao/UserMapper.xml
+228
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/model/User.java
.../src/main/java/com/bigsys/auth/project/db/model/User.java
+65
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/model/UserExample.java
...in/java/com/bigsys/auth/project/db/model/UserExample.java
+601
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/UserService.java
...ain/java/com/bigsys/auth/project/service/UserService.java
+13
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/impl/AppAuthImpl.java
...ava/com/bigsys/auth/project/service/impl/AppAuthImpl.java
+1
-1
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/impl/UserServiceImpl.java
...com/bigsys/auth/project/service/impl/UserServiceImpl.java
+59
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/util/BSResponse.java
...rc/main/java/com/bigsys/auth/project/util/BSResponse.java
+30
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/util/UUIDGenarator.java
...main/java/com/bigsys/auth/project/util/UUIDGenarator.java
+13
-0
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/util/dao/BaseServiceImpl.java
...ava/com/bigsys/auth/project/util/dao/BaseServiceImpl.java
+70
-0
bigsys-auth/bigsys-auth-project/src/main/resources/static/login.html
.../bigsys-auth-project/src/main/resources/static/login.html
+9
-0
bigsys-auth/bigsys-auth-project/src/test/java/com/bigsys/auth/project/BigsysAuthSpringbootApplicationTests.java
...ys/auth/project/BigsysAuthSpringbootApplicationTests.java
+13
-0
bigsys-auth/bigsys-auth-project/src/test/resources/generatorConfig.properties
...uth-project/src/test/resources/generatorConfig.properties
+16
-0
bigsys-auth/bigsys-auth-project/src/test/resources/generatorConfig.xml
...igsys-auth-project/src/test/resources/generatorConfig.xml
+75
-0
bigsys-auth/bigsys-auth-project/vue/src/components/Hello.vue
bigsys-auth/bigsys-auth-project/vue/src/components/Hello.vue
+0
-60
bigsys-auth/bigsys-auth-project/vue/src/store/modules/users.js
...s-auth/bigsys-auth-project/vue/src/store/modules/users.js
+22
-0
bigsys-auth/bigsys-auth-project/vue/src/views/pages/user.vue
bigsys-auth/bigsys-auth-project/vue/src/views/pages/user.vue
+99
-0
No files found.
bigsys-auth/bigsys-auth-project/pom.xml
View file @
3b329be9
...
...
@@ -22,6 +22,9 @@
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<java.version>
1.8
</java.version>
<!-- plugin setting -->
<mybatis.generator.generatorConfig.xml>
${basedir}/src/test/resources/generatorConfig.xml
</mybatis.generator.generatorConfig.xml>
<mybatis.generator.generatorConfig.properties>
file:///${basedir}/src/test/resources/generatorConfig.properties
</mybatis.generator.generatorConfig.properties>
</properties>
<dependencies>
...
...
@@ -68,6 +71,11 @@
<artifactId>
bigsys-shiro
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.github.pagehelper
</groupId>
<artifactId>
pagehelper-spring-boot-starter
</artifactId>
<version>
1.2.0
</version>
</dependency>
</dependencies>
<build>
...
...
@@ -86,7 +94,19 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<!-- Mybatis generator代码生成插件 配置 -->
<plugin>
<groupId>
org.mybatis.generator
</groupId>
<artifactId>
mybatis-generator-maven-plugin
</artifactId>
<version>
1.3.5
</version>
<configuration>
<configurationFile>
${mybatis.generator.generatorConfig.xml}
</configurationFile>
<overwrite>
true
</overwrite>
<verbose>
true
</verbose>
</configuration>
</plugin>
</plugins>
</build>
...
...
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/ShiroConfig.java
View file @
3b329be9
...
...
@@ -31,7 +31,7 @@ public class ShiroConfig {
shiroFilterFactoryBean
.
setSecurityManager
(
securityManager
);
// 如果不设置默认会自动寻找Web工程根目录下的"/login.jsp"页面
shiroFilterFactoryBean
.
setLoginUrl
(
"/login"
);
shiroFilterFactoryBean
.
setLoginUrl
(
"/login
.html
"
);
// 登录成功后要跳转的链接
shiroFilterFactoryBean
.
setSuccessUrl
(
"/index"
);
// 未授权界面;
...
...
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/controller/UserController.java
0 → 100644
View file @
3b329be9
package
com
.
bigsys
.
auth
.
project
.
controller
;
import
com.bigsys.auth.project.db.model.User
;
import
com.bigsys.auth.project.service.UserService
;
import
com.bigsys.auth.project.util.BSResponse
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.thymeleaf.util.StringUtils
;
import
javax.annotation.Resource
;
@RestController
@RequestMapping
(
value
=
"/user"
)
public
class
UserController
{
@Resource
private
UserService
userService
;
@RequestMapping
(
value
=
"/addOrUpdateUser"
)
public
BSResponse
addOrUpdateUser
(
User
model
)
{
userService
.
addOrUpdate
(
model
);
return
BSResponse
.
ok
();
}
}
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/dao/AppInfoMapper.java
View file @
3b329be9
...
...
@@ -2,9 +2,8 @@ package com.bigsys.auth.project.db.dao;
import
com.bigsys.auth.project.db.model.AppInfo
;
import
com.bigsys.auth.project.db.model.AppInfoExample
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
public
interface
AppInfoMapper
{
long
countByExample
(
AppInfoExample
example
);
...
...
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/dao/UserMapper.java
0 → 100644
View file @
3b329be9
package
com
.
bigsys
.
auth
.
project
.
db
.
dao
;
import
com.bigsys.auth.project.db.model.User
;
import
com.bigsys.auth.project.db.model.UserExample
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
UserMapper
{
long
countByExample
(
UserExample
example
);
int
deleteByExample
(
UserExample
example
);
int
deleteByPrimaryKey
(
String
id
);
int
insert
(
User
record
);
int
insertSelective
(
User
record
);
List
<
User
>
selectByExample
(
UserExample
example
);
User
selectByPrimaryKey
(
String
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
);
}
\ No newline at end of file
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/dao/UserMapper.xml
0 → 100644
View file @
3b329be9
<?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.bigsys.auth.project.db.dao.UserMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.bigsys.auth.project.db.model.User"
>
<id
column=
"id"
jdbcType=
"VARCHAR"
property=
"id"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"passward"
jdbcType=
"VARCHAR"
property=
"passward"
/>
<result
column=
"phone"
jdbcType=
"VARCHAR"
property=
"phone"
/>
<result
column=
"createTime"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"updateTime"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<where>
<foreach
collection=
"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=
"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, name, passward, phone, createTime, updateTime
</sql>
<select
id=
"selectByExample"
parameterType=
"com.bigsys.auth.project.db.model.UserExample"
resultMap=
"BaseResultMap"
>
select
<if
test=
"distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
from bigsys_user
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.String"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from bigsys_user
where id = #{id,jdbcType=VARCHAR}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.String"
>
delete from bigsys_user
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"com.bigsys.auth.project.db.model.UserExample"
>
delete from bigsys_user
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"com.bigsys.auth.project.db.model.User"
>
insert into bigsys_user (id, name, passward,
phone, createTime, updateTime
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{passward,jdbcType=VARCHAR},
#{phone,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.bigsys.auth.project.db.model.User"
>
insert into bigsys_user
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"name != null"
>
name,
</if>
<if
test=
"passward != null"
>
passward,
</if>
<if
test=
"phone != null"
>
phone,
</if>
<if
test=
"createTime != null"
>
createTime,
</if>
<if
test=
"updateTime != null"
>
updateTime,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=VARCHAR},
</if>
<if
test=
"name != null"
>
#{name,jdbcType=VARCHAR},
</if>
<if
test=
"passward != null"
>
#{passward,jdbcType=VARCHAR},
</if>
<if
test=
"phone != null"
>
#{phone,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"com.bigsys.auth.project.db.model.UserExample"
resultType=
"java.lang.Long"
>
select count(*) from bigsys_user
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
update bigsys_user
<set>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=VARCHAR},
</if>
<if
test=
"record.name != null"
>
name = #{record.name,jdbcType=VARCHAR},
</if>
<if
test=
"record.passward != null"
>
passward = #{record.passward,jdbcType=VARCHAR},
</if>
<if
test=
"record.phone != null"
>
phone = #{record.phone,jdbcType=VARCHAR},
</if>
<if
test=
"record.createTime != null"
>
createTime = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"record.updateTime != null"
>
updateTime = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
update bigsys_user
set id = #{record.id,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
passward = #{record.passward,jdbcType=VARCHAR},
phone = #{record.phone,jdbcType=VARCHAR},
createTime = #{record.createTime,jdbcType=TIMESTAMP},
updateTime = #{record.updateTime,jdbcType=TIMESTAMP}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.bigsys.auth.project.db.model.User"
>
update bigsys_user
<set>
<if
test=
"name != null"
>
name = #{name,jdbcType=VARCHAR},
</if>
<if
test=
"passward != null"
>
passward = #{passward,jdbcType=VARCHAR},
</if>
<if
test=
"phone != null"
>
phone = #{phone,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
createTime = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
updateTime = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.bigsys.auth.project.db.model.User"
>
update bigsys_user
set name = #{name,jdbcType=VARCHAR},
passward = #{passward,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
createTime = #{createTime,jdbcType=TIMESTAMP},
updateTime = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/model/User.java
0 → 100644
View file @
3b329be9
package
com
.
bigsys
.
auth
.
project
.
db
.
model
;
import
java.util.Date
;
public
class
User
{
private
String
id
;
private
String
name
;
private
String
passward
;
private
String
phone
;
private
Date
createTime
;
private
Date
updateTime
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
==
null
?
null
:
id
.
trim
();
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
==
null
?
null
:
name
.
trim
();
}
public
String
getPassward
()
{
return
passward
;
}
public
void
setPassward
(
String
passward
)
{
this
.
passward
=
passward
==
null
?
null
:
passward
.
trim
();
}
public
String
getPhone
()
{
return
phone
;
}
public
void
setPhone
(
String
phone
)
{
this
.
phone
=
phone
==
null
?
null
:
phone
.
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
;
}
}
\ No newline at end of file
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/db/model/UserExample.java
0 → 100644
View file @
3b329be9
This diff is collapsed.
Click to expand it.
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/UserService.java
0 → 100644
View file @
3b329be9
package
com
.
bigsys
.
auth
.
project
.
service
;
import
com.bigsys.auth.project.db.model.User
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageInfo
;
public
interface
UserService
{
void
addOrUpdate
(
User
model
);
PageInfo
<
User
>
page
(
User
condition
,
PageInfo
<
User
>
pager
);
}
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/impl/AppAuthImpl.java
→
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/
service/
impl/AppAuthImpl.java
View file @
3b329be9
package
com
.
bigsys
.
auth
.
project
.
impl
;
package
com
.
bigsys
.
auth
.
project
.
service
.
impl
;
import
com.bigsys.auth.api.AppAuth
;
...
...
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/service/impl/UserServiceImpl.java
0 → 100644
View file @
3b329be9
package
com
.
bigsys
.
auth
.
project
.
service
.
impl
;
import
com.bigsys.auth.project.db.dao.UserMapper
;
import
com.bigsys.auth.project.db.model.User
;
import
com.bigsys.auth.project.db.model.UserExample
;
import
com.bigsys.auth.project.service.UserService
;
import
com.bigsys.auth.project.util.CreateExample
;
import
com.bigsys.auth.project.util.UUIDGenarator
;
import
com.bigsys.auth.project.util.dao.BaseServiceImpl
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
org.springframework.stereotype.Service
;
import
org.thymeleaf.util.StringUtils
;
import
javax.annotation.Resource
;
import
java.util.Date
;
@Service
(
"userService"
)
public
class
UserServiceImpl
extends
BaseServiceImpl
<
String
,
User
,
UserExample
,
UserExample
.
Criteria
>
implements
UserService
{
private
final
String
INIT_PWD
=
"123456"
;
@Resource
private
UserMapper
userMapper
;
@Override
public
Object
getDao
()
{
return
userMapper
;
}
@Override
public
Class
getExample
()
{
return
UserExample
.
class
;
}
@Override
public
void
addOrUpdate
(
User
model
)
{
if
(
StringUtils
.
isEmpty
(
model
.
getId
()))
{
model
.
setId
(
UUIDGenarator
.
getUUID
());
model
.
setPassward
(
INIT_PWD
);
model
.
setCreateTime
(
new
Date
());
model
.
setUpdateTime
(
new
Date
());
userMapper
.
insert
(
model
);
}
else
{
userMapper
.
updateByPrimaryKey
(
model
);
}
}
@Override
public
PageInfo
<
User
>
page
(
User
condition
,
PageInfo
<
User
>
pager
)
{
pager
=
selectByExampleAndPage
(
pager
,
(
example
,
criteria
)
->
{
example
.
setOrderByClause
(
"name asc"
);
});
return
pager
;
}
}
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/util/BSResponse.java
0 → 100644
View file @
3b329be9
package
com
.
bigsys
.
auth
.
project
.
util
;
import
java.util.HashMap
;
public
class
BSResponse
extends
HashMap
{
private
static
final
String
OK
=
"OK"
;
public
static
BSResponse
ok
()
{
BSResponse
bsResponse
=
new
BSResponse
();
bsResponse
.
put
(
"status"
,
OK
);
return
bsResponse
;
}
public
static
BSResponse
ok
(
Object
data
)
{
BSResponse
bsResponse
=
new
BSResponse
();
bsResponse
.
put
(
"status"
,
OK
);
bsResponse
.
put
(
"data"
,
data
);
return
bsResponse
;
}
public
static
BSResponse
error
(
String
msg
)
{
BSResponse
bsResponse
=
new
BSResponse
();
bsResponse
.
put
(
"status"
,
OK
);
bsResponse
.
put
(
"error"
,
msg
);
return
bsResponse
;
}
}
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/util/UUIDGenarator.java
0 → 100644
View file @
3b329be9
package
com
.
bigsys
.
auth
.
project
.
util
;
public
class
UUIDGenarator
{
/**
* 获取32位唯一主键
* @return
*/
public
static
synchronized
String
getUUID
(){
return
java
.
util
.
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
)
;
}
}
bigsys-auth/bigsys-auth-project/src/main/java/com/bigsys/auth/project/util/dao/BaseServiceImpl.java
0 → 100644
View file @
3b329be9
package
com
.
bigsys
.
auth
.
project
.
util
.
dao
;
import
com.bigsys.auth.project.util.CreateExample
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.sun.org.apache.xml.internal.security.Init
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.util.HashMap
;
import
java.util.Map
;
public
abstract
class
BaseServiceImpl
<
key
,
model
,
example
,
criteria
>
{
private
Map
<
String
,
Method
>
methodMap
=
new
HashMap
<>();
private
final
String
MYBATIS_SELECTBYEXAMPLE
=
"selectByExample"
;
private
final
String
MYBATIS_CREATECRITERIA
=
"createCriteria"
;
public
abstract
Object
getDao
();
public
abstract
Class
getExample
();
public
void
init
()
{
Object
dao
=
getDao
();
Class
clazz
=
dao
.
getClass
();
Method
[]
methods
=
clazz
.
getMethods
();
for
(
Method
method
:
methods
)
{
methodMap
.
put
(
method
.
getName
(),
method
);
}
}
public
PageInfo
<
model
>
selectByExampleAndPage
(
PageInfo
<
model
>
page
,
CreateExample
<
example
,
criteria
>
createExample
)
{
try
{
example
example
=
(
example
)
getExample
().
newInstance
();
Class
clazz
=
example
.
getClass
();
criteria
criteria
=
(
criteria
)
clazz
.
getMethod
(
MYBATIS_CREATECRITERIA
).
invoke
(
example
);
createExample
.
createExample
(
example
,
criteria
);
page
=
PageHelper
.
startPage
(
page
).
doSelectPageInfo
(()
->
{
invokeMethod
(
getDao
(),
MYBATIS_SELECTBYEXAMPLE
,
example
);
});
return
page
;
}
catch
(
InstantiationException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
catch
(
NoSuchMethodException
e
)
{
e
.
printStackTrace
();
}
catch
(
InvocationTargetException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
Object
invokeMethod
(
Object
obj
,
String
method
,
Object
...
args
)
{
if
(
methodMap
.
size
()
==
0
)
{
init
();
}
try
{
Object
value
=
methodMap
.
get
(
method
).
invoke
(
obj
,
args
);
return
value
;
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
catch
(
InvocationTargetException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
}
bigsys-auth/bigsys-auth-project/src/main/resources/static/login.html
0 → 100644
View file @
3b329be9
<!doctype html>
<html>
<head>
<meta
charset=
"UTF-8"
>
</head>
<body>
<h1>
请登录
</h1>
</body>
</html>
\ No newline at end of file
bigsys-auth/bigsys-auth-project/src/test/java/com/bigsys/auth/project/BigsysAuthSpringbootApplicationTests.java
View file @
3b329be9
package
com
.
bigsys
.
auth
.
project
;
import
com.bigsys.auth.project.db.model.User
;
import
com.bigsys.auth.project.service.UserService
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageInfo
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
javax.annotation.Resource
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
public
class
BigsysAuthSpringbootApplicationTests
{
@Resource
private
UserService
userService
;
@Test
public
void
contextLoads
()
{
PageInfo
<
User
>
page
=
new
PageInfo
<
User
>();
page
.
setPageNum
(
11
);
page
.
setPageSize
(
10
);
userService
.
page
(
null
,
page
);
}
}
bigsys-auth/bigsys-auth-project/src/test/resources/generatorConfig.properties
0 → 100644
View file @
3b329be9
# 数据库驱动jar 路径
drive.class.path
=
/Users/fangzhipeng/.m2/repository/mysql/mysql-connector-java/5.1.30/mysql-connector-java-5.1.30.jar
# 数据库连接参数
jdbc.driver
=
com.mysql.jdbc.Driver
jdbc.url
=
jdbc:mysql://localhost:3306/bigsys?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
jdbc.username
=
root
jdbc.password
=
root
# 包路径配置
model.package
=
com.bigsys.auth.project.db.model
dao.package
=
com.bigsys.auth.project.db.dao
xml.mapper.package
=
com.bigsys.auth.project.db.dao
target.project
=
src/main/java
\ No newline at end of file
bigsys-auth/bigsys-auth-project/src/test/resources/generatorConfig.xml
0 → 100644
View file @
3b329be9
<?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">
<!-- 配置Run As Maven build : Goals 参数 : mybatis-generator:generate -Dmybatis.generator.overwrite=true -->
<!-- 配置 tableName,使用 Run As Maven build 生成 dao model 层 -->
<generatorConfiguration>
<!-- 配置文件路径 -->
<properties
url=
"${mybatis.generator.generatorConfig.properties}"
/>
<!--数据库驱动包路径 -->
<classPathEntry
location=
"${drive.class.path}"
/>
<context
id=
"DB2Tables"
targetRuntime=
"MyBatis3"
>
<!--关闭注释 -->
<commentGenerator>
<property
name=
"suppressAllComments"
value=
"true"
/>
</commentGenerator>
<!--数据库连接信息 -->
<jdbcConnection
driverClass=
"${jdbc.driver}"
connectionURL=
"${jdbc.url}"
userId=
"${jdbc.username}"
password=
"${jdbc.password}"
>
</jdbcConnection>
<!--生成的model 包路径 -->
<javaModelGenerator
targetPackage=
"${model.package}"
targetProject=
"${target.project}"
>
<property
name=
"enableSubPackages"
value=
"ture"
/>
<property
name=
"trimStrings"
value=
"true"
/>
</javaModelGenerator>
<!--生成xml mapper文件 路径 -->
<sqlMapGenerator
targetPackage=
"${xml.mapper.package}"
targetProject=
"${target.project}"
>
<property
name=
"enableSubPackages"
value=
"ture"
/>
</sqlMapGenerator>
<!-- 生成的Dao接口 的包路径 -->
<javaClientGenerator
type=
"XMLMAPPER"
targetPackage=
"${dao.package}"
targetProject=
"${target.project}"
>
<property
name=
"enableSubPackages"
value=
"ture"
/>
</javaClientGenerator>
<!--对应数据库表名 -->
<!-- <table tableName="rt_upload_stop_info" domainObjectName="UploadStopInfo" >
<columnOverride column="recordTime" javaType="String"></columnOverride>
</table> -->
<table
tableName=
"bigsys_app_info"
domainObjectName=
"AppInfo"
>
</table>
<table
tableName=
"bigsys_user"
domainObjectName=
"User"
>
<property
name=
"useActualColumnNames"
value=
"true"
/>
</table>
<!--<table tableName="sub_line" domainObjectName="SubLine">-->
<!--<property name="useActualColumnNames" value="true"/>-->
<!--<columnOverride column="createTime" javaType="String"></columnOverride>-->
<!--<columnOverride column="lastModifyTime" javaType="String"></columnOverride>-->
<!--<columnOverride column="publishTime" javaType="String"></columnOverride>-->
<!--<columnOverride column="snapshotTime" javaType="String"></columnOverride>-->
<!--</table>-->
<!-- <table tableName="base_stop" domainObjectName="BaseStop">
<property name="useActualColumnNames" value="true"/>
</table> -->
<!--
<table tableName="daba_demand" domainObjectName="DabaDemand">
</table> -->
<!--<table tableName="line_promotion" domainObjectName="LinePromotion">-->
<!--<property name="useActualColumnNames" value="true"/>-->
<!--</table> -->
<!--<table tableName="daba_inf_line" domainObjectName="DabaInfLine">-->
<!--<property name="useActualColumnNames" value="true"/>-->
<!--<columnOverride column="publishTime" javaType="String"></columnOverride>-->
<!--</table>-->
</context>
</generatorConfiguration>
\ No newline at end of file
bigsys-auth/bigsys-auth-project/vue/src/components/Hello.vue
deleted
100644 → 0
View file @
39920b72
<
template
>
<div
class=
"hello"
>
<h1>
{{
msg
}}
</h1>
<h2>
Essential Links
</h2>
<ul>
<li><a
href=
"https://vuejs.org"
target=
"_blank"
>
Core Docs
</a></li>
<li><a
href=
"https://forum.vuejs.org"
target=
"_blank"
>
Forum
</a></li>
<li><a
href=
"https://chat.vuejs.org"
target=
"_blank"
>
Community Chat
</a></li>
<li><a
href=
"https://twitter.com/vuejs"
target=
"_blank"
>
Twitter
</a></li>
<br>
<li><a
href=
"http://vuejs-templates.github.io/webpack/"
target=
"_blank"
>
Docs for This Template
</a></li>
</ul>
<h2>
Ecosystem
</h2>
<ul>
<li><a
href=
"http://router.vuejs.org/"
target=
"_blank"
>
vue-router
</a></li>
<li><a
href=
"http://vuex.vuejs.org/"
target=
"_blank"
>
vuex
</a></li>
<li><a
href=
"http://vue-loader.vuejs.org/"
target=
"_blank"
>
vue-loader
</a></li>
<li><a
href=
"https://github.com/vuejs/awesome-vue"
target=
"_blank"
>
awesome-vue
</a></li>
</ul>
</div>
</
template
>
<
script
>
// import axios from 'axios'
export
default
{
name
:
'
hello
'
,
mounted
:
function
()
{
// axios.get('/api/test')
// .then(res => {
// console.log(res.data)
// })
},
data
()
{
return
{
msg
:
'
Welcome to Your Vue.js App
'
}
}
}
</
script
>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<
style
scoped
>
h1
,
h2
{
font-weight
:
normal
;
}
ul
{
list-style-type
:
none
;
padding
:
0
;
}
li
{
display
:
inline-block
;
margin
:
0
10px
;
}
a
{
color
:
#42b983
;
}
</
style
>
bigsys-auth/bigsys-auth-project/vue/src/store/modules/users.js
0 → 100644
View file @
3b329be9
import
{
inittdata
}
from
'
../../mock/table
'
const
sidebar
=
{
state
:
{
users
:
inittdata
},
mutations
:
{
ADD_USER
(
state
,
data
)
{
state
.
users
.
push
(
data
)
}
},
actions
:
{
ADD_USER
({
commit
},
data
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
commit
(
'
ADD_USER
'
,
data
)
resolve
()
})
}
}
}
export
default
sidebar
bigsys-auth/bigsys-auth-project/vue/src/views/pages/user.vue
0 → 100644
View file @
3b329be9
<
template
>
<div>
<div>
<div
class=
"tb-filter"
>
<el-input
placeholder=
"用户名"
class=
"my-input"
v-model=
"username"
>
<template
slot=
"prepend"
>
用户名:
</
template
>
</el-input>
<el-input
placeholder=
"电话"
class=
"my-input"
v-model=
"username"
>
<
template
slot=
"prepend"
>
电话:
</
template
>
</el-input>
<el-button
type=
"primary"
@
click=
"search()"
>
查询
</el-button>
<el-button
type=
"primary"
@
click=
"dialogFormVisible = true"
>
新增
</el-button>
</div>
</div>
<my-table
:thead=
"thead"
:tdata=
"users"
></my-table>
<el-dialog
title=
"新增用户"
:visible.sync=
"dialogFormVisible"
>
<el-form
:label-position=
"labelPosition"
label-width=
"80px"
:model=
"formLabelAlign"
>
<el-form-item
label=
"日期"
>
<el-input
v-model=
"formLabelAlign.date"
></el-input>
</el-form-item>
<el-form-item
label=
"名称"
>
<el-input
v-model=
"formLabelAlign.name"
></el-input>
</el-form-item>
<el-form-item
label=
"地址"
>
<el-input
v-model=
"formLabelAlign.address"
@
key.enter=
"addUser()"
></el-input>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"dialogFormVisible = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"addUser()"
>
确 定
</el-button>
</div>
</el-dialog>
</div>
</template>
<
style
>
.tb-filter
{
margin-bottom
:
20px
;
}
.my-input
{
width
:
200px
;
}
</
style
>
<
script
>
import
MyTable
from
'
../components/MyTable
'
import
{
thead
,
inittdata
}
from
'
../../mock/table
'
import
{
mapGetters
}
from
'
vuex
'
export
default
{
components
:
{
MyTable
},
data
()
{
return
{
username
:
'
fds
'
,
dialogFormVisible
:
false
,
labelPosition
:
'
right
'
,
formLabelAlign
:
{
date
:
''
,
name
:
''
,
address
:
''
}
}
},
computed
:
{
...
mapGetters
([
'
users
'
]),
thead
()
{
return
thead
}
},
watch
:
{
username
()
{
var
filterdata
=
[]
if
(
!
this
.
username
)
{
this
.
tdata
=
inittdata
return
}
inittdata
.
forEach
((
data
,
index
)
=>
{
if
(
data
.
name
.
indexOf
(
this
.
username
)
!==
-
1
)
{
filterdata
.
push
(
data
)
}
})
this
.
tdata
=
filterdata
}
},
methods
:
{
addUser
:
function
()
{
this
.
dialogFormVisible
=
false
this
.
$store
.
dispatch
(
'
ADD_USER
'
,
this
.
formLabelAlign
).
then
(()
=>
{
}).
catch
(()
=>
{
})
},
search
()
{
alert
(
'
查询成功!
'
)
}
}
}
</
script
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment