Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1-office-web-sit
Overview
Overview
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
吴迪
gs1-office-web-sit
Commits
9149956a
Commit
9149956a
authored
Dec 08, 2021
by
唐功亮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】 用户登录-(未完成)
parent
89d3dbf2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
285 additions
and
1 deletions
+285
-1
LogLoginController.java
.../office/modules/manage/controller/LogLoginController.java
+104
-0
LogLoginDao.java
src/main/java/io/office/modules/manage/dao/LogLoginDao.java
+21
-0
MemberDao.java
src/main/java/io/office/modules/manage/dao/MemberDao.java
+6
-1
LogLoginEntity.java
.../java/io/office/modules/manage/entity/LogLoginEntity.java
+67
-0
LogLoginService.java
...ava/io/office/modules/manage/service/LogLoginService.java
+24
-0
LogLoginServiceImpl.java
...fice/modules/manage/service/impl/LogLoginServiceImpl.java
+63
-0
No files found.
src/main/java/io/office/modules/manage/controller/LogLoginController.java
0 → 100644
View file @
9149956a
package
io
.
office
.
modules
.
manage
.
controller
;
import
java.util.Arrays
;
import
java.util.Map
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
io.office.modules.manage.entity.LogLoginEntity
;
import
io.office.modules.manage.service.LogLoginService
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.R
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-08 17:47:13
*/
@RestController
@RequestMapping
(
"/loglogin"
)
public
class
LogLoginController
{
@Autowired
private
LogLoginService
logLoginService
;
/**
* 用户登录
*/
@RequestMapping
(
"/api/login"
)
// @RequiresPermissions("manage:member:list")
public
R
login
(
@RequestBody
Map
<
String
,
Object
>
params
,
HttpServletRequest
request
,
HttpServletResponse
response
){
logLoginService
.
login
(
params
,
request
,
response
);
return
R
.
ok
();
}
/**
* 列表
*/
@RequestMapping
(
"/list"
)
// @RequiresPermissions("manage:loglogin:list")
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
PageUtils
page
=
logLoginService
.
queryPage
(
params
);
return
R
.
ok
().
put
(
"page"
,
page
);
}
/**
* 信息
*/
@RequestMapping
(
"/info/{id}"
)
// @RequiresPermissions("manage:loglogin:info")
public
R
info
(
@PathVariable
(
"id"
)
Integer
id
){
LogLoginEntity
logLogin
=
logLoginService
.
getById
(
id
);
return
R
.
ok
().
put
(
"logLogin"
,
logLogin
);
}
/**
* 保存
*/
@RequestMapping
(
"/save"
)
// @RequiresPermissions("manage:loglogin:save")
public
R
save
(
@RequestBody
LogLoginEntity
logLogin
){
logLoginService
.
save
(
logLogin
);
return
R
.
ok
();
}
/**
* 修改
*/
@RequestMapping
(
"/update"
)
// @RequiresPermissions("manage:loglogin:update")
public
R
update
(
@RequestBody
LogLoginEntity
logLogin
){
logLoginService
.
updateById
(
logLogin
);
return
R
.
ok
();
}
/**
* 删除
*/
@RequestMapping
(
"/delete"
)
// @RequiresPermissions("manage:loglogin:delete")
public
R
delete
(
@RequestBody
Integer
[]
ids
){
logLoginService
.
removeByIds
(
Arrays
.
asList
(
ids
));
return
R
.
ok
();
}
}
src/main/java/io/office/modules/manage/dao/LogLoginDao.java
0 → 100644
View file @
9149956a
package
io
.
office
.
modules
.
manage
.
dao
;
import
io.office.modules.manage.entity.LogLoginEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Select
;
import
org.springframework.data.repository.query.Param
;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-08 17:47:13
*/
@Mapper
public
interface
LogLoginDao
extends
BaseMapper
<
LogLoginEntity
>
{
}
src/main/java/io/office/modules/manage/dao/MemberDao.java
View file @
9149956a
package
io
.
office
.
modules
.
manage
.
dao
;
import
io.office.modules.manage.entity.LogLoginEntity
;
import
io.office.modules.manage.entity.MemberEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Select
;
import
org.springframework.data.repository.query.Param
;
/**
* ${comments}
...
...
@@ -13,5 +16,7 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public
interface
MemberDao
extends
BaseMapper
<
MemberEntity
>
{
@Select
(
"select * from member where username=#{userName}"
)
MemberEntity
selectByName
(
@Param
(
"userName"
)
String
userName
);
}
src/main/java/io/office/modules/manage/entity/LogLoginEntity.java
0 → 100644
View file @
9149956a
package
io
.
office
.
modules
.
manage
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-08 17:47:13
*/
@Data
@TableName
(
"log_login"
)
public
class
LogLoginEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* $column.comments
*/
@TableId
private
Integer
id
;
/**
* $column.comments
*/
private
String
username
;
/**
* $column.comments
*/
private
String
search
;
/**
* $column.comments
*/
private
String
carno
;
/**
* $column.comments
*/
private
String
userphone
;
/**
* $column.comments
*/
private
Date
loginTime
;
/**
* $column.comments
*/
private
String
loginIp
;
/**
* $column.comments
*/
private
String
loginUrl
;
public
LogLoginEntity
(
Integer
id
,
String
username
,
String
search
,
String
carno
,
String
userphone
,
Date
loginTime
,
String
loginIp
,
String
loginUrl
)
{
this
.
id
=
id
;
this
.
username
=
username
;
this
.
search
=
search
;
this
.
carno
=
carno
;
this
.
userphone
=
userphone
;
this
.
loginTime
=
loginTime
;
this
.
loginIp
=
loginIp
;
this
.
loginUrl
=
loginUrl
;
}
}
src/main/java/io/office/modules/manage/service/LogLoginService.java
0 → 100644
View file @
9149956a
package
io
.
office
.
modules
.
manage
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
io.office.common.utils.PageUtils
;
import
io.office.modules.manage.entity.LogLoginEntity
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Map
;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-08 17:47:13
*/
public
interface
LogLoginService
extends
IService
<
LogLoginEntity
>
{
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
void
login
(
Map
<
String
,
Object
>
params
,
HttpServletRequest
request
,
HttpServletResponse
response
);
}
src/main/java/io/office/modules/manage/service/impl/LogLoginServiceImpl.java
0 → 100644
View file @
9149956a
package
io
.
office
.
modules
.
manage
.
service
.
impl
;
import
io.office.common.exception.RRException
;
import
io.office.modules.manage.dao.MemberDao
;
import
io.office.modules.manage.entity.MemberEntity
;
import
io.office.modules.manage.utils.MD5Util
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.Query
;
import
io.office.modules.manage.dao.LogLoginDao
;
import
io.office.modules.manage.entity.LogLoginEntity
;
import
io.office.modules.manage.service.LogLoginService
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
@Service
(
"logLoginService"
)
public
class
LogLoginServiceImpl
extends
ServiceImpl
<
LogLoginDao
,
LogLoginEntity
>
implements
LogLoginService
{
@Autowired
private
LogLoginDao
logLoginDao
;
@Autowired
private
MemberDao
memberDao
;
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
IPage
<
LogLoginEntity
>
page
=
this
.
page
(
new
Query
<
LogLoginEntity
>().
getPage
(
params
),
new
QueryWrapper
<
LogLoginEntity
>()
);
return
new
PageUtils
(
page
);
}
@Override
public
void
login
(
Map
<
String
,
Object
>
params
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
String
userName
=
String
.
valueOf
(
params
.
get
(
"userName"
)==
null
?
""
:
params
.
get
(
"userName"
));
String
passWord
=
String
.
valueOf
(
params
.
get
(
"passWord"
)==
null
?
""
:
params
.
get
(
"passWord"
));
String
verification
=
String
.
valueOf
(
params
.
get
(
"verification"
)==
null
?
""
:
params
.
get
(
"verification"
));
//验证码
//session中获取验证码
//判断 验证码是否正确
MemberEntity
user
=
memberDao
.
selectByName
(
userName
);
String
phone
=
user
.
getPhone
();
String
password
=
user
.
getPassword
();
String
passwordMD5
=
MD5Util
.
md5Encrypt32Upper
(
passWord
);
//判断密码是否正确
if
(!
passwordMD5
.
equals
(
password
)){
throw
new
RRException
(
"密码不正确!"
);
}
//添加登录日志 log_login
logLoginDao
.
insert
(
new
LogLoginEntity
(
1
,
userName
,
"用户来源"
,
"条码卡号"
,
phone
,
new
Date
(),
"IP"
,
"url"
));
}
}
\ 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