Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
polysoft-nafmii
/
polysoft-parent
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1d78b37e
authored
Apr 25, 2021
by
zhoujinghao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
模拟用户操作相关接口提交
1 parent
a51fbed5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
26 additions
and
359 deletions
nafmii-admin/src/main/java/org/nafmii/nafmiiadmin/controller/TestController.java
nafmii-admin/src/main/java/org/nafmii/nafmiiadmin/mapper/TStudentMapper.java
nafmii-admin/src/main/java/org/nafmii/nafmiiadmin/po/TStudent.java
nafmii-admin/src/main/java/org/nafmii/nafmiiadmin/po/TStudentExample.java
nafmii-admin/src/main/java/org/nafmii/nafmiiadmin/service/TestService.java
nafmii-admin/src/main/java/org/nafmii/nafmiiadmin/service/impl/TestServiceImpl.java
nafmii-admin/src/main/resources/mapper/TStudentMapper.xml
nafmii-app/pom.xml
nafmii-app/src/main/java/org/nafmii/controller/UserController.java
nafmii-app/src/main/java/org/nafmii/service/impl/UserServiceImpl.java
nafmii-app/src/main/java/org/nafmii/vo/UserVO.java
nafmii-admin/src/main/java/org/nafmii/nafmiiadmin/controller/TestController.java
View file @
1d78b37
...
@@ -2,7 +2,7 @@ package org.nafmii.nafmiiadmin.controller;
...
@@ -2,7 +2,7 @@ package org.nafmii.nafmiiadmin.controller;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.nafmii.nafmiiadmin.po.TStudent
;
import
org.nafmii.nafmiiadmin.service.TestService
;
import
org.nafmii.nafmiiadmin.service.TestService
;
import
org.nafmii.result.Result
;
import
org.nafmii.result.Result
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -29,8 +29,8 @@ public class TestController {
...
@@ -29,8 +29,8 @@ public class TestController {
@ApiOperation
(
value
=
"测试"
,
notes
=
"测试"
)
@ApiOperation
(
value
=
"测试"
,
notes
=
"测试"
)
@GetMapping
(
"search"
)
@GetMapping
(
"search"
)
public
Result
<
List
<
TStudent
>>
search
(){
public
String
search
(){
Result
<
List
<
TStudent
>>
test
=
service
.
searchAll
();
return
test
;
return
"test"
;
}
}
}
}
nafmii-admin/src/main/java/org/nafmii/nafmiiadmin/mapper/TStudentMapper.java
deleted
100644 → 0
View file @
a51fbed
package
org
.
nafmii
.
nafmiiadmin
.
mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.nafmii.nafmiiadmin.po.TStudent
;
import
org.nafmii.nafmiiadmin.po.TStudentExample
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
interface
TStudentMapper
{
long
countByExample
(
TStudentExample
example
);
int
deleteByExample
(
TStudentExample
example
);
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
TStudent
record
);
int
insertSelective
(
TStudent
record
);
List
<
TStudent
>
selectByExample
(
TStudentExample
example
);
TStudent
selectByPrimaryKey
(
Integer
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
TStudent
record
,
@Param
(
"example"
)
TStudentExample
example
);
int
updateByExample
(
@Param
(
"record"
)
TStudent
record
,
@Param
(
"example"
)
TStudentExample
example
);
int
updateByPrimaryKeySelective
(
TStudent
record
);
int
updateByPrimaryKey
(
TStudent
record
);
}
\ No newline at end of file
\ No newline at end of file
nafmii-admin/src/main/java/org/nafmii/nafmiiadmin/po/TStudent.java
deleted
100644 → 0
View file @
a51fbed
package
org
.
nafmii
.
nafmiiadmin
.
po
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.util.Date
;
public
class
TStudent
implements
Serializable
{
@ApiModelProperty
(
value
=
"id"
)
private
Integer
id
;
private
String
name
;
private
Short
sex
;
private
Date
createTime
;
private
Date
updateTime
;
private
static
final
long
serialVersionUID
=
1L
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
Short
getSex
()
{
return
sex
;
}
public
void
setSex
(
Short
sex
)
{
this
.
sex
=
sex
;
}
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
;
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
getClass
().
getSimpleName
());
sb
.
append
(
" ["
);
sb
.
append
(
"Hash = "
).
append
(
hashCode
());
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", name="
).
append
(
name
);
sb
.
append
(
", sex="
).
append
(
sex
);
sb
.
append
(
", createTime="
).
append
(
createTime
);
sb
.
append
(
", updateTime="
).
append
(
updateTime
);
sb
.
append
(
", serialVersionUID="
).
append
(
serialVersionUID
);
sb
.
append
(
"]"
);
return
sb
.
toString
();
}
}
\ No newline at end of file
\ No newline at end of file
nafmii-admin/src/main/java/org/nafmii/nafmiiadmin/po/TStudentExample.java
deleted
100644 → 0
View file @
a51fbed
This diff is collapsed.
Click to expand it.
nafmii-admin/src/main/java/org/nafmii/nafmiiadmin/service/TestService.java
View file @
1d78b37
package
org
.
nafmii
.
nafmiiadmin
.
service
;
package
org
.
nafmii
.
nafmiiadmin
.
service
;
import
org.nafmii.nafmiiadmin.po.TStudent
;
import
org.nafmii.result.Result
;
import
java.util.List
;
/**
/**
* @author:zhoujh
* @author:zhoujh
...
@@ -14,5 +11,5 @@ import java.util.List;
...
@@ -14,5 +11,5 @@ import java.util.List;
* @remark:
* @remark:
*/
*/
public
interface
TestService
{
public
interface
TestService
{
Result
<
List
<
TStudent
>>
searchAll
();
}
}
nafmii-admin/src/main/java/org/nafmii/nafmiiadmin/service/impl/TestServiceImpl.java
View file @
1d78b37
package
org
.
nafmii
.
nafmiiadmin
.
service
.
impl
;
package
org
.
nafmii
.
nafmiiadmin
.
service
.
impl
;
import
org.nafmii.nafmiiadmin.mapper.TStudentMapper
;
import
org.nafmii.nafmiiadmin.po.TStudent
;
import
org.nafmii.nafmiiadmin.service.TestService
;
import
org.nafmii.nafmiiadmin.service.TestService
;
import
org.nafmii.result.Result
;
import
org.nafmii.result.ResultCode
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.List
;
...
@@ -21,15 +17,5 @@ import java.util.List;
...
@@ -21,15 +17,5 @@ import java.util.List;
@Service
@Service
public
class
TestServiceImpl
implements
TestService
{
public
class
TestServiceImpl
implements
TestService
{
@Autowired
private
TStudentMapper
studentMapper
;
@Override
public
Result
<
List
<
TStudent
>>
searchAll
()
{
Result
result
=
new
Result
();
TStudent
tStudent
=
studentMapper
.
selectByPrimaryKey
(
1
);
result
.
setData
(
tStudent
);
result
.
setCode
(
ResultCode
.
SUCCESS
.
getCode
());
result
.
setMessage
(
ResultCode
.
SUCCESS
.
getMessage
());
return
result
;
}
}
}
nafmii-admin/src/main/resources/mapper/TStudentMapper.xml
deleted
100644 → 0
View file @
a51fbed
<?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=
"org.nafmii.nafmiiadmin.mapper.TStudentMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"org.nafmii.nafmiiadmin.po.TStudent"
>
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"sex"
jdbcType=
"SMALLINT"
property=
"sex"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
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, sex, create_time, update_time
</sql>
<select
id=
"selectByExample"
parameterType=
"org.nafmii.nafmiiadmin.po.TStudentExample"
resultMap=
"BaseResultMap"
>
select
<if
test=
"distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
from t_student
<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.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from t_student
where id = #{id,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from t_student
where id = #{id,jdbcType=INTEGER}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"org.nafmii.nafmiiadmin.po.TStudentExample"
>
delete from t_student
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"org.nafmii.nafmiiadmin.po.TStudent"
>
insert into t_student (id, name, sex,
create_time, update_time)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{sex,jdbcType=SMALLINT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"org.nafmii.nafmiiadmin.po.TStudent"
>
insert into t_student
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"name != null"
>
name,
</if>
<if
test=
"sex != null"
>
sex,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
<if
test=
"name != null"
>
#{name,jdbcType=VARCHAR},
</if>
<if
test=
"sex != null"
>
#{sex,jdbcType=SMALLINT},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"org.nafmii.nafmiiadmin.po.TStudentExample"
resultType=
"java.lang.Long"
>
select count(*) from t_student
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
update t_student
<set>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=INTEGER},
</if>
<if
test=
"record.name != null"
>
name = #{record.name,jdbcType=VARCHAR},
</if>
<if
test=
"record.sex != null"
>
sex = #{record.sex,jdbcType=SMALLINT},
</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>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
update t_student
set id = #{record.id,jdbcType=INTEGER},
name = #{record.name,jdbcType=VARCHAR},
sex = #{record.sex,jdbcType=SMALLINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"org.nafmii.nafmiiadmin.po.TStudent"
>
update t_student
<set>
<if
test=
"name != null"
>
name = #{name,jdbcType=VARCHAR},
</if>
<if
test=
"sex != null"
>
sex = #{sex,jdbcType=SMALLINT},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"org.nafmii.nafmiiadmin.po.TStudent"
>
update t_student
set name = #{name,jdbcType=VARCHAR},
sex = #{sex,jdbcType=SMALLINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
\ No newline at end of file
nafmii-app/pom.xml
View file @
1d78b37
...
@@ -102,21 +102,21 @@
...
@@ -102,21 +102,21 @@
</exclusion>
</exclusion>
</exclusions>
</exclusions>
</dependency>
</dependency>
<
dependency
>
<
!--<dependency>--
>
<
groupId>
org.springframework.security.oauth.boot
</groupId
>
<
!--<groupId>org.springframework.security.oauth.boot</groupId>--
>
<
artifactId>
spring-security-oauth2-autoconfigure
</artifactId
>
<
!--<artifactId>spring-security-oauth2-autoconfigure</artifactId>--
>
<
version>
2.1.4.RELEASE
</version
>
<
!--<version>2.1.4.RELEASE</version>--
>
<
/dependency
>
<
!--</dependency>--
>
<dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<artifactId>
fastjson
</artifactId>
<version>
1.2.47
</version>
<version>
1.2.47
</version>
</dependency>
</dependency>
<!--
spring-security 5.2.0
-->
<!--
<!– spring-security 5.2.0–>
-->
<
dependency
>
<
!--<dependency>--
>
<
groupId>
org.springframework.boot
</groupId
>
<
!--<groupId>org.springframework.boot</groupId>--
>
<
artifactId>
spring-boot-starter-security
</artifactId
>
<
!--<artifactId>spring-boot-starter-security</artifactId>--
>
<
/dependency
>
<
!--</dependency>--
>
<!--集成logstash-->
<!--集成logstash-->
<dependency>
<dependency>
<groupId>
net.logstash.logback
</groupId>
<groupId>
net.logstash.logback
</groupId>
...
...
nafmii-app/src/main/java/org/nafmii/controller/UserController.java
View file @
1d78b37
package
org
.
nafmii
.
controller
;
package
org
.
nafmii
.
controller
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.nafmii.result.Result
;
import
org.nafmii.result.Result
;
import
org.nafmii.service.UserService
;
import
org.nafmii.service.UserService
;
import
org.nafmii.vo.UserVO
;
import
org.nafmii.vo.UserVO
;
...
@@ -20,9 +22,11 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -20,9 +22,11 @@ import org.springframework.web.bind.annotation.RestController;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/auth"
)
@RequestMapping
(
"/auth"
)
@Api
(
tags
=
"1.0.0"
,
description
=
"模拟用户操作"
)
public
class
UserController
{
public
class
UserController
{
@Autowired
@Autowired
private
UserService
userService
;
private
UserService
userService
;
@ApiOperation
(
value
=
"登陆"
,
notes
=
"登陆"
)
@PostMapping
(
"/login"
)
@PostMapping
(
"/login"
)
@ResponseBody
@ResponseBody
public
Result
<
UserVO
>
login
(){
public
Result
<
UserVO
>
login
(){
...
...
nafmii-app/src/main/java/org/nafmii/service/impl/UserServiceImpl.java
View file @
1d78b37
...
@@ -30,9 +30,11 @@ public class UserServiceImpl implements UserService {
...
@@ -30,9 +30,11 @@ public class UserServiceImpl implements UserService {
userVO
.
setUserName
(
"zzz"
);
userVO
.
setUserName
(
"zzz"
);
List
<
UserAndRoleVo
>
roleList
=
new
ArrayList
<>();
List
<
UserAndRoleVo
>
roleList
=
new
ArrayList
<>();
UserAndRoleVo
roleVo
=
new
UserAndRoleVo
();
UserAndRoleVo
roleVo
=
new
UserAndRoleVo
();
UserAndRoleVo
roleTwoVo
=
new
UserAndRoleVo
();
roleVo
.
setRole
(
"a"
);
roleVo
.
setRole
(
"a"
);
roleVo
.
setRole
(
"b"
);
roleList
.
add
(
roleVo
);
roleList
.
add
(
roleVo
);
roleTwoVo
.
setRole
(
"b"
);
roleList
.
add
(
roleTwoVo
);
userVO
.
setAuthorities
(
roleList
);
userVO
.
setAuthorities
(
roleList
);
StringBuilder
sbf
=
new
StringBuilder
();
StringBuilder
sbf
=
new
StringBuilder
();
for
(
UserAndRoleVo
role:
roleList
for
(
UserAndRoleVo
role:
roleList
...
...
nafmii-app/src/main/java/org/nafmii/vo/UserVO.java
View file @
1d78b37
...
@@ -16,7 +16,7 @@ import java.util.List;
...
@@ -16,7 +16,7 @@ import java.util.List;
public
class
UserVO
{
public
class
UserVO
{
private
String
userName
;
private
String
userName
;
private
String
password
;
private
String
password
;
private
String
token
;
//角色集合
private
String
token
;
private
List
<
UserAndRoleVo
>
authorities
;
private
List
<
UserAndRoleVo
>
authorities
;
//角色集合
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment