Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Y
YX_IDENT_REFACTORING
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
zhangyusheng
YX_IDENT_REFACTORING
Commits
e19b6c86
Commit
e19b6c86
authored
Sep 27, 2018
by
liboyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Springboot+Mybatis制证项目首次提交
parent
49aa8454
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
73 additions
and
5 deletions
+73
-5
pom.xml
pom.xml
+5
-0
SystemUserApi.java
src/main/java/com/yx_project/start/api/SystemUserApi.java
+1
-0
SystemRoleEntity.java
...in/java/com/yx_project/start/entity/SystemRoleEntity.java
+10
-0
SystemUserEntity.java
...in/java/com/yx_project/start/entity/SystemUserEntity.java
+10
-0
SystemUserMapper.java
...in/java/com/yx_project/start/mapper/SystemUserMapper.java
+3
-1
SystemUserService.java
.../java/com/yx_project/start/service/SystemUserService.java
+2
-0
SystemUserServiceImpl.java
.../yx_project/start/service/impl/SystemUserServiceImpl.java
+3
-0
application.properties
src/main/resources/application.properties
+0
-4
SystemUserMapper.xml
src/main/resources/mapper/SystemUserMapper.xml
+39
-0
No files found.
pom.xml
View file @
e19b6c86
...
@@ -29,6 +29,11 @@
...
@@ -29,6 +29,11 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependency>
<!--引入jersey作为http rest接口实现-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-jersey
</artifactId>
</dependency>
<dependency>
<dependency>
<groupId>
org.mybatis.spring.boot
</groupId>
<groupId>
org.mybatis.spring.boot
</groupId>
<artifactId>
mybatis-spring-boot-starter
</artifactId>
<artifactId>
mybatis-spring-boot-starter
</artifactId>
...
...
src/main/java/com/yx_project/start/api/SystemUserApi.java
View file @
e19b6c86
...
@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
@RestController
@RestController
public
class
SystemUserApi
{
public
class
SystemUserApi
{
...
...
src/main/java/com/yx_project/start/entity/SystemRoleEntity.java
View file @
e19b6c86
package
com
.
yx_project
.
start
.
entity
;
package
com
.
yx_project
.
start
.
entity
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
java.util.List
;
@Entity
@Entity
@Table
(
name
=
"SYSTEM_ROLE"
,
schema
=
"DAHAI"
,
catalog
=
""
)
@Table
(
name
=
"SYSTEM_ROLE"
,
schema
=
"DAHAI"
,
catalog
=
""
)
public
class
SystemRoleEntity
{
public
class
SystemRoleEntity
{
private
long
roleId
;
private
long
roleId
;
private
String
roleName
;
private
String
roleName
;
private
List
<
SystemMenuEntity
>
menuEntityList
;
public
List
<
SystemMenuEntity
>
getMenuEntityList
()
{
return
menuEntityList
;
}
public
void
setMenuEntityList
(
List
<
SystemMenuEntity
>
menuEntityList
)
{
this
.
menuEntityList
=
menuEntityList
;
}
@Id
@Id
@Column
(
name
=
"ROLE_ID"
)
@Column
(
name
=
"ROLE_ID"
)
...
...
src/main/java/com/yx_project/start/entity/SystemUserEntity.java
View file @
e19b6c86
package
com
.
yx_project
.
start
.
entity
;
package
com
.
yx_project
.
start
.
entity
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
java.util.List
;
@Entity
@Entity
@Table
(
name
=
"SYSTEM_USER"
,
schema
=
"DAHAI"
,
catalog
=
""
)
@Table
(
name
=
"SYSTEM_USER"
,
schema
=
"DAHAI"
,
catalog
=
""
)
...
@@ -9,6 +10,15 @@ public class SystemUserEntity {
...
@@ -9,6 +10,15 @@ public class SystemUserEntity {
private
String
username
;
private
String
username
;
private
String
password
;
private
String
password
;
private
String
workshop
;
private
String
workshop
;
private
List
<
SystemRoleEntity
>
roleEntityList
;
public
List
<
SystemRoleEntity
>
getRoleEntityList
()
{
return
roleEntityList
;
}
public
void
setRoleEntityList
(
List
<
SystemRoleEntity
>
roleEntityList
)
{
this
.
roleEntityList
=
roleEntityList
;
}
@Id
@Id
@Column
(
name
=
"ID"
)
@Column
(
name
=
"ID"
)
...
...
src/main/java/com/yx_project/start/mapper/SystemUserMapper.java
View file @
e19b6c86
...
@@ -3,11 +3,13 @@ package com.yx_project.start.mapper;
...
@@ -3,11 +3,13 @@ package com.yx_project.start.mapper;
import
com.yx_project.start.entity.SystemUserEntity
;
import
com.yx_project.start.entity.SystemUserEntity
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
@Mapper
@Mapper
public
interface
SystemUserMapper
{
public
interface
SystemUserMapper
{
public
List
<
SystemUserEntity
>
findAll
();
public
List
<
SystemUserEntity
>
findAll
();
public
SystemUserEntity
selectByUsernameAndPassword
(
Map
<
String
,
String
>
map
);
}
}
src/main/java/com/yx_project/start/service/SystemUserService.java
View file @
e19b6c86
...
@@ -3,10 +3,12 @@ package com.yx_project.start.service;
...
@@ -3,10 +3,12 @@ package com.yx_project.start.service;
import
com.yx_project.start.entity.SystemUserEntity
;
import
com.yx_project.start.entity.SystemUserEntity
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
public
interface
SystemUserService
{
public
interface
SystemUserService
{
/**
/**
* 根据接口查询所用的用户
* 根据接口查询所用的用户
*/
*/
public
List
<
SystemUserEntity
>
findAllUser
();
public
List
<
SystemUserEntity
>
findAllUser
();
// public SystemUserEntity findUserRoleMenu(Map<String,String> map);
}
}
src/main/java/com/yx_project/start/service/impl/SystemUserServiceImpl.java
View file @
e19b6c86
...
@@ -6,6 +6,7 @@ import com.yx_project.start.service.SystemUserService;
...
@@ -6,6 +6,7 @@ import com.yx_project.start.service.SystemUserService;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
@Service
@Service
public
class
SystemUserServiceImpl
implements
SystemUserService
{
public
class
SystemUserServiceImpl
implements
SystemUserService
{
...
@@ -19,4 +20,6 @@ public class SystemUserServiceImpl implements SystemUserService {
...
@@ -19,4 +20,6 @@ public class SystemUserServiceImpl implements SystemUserService {
return
list
;
return
list
;
}
}
}
}
src/main/resources/application.properties
View file @
e19b6c86
...
@@ -10,8 +10,4 @@ spring.datasource.driver-class-name= oracle.jdbc.driver.OracleDriver
...
@@ -10,8 +10,4 @@ spring.datasource.driver-class-name= oracle.jdbc.driver.OracleDriver
spring.datasource.url
=
jdbc:oracle:thin:@192.168.10.208:1521:GTYX
spring.datasource.url
=
jdbc:oracle:thin:@192.168.10.208:1521:GTYX
spring.datasource.username
=
dahai
spring.datasource.username
=
dahai
spring.datasource.password
=
dahai
spring.datasource.password
=
dahai
spring.freemarker.cache
=
true
spring.freemarker.charset
=
utf-8
spring.freemarker.content-type
=
text/html
spring.freemarker.check-template-location
=
true
src/main/resources/mapper/SystemUserMapper.xml
View file @
e19b6c86
<?xml version="1.0" encoding="UTF-8" ?>
<?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" >
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.yx_project.start.mapper.SystemUserMapper"
>
<mapper
namespace=
"com.yx_project.start.mapper.SystemUserMapper"
>
<!--用户-->
<resultMap
id=
"UserRoleMenuMap"
type=
"com.yx_project.start.entity.SystemUserEntity"
>
<id
property=
"id"
column=
"id"
/>
<result
column=
"username"
property=
"username"
/>
<result
column=
"password"
property=
"password"
/>
<result
column=
"workshop"
property=
"workshop"
/>
<!--角色集合-->
<collection
property=
"roleEntityList"
ofType=
"SystemRoleEntity"
column=
"id"
select=
"selectAllRole"
/>
</resultMap>
<!--角色-->
<resultMap
id=
"RoleMap"
type=
"com.yx_project.start.entity.SystemRoleEntity"
>
<id
column=
"roleId"
property=
"roleId"
/>
<result
column=
"roleName"
property=
"roleName"
/>
<!--权限集合-->
<collection
property=
"menuEntityList"
ofType=
"SystemMenuEntity"
column=
"id"
select=
"selectAllMenu"
/>
</resultMap>
<!--权限-->
<resultMap
id=
"MenuMap"
type=
"com.yx_project.start.entity.SystemMenuEntity"
>
<id
column=
"menuId"
property=
"menuId"
/>
<result
column=
"menu"
property=
"menu"
/>
<result
column=
"menuName"
property=
"menuName"
/>
</resultMap>
<select
id=
"findAll"
resultType=
"SystemUserEntity"
>
<select
id=
"findAll"
resultType=
"SystemUserEntity"
>
select * from "SYSTEM_USER"
select * from "SYSTEM_USER"
</select>
</select>
<!--根据角色id查询权限(先从角色权限关联表查询角色id相等,在查询权限id,根据权限id在权限表里查询权限)-->
<select
id=
"selectAllMenu"
resultType=
"com.yx_project.start.entity.SystemMenuEntity"
parameterType=
"java.lang.Integer"
>
select menuId,menuName from SYSTEM_MENU where menuId in (select SYSTEM_ROLE_MENU.ROLE_MENU_ID from SYSTEM_ROLE_MENU where SYSTEM_ROLE_MENU.ROLE_ID=#{id})
</select>
<!--查询所有角色-->
<select
id=
"selectAllRole"
resultMap=
"RoleMap"
parameterType=
"java.lang.Integer"
>
select roleId,roleName from SYSTEM_ROLE where roleId in (select "SYSTEM_USER".ROLE_ID from "SYSTEM_USER" where "SYSTEM_USER".id=#{id})
</select>
<!--通过用户名密码查询用户-->
<select
id=
"selectByUsernameAndPassword"
resultMap=
"UserRoleMenuMap"
parameterType=
"Map"
>
select * from user where username=#{username} AND password = #{password}
</select>
</mapper>
</mapper>
\ No newline at end of file
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