Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dm_project
Project
Project
Details
Activity
Releases
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
姚本章
dm_project
Commits
a33928ab
Commit
a33928ab
authored
Dec 01, 2020
by
ysongq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
82db2ec2
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
110 additions
and
4 deletions
+110
-4
Result.java
jz-dm-common/src/main/java/com/jz/common/utils/Result.java
+64
-0
StatusCode.java
...-common/src/main/java/com/jz/common/utils/StatusCode.java
+14
-0
jz-dm-manage.iml
jz-dm-manage/jz-dm-manage.iml
+0
-2
LoginController.java
.../com/jz/manage/moduls/controller/sys/LoginController.java
+31
-1
SysUserService.java
...ain/java/com/jz/manage/moduls/service/SysUserService.java
+1
-1
No files found.
jz-dm-common/src/main/java/com/jz/common/utils/Result.java
View file @
a33928ab
...
...
@@ -61,6 +61,70 @@ public class Result<T> implements Serializable {
return
this
;
}
public
static
long
getSerialVersionUID
()
{
return
serialVersionUID
;
}
public
boolean
isSuccess
()
{
return
success
;
}
public
void
setSuccess
(
boolean
success
)
{
this
.
success
=
success
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
T
getResult
()
{
return
result
;
}
public
void
setResult
(
T
result
)
{
this
.
result
=
result
;
}
public
long
getTimestamp
()
{
return
timestamp
;
}
public
void
setTimestamp
(
long
timestamp
)
{
this
.
timestamp
=
timestamp
;
}
public
Result
(
boolean
success
,
String
message
,
Integer
code
)
{
this
.
success
=
success
;
this
.
message
=
message
;
this
.
code
=
code
;
}
public
Result
(
boolean
success
,
String
message
,
Integer
code
,
T
result
)
{
this
.
success
=
success
;
this
.
message
=
message
;
this
.
code
=
code
;
this
.
result
=
result
;
}
public
Result
(
boolean
success
,
String
message
,
Integer
code
,
T
result
,
long
timestamp
)
{
this
.
success
=
success
;
this
.
message
=
message
;
this
.
code
=
code
;
this
.
result
=
result
;
this
.
timestamp
=
timestamp
;
}
public
static
Result
<
Object
>
ok
()
{
Result
<
Object
>
r
=
new
Result
<
Object
>();
...
...
jz-dm-common/src/main/java/com/jz/common/utils/StatusCode.java
0 → 100644
View file @
a33928ab
package
com
.
jz
.
common
.
utils
;
/**
* @ClassName: 返回状态码
* @Author: Carl
* @Date: 2020/12/1
* @Version:
*/
public
class
StatusCode
{
public
static
final
int
OK
=
30000
;
// 成功
public
static
final
int
ERROR
=
30001
;
// 失败
public
static
final
int
LOGINERROR
=
30002
;
// 用户名或密码错误
public
static
final
int
ACCESSERROR
=
30003
;
// 权限不足
}
jz-dm-manage/jz-dm-manage.iml
View file @
a33928ab
...
...
@@ -9,7 +9,6 @@
<webroots
/>
<sourceRoots>
<root
url=
"file://$MODULE_DIR$/src/main/java"
/>
<root
url=
"file://$MODULE_DIR$/src/main/resources"
/>
</sourceRoots>
</configuration>
</facet>
...
...
@@ -19,7 +18,6 @@
<output-test
url=
"file://$MODULE_DIR$/target/test-classes"
/>
<content
url=
"file://$MODULE_DIR$"
>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/java"
isTestSource=
"false"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/main/resources"
type=
"java-resource"
/>
<sourceFolder
url=
"file://$MODULE_DIR$/src/test/java"
isTestSource=
"true"
/>
<excludeFolder
url=
"file://$MODULE_DIR$/target"
/>
</content>
...
...
jz-dm-manage/src/main/java/com/jz/manage/moduls/controller/sys/LoginController.java
View file @
a33928ab
package
com
.
jz
.
manage
.
moduls
.
controller
.
sys
;
import
com.jz.common.entity.sys.SysUser
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.StatusCode
;
import
com.jz.manage.moduls.controller.BaseController
;
import
com.jz.manage.moduls.service.SysUserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/sys"
)
public
class
LoginController
extends
BaseController
{
@Autowired
private
SysUserService
sysUserService
;
/**
* 登录功能
* @param account 账号
* @param password 密码
* @return
*/
@GetMapping
(
value
=
"login"
)
public
Result
<
SysUser
>
login
(
String
account
,
String
password
)
{
// 获取用户的信息
SysUser
sysUser
=
sysUserService
.
selectByUsername
(
account
);
if
(
sysUser
==
null
)
{
return
new
Result
<>(
false
,
"用户不存在!"
,
StatusCode
.
LOGINERROR
);
}
if
(
sysUser
.
getAccount
().
equals
(
account
)
&&
sysUser
.
getPassword
().
equals
(
password
))
{
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
}
return
new
Result
<>(
false
,
"用户名或密码错误!"
,
StatusCode
.
ERROR
);
}
/*@ApiOperation("登录接口")
@RequestMapping(value = "/login", method = RequestMethod.POST)
public Result<JSONObject> login(@RequestBody SysUser sysUser, HttpServletRequest request) throws Exception {
...
...
jz-dm-manage/src/main/java/com/jz/manage/moduls/service/SysUserService.java
View file @
a33928ab
package
com
.
jz
.
manage
.
moduls
.
service
;
import
com.jz.
manage.moduls
.entity.sys.SysUser
;
import
com.jz.
common
.entity.sys.SysUser
;
import
java.util.Map
;
...
...
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