Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
V
volunteer_service
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
licc
volunteer_service
Commits
59aca9d8
Commit
59aca9d8
authored
Jan 13, 2021
by
liaoanyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理端登录实现
parent
fe19ab49
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
292 additions
and
7 deletions
+292
-7
pom.xml
wisenergy-common/pom.xml
+1
-1
AccountMapper.java
...pper/src/main/java/cn/wisenergy/mapper/AccountMapper.java
+16
-0
UsersMapper.java
...mapper/src/main/java/cn/wisenergy/mapper/UsersMapper.java
+12
-0
AccountInfoMapper.xml
...gy-mapper/src/main/resources/mapper/AccountInfoMapper.xml
+61
-0
AccountInfo.java
...del/src/main/java/cn/wisenergy/model/app/AccountInfo.java
+54
-0
CardInfo.java
...-model/src/main/java/cn/wisenergy/model/app/CardInfo.java
+1
-0
PayRecord.java
...model/src/main/java/cn/wisenergy/model/app/PayRecord.java
+1
-0
RefillCard.java
...odel/src/main/java/cn/wisenergy/model/app/RefillCard.java
+3
-1
SchemeInnfo.java
...del/src/main/java/cn/wisenergy/model/app/SchemeInnfo.java
+3
-1
UserLimit.java
...model/src/main/java/cn/wisenergy/model/app/UserLimit.java
+3
-1
UserVolunteer.java
...l/src/main/java/cn/wisenergy/model/app/UserVolunteer.java
+4
-1
BaseEntity.java
...l/src/main/java/cn/wisenergy/model/common/BaseEntity.java
+1
-1
AccountDto.java
...odel/src/main/java/cn/wisenergy/model/dto/AccountDto.java
+25
-0
AccountSerivce.java
...rc/main/java/cn/wisenergy/service/app/AccountSerivce.java
+15
-0
AccountSerivceImpl.java
...ava/cn/wisenergy/service/app/impl/AccountSerivceImpl.java
+49
-0
AccountController.java
...wisenergy/web/admin/controller/app/AccountController.java
+42
-0
application-dev.yml
wisenergy-web-admin/src/main/resources/application-dev.yml
+1
-1
No files found.
wisenergy-common/pom.xml
View file @
59aca9d8
...
...
@@ -75,7 +75,7 @@
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid-spring-boot-starter
</artifactId>
<version>
1.
1.22
</version>
<version>
1.
2.1
</version>
</dependency>
<!-- Redis -->
<dependency>
...
...
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/AccountMapper.java
0 → 100644
View file @
59aca9d8
package
cn
.
wisenergy
.
mapper
;
import
cn.wisenergy.model.app.AccountInfo
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
java.util.Map
;
public
interface
AccountMapper
extends
BaseMapper
<
AccountInfo
>
{
/**
* 查询管理员信息
* @param map 查询参数
* @return
*/
AccountInfo
getAccountInfo
(
Map
<
String
,
Object
>
map
);
}
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/UsersMapper.java
View file @
59aca9d8
package
cn
.
wisenergy
.
mapper
;
import
cn.wisenergy.model.app.UserInfo
;
import
cn.wisenergy.model.vo.UserQueryVo
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
*@ Description:
*@ Author : 86187
...
...
@@ -34,4 +39,11 @@ public interface UsersMapper extends BaseMapper<UserInfo> {
int
delById
(
@Param
(
"id"
)
Integer
id
);
int
countByPhoneAnsUserId
(
@Param
(
"phone"
)
String
phone
,
@Param
(
"userId"
)
Integer
userId
);
/**
* 查询用户信息
* @param map 查询参数
* @return
*/
List
<
UserInfo
>
getList
(
Map
<
String
,
Object
>
map
);
}
wisenergy-mapper/src/main/resources/mapper/AccountInfoMapper.xml
0 → 100644
View file @
59aca9d8
<?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=
"cn.wisenergy.mapper.AccountMapper"
>
<resultMap
id=
"AccountMap"
type=
"cn.wisenergy.model.app.AccountInfo"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"user_name"
property=
"userName"
/>
<result
column=
"password"
property=
"password"
/>
<result
column=
"head_image"
property=
"headImage"
/>
<result
column=
"is_delete"
property=
"isDelete"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
</resultMap>
<sql
id=
"table"
>
account
</sql>
<sql
id=
"cols_all"
>
id,
<include
refid=
"cols_exclude_id"
/>
</sql>
<sql
id=
"cols_exclude_id"
>
user_name,password,head_image,is_delete,create_time,update_time
</sql>
<sql
id=
"vals"
>
#{userName},#{password},#{headImage},
#{isDelete},now(),now()
</sql>
<sql
id=
"updateCondition"
>
<if
test=
"userName != null"
>
user_name = #{userName},
</if>
<if
test=
"password != null"
>
password =#{password},
</if>
<if
test=
"headImage != null"
>
head_image =#{headImage},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete},
</if>
update_time =now()
</sql>
<sql
id=
"criteria"
>
<if
test=
"id != null"
>
id = #{id}
</if>
<if
test=
"userName != null"
>
and user_name = #{userName}
</if>
<if
test=
"password != null"
>
and password =#{password}
</if>
<if
test=
"headImage != null"
>
and head_image =#{headImage}
</if>
<if
test=
"isDelete != null"
>
and is_delete = #{isDelete}
</if>
<if
test=
"createTime != null"
>
and create_time
>
= #{createTime}
</if>
<if
test=
"updateTime != null"
>
and #{updateTime}
>
= update_time
</if>
</sql>
<select
id=
"getAccountInfo"
resultMap=
"AccountMap"
parameterType=
"map"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
<where>
user_name = #{userName}
and
is_delete=0;
</where>
</select>
</mapper>
\ No newline at end of file
wisenergy-model/src/main/java/cn/wisenergy/model/app/AccountInfo.java
0 → 100644
View file @
59aca9d8
package
cn
.
wisenergy
.
model
.
app
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
@Data
@ApiModel
(
value
=
"AccountInfo"
)
public
class
AccountInfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3050641578536493424L
;
/**
* 管理员主键id
*/
@ApiModelProperty
(
name
=
"id"
,
value
=
"管理员主键id"
)
private
Integer
id
;
/**
* 管理员账号
*/
@ApiModelProperty
(
name
=
"name"
,
value
=
"管理员账号"
)
private
String
userName
;
/**
* 管理员密码
*/
@ApiModelProperty
(
name
=
"password"
,
value
=
"管理员密码"
)
private
String
password
;
/**
* 头像
*/
@ApiModelProperty
(
name
=
"headImage"
,
value
=
"头像"
)
private
String
headImage
;
/**
* 是否删除
*/
@ApiModelProperty
(
name
=
"isDelete"
,
value
=
"是否删除 0:正常 1:删除"
)
private
Integer
isDelete
;
/**
* 创建时间
*/
@ApiModelProperty
(
name
=
"createTime"
,
value
=
"创建时间"
)
private
Date
createTime
;
/**
* 修改时间
*/
@ApiModelProperty
(
name
=
"updateTime"
,
value
=
"修改时间"
)
private
Date
updateTime
;
}
wisenergy-model/src/main/java/cn/wisenergy/model/app/CardInfo.java
View file @
59aca9d8
...
...
@@ -10,6 +10,7 @@ import java.util.Date;
@Data
@ApiModel
(
value
=
"CardInfo"
)
public
class
CardInfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
5934833963262442092L
;
/**
* 子卡id
*/
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/app/PayRecord.java
View file @
59aca9d8
...
...
@@ -10,6 +10,7 @@ import java.util.Date;
@Data
@ApiModel
(
value
=
"PayRecord"
)
public
class
PayRecord
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1133836167538757507L
;
/**
* 充值记录id
*/
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/app/RefillCard.java
View file @
59aca9d8
...
...
@@ -4,11 +4,13 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
@Data
@ApiModel
(
value
=
"RefillCard"
)
public
class
RefillCard
{
public
class
RefillCard
implements
Serializable
{
private
static
final
long
serialVersionUID
=
4018232893584885138L
;
/**
* 充值卡id
*/
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/app/SchemeInnfo.java
View file @
59aca9d8
...
...
@@ -4,11 +4,13 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
@Data
@ApiModel
(
value
=
"SchemeInnfo"
)
public
class
SchemeInnfo
{
public
class
SchemeInnfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
7020644673356401949L
;
/**
* 方案id
*/
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/app/UserLimit.java
View file @
59aca9d8
...
...
@@ -4,11 +4,13 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
@Data
@ApiModel
(
value
=
"UserLimit"
)
public
class
UserLimit
{
public
class
UserLimit
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3956830394491346594L
;
/**
* 用户卡点id
*/
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/app/UserVolunteer.java
View file @
59aca9d8
...
...
@@ -4,9 +4,12 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
@ApiModel
(
value
=
"UserVolunteer"
)
public
class
UserVolunteer
{
public
class
UserVolunteer
implements
Serializable
{
private
static
final
long
serialVersionUID
=
8617194272686159825L
;
/**
* 用户方案id
*/
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/common/BaseEntity.java
View file @
59aca9d8
...
...
@@ -30,6 +30,6 @@ public abstract class BaseEntity implements Serializable {
* 删除标记
*/
@ApiModelProperty
(
"是否删除 1,删除;0,未删除"
)
private
String
isDelete
;
private
Integer
isDelete
;
}
wisenergy-model/src/main/java/cn/wisenergy/model/dto/AccountDto.java
0 → 100644
View file @
59aca9d8
package
cn
.
wisenergy
.
model
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
@ApiModel
(
value
=
"AccountDto"
)
public
class
AccountDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
6722696621467423127L
;
/**
* 管理员账号
*/
@ApiModelProperty
(
name
=
"name"
,
value
=
"管理员账号"
)
private
String
userName
;
/**
* 头像
*/
@ApiModelProperty
(
name
=
"headImage"
,
value
=
"头像"
)
private
String
headImage
;
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/AccountSerivce.java
0 → 100644
View file @
59aca9d8
package
cn
.
wisenergy
.
service
.
app
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.dto.AccountDto
;
import
java.util.Map
;
public
interface
AccountSerivce
{
/**
* 查询管理员信息
* @param userName,password 查询参数
* @return
*/
R
<
AccountDto
>
getAccountInfo
(
String
userName
,
String
password
);
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/AccountSerivceImpl.java
0 → 100644
View file @
59aca9d8
package
cn
.
wisenergy
.
service
.
app
.
impl
;
import
cn.hutool.crypto.digest.MD5
;
import
cn.wisenergy.common.utils.Md5Util
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.mapper.AccountMapper
;
import
cn.wisenergy.model.app.AccountInfo
;
import
cn.wisenergy.model.dto.AccountDto
;
import
cn.wisenergy.service.app.AccountSerivce
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.tomcat.util.codec.binary.Base64
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.Map
;
@Slf4j
@Service
public
class
AccountSerivceImpl
implements
AccountSerivce
{
@Autowired
private
AccountMapper
accountMapper
;
@Override
public
R
<
AccountDto
>
getAccountInfo
(
String
userName
,
String
password
)
{
log
.
info
(
"AccountSerivceImpl[].getAccountInfo[].input.param:userName,password"
+
userName
,
password
);
//创建参数容器map
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>(
4
);
//将参数放入容器中
map
.
put
(
"userName"
,
userName
);
//查询管理者信息
AccountInfo
accountInfo
=
accountMapper
.
getAccountInfo
(
map
);
//判断信息是否查询成功
if
(
null
==
accountInfo
)
{
//查询失败抛出异常
return
R
.
error
(
"用户不存在"
);
}
//将加密过后的密码与传输数据进行比较
String
s
=
Md5Util
.
digestMD5
(
accountInfo
.
getPassword
());
if
(!
password
.
equals
(
s
))
{
return
R
.
error
(
"密码或者用户名错误"
);
}
//查询超过则进行数据copy
AccountDto
accountDto
=
new
AccountDto
();
BeanUtils
.
copyProperties
(
accountInfo
,
accountDto
);
//返回数据
return
R
.
ok
(
accountDto
);
}
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/AccountController.java
0 → 100644
View file @
59aca9d8
package
cn
.
wisenergy
.
web
.
admin
.
controller
.
app
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.dto.AccountDto
;
import
cn.wisenergy.service.app.AccountSerivce
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
tags
=
"管理员登录"
)
@RestController
@RequestMapping
(
"/account"
)
@Slf4j
public
class
AccountController
{
@Autowired
private
AccountSerivce
accountSerivce
;
@ApiOperation
(
value
=
"管理员登录"
,
notes
=
"管理员登录"
,
httpMethod
=
"POST"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"userName"
,
value
=
"账号"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"password"
,
value
=
"密码"
,
required
=
true
)
})
@PostMapping
(
"/login"
)
public
R
<
AccountDto
>
getAccountInfo
(
String
userName
,
String
password
){
log
.
info
(
"AccountController[].getAccountInfo[].input.param:userName,password"
+
userName
,
password
);
//判断参数是否为空
if
(
StringUtils
.
isEmpty
(
userName
)||
StringUtils
.
isEmpty
(
password
))
{
return
R
.
error
(
"账号或密码为空"
);
}
//查询管理员信息
R
<
AccountDto
>
accountInfo1
=
accountSerivce
.
getAccountInfo
(
userName
,
password
);
//返回数据
return
accountInfo1
;
}
}
wisenergy-web-admin/src/main/resources/application-dev.yml
View file @
59aca9d8
...
...
@@ -5,7 +5,7 @@ spring:
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://localhost:3306/exam?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
username
:
root
password
:
root
password
:
initial-size
:
10
max-active
:
100
min-idle
:
10
...
...
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