Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
shop-Mall
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
shop-Mall
Commits
c9af998c
Commit
c9af998c
authored
4 years ago
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改shiro 和数据库连接
parent
a2da5974
master
branch4
branch5
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
68 additions
and
94 deletions
+68
-94
UsersMapper.java
...mapper/src/main/java/cn/wisenergy/mapper/UsersMapper.java
+0
-7
UsersMapper.xml
wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml
+61
-81
User.java
...ergy-model/src/main/java/cn/wisenergy/model/app/User.java
+1
-1
UserService.java
...e/src/main/java/cn/wisenergy/service/app/UserService.java
+2
-2
UserServiceImpl.java
...n/java/cn/wisenergy/service/app/impl/UserServiceImpl.java
+1
-1
AuthRealm.java
...rc/main/java/cn/wisenergy/web/shiro/filter/AuthRealm.java
+2
-1
application-dev.yml
wisenergy-web-admin/src/main/resources/application-dev.yml
+1
-1
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/UsersMapper.java
View file @
c9af998c
package
cn
.
wisenergy
.
mapper
;
package
cn
.
wisenergy
.
mapper
;
import
cn.hutool.system.UserInfo
;
import
cn.wisenergy.model.app.User
;
import
cn.wisenergy.model.app.User
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
...
@@ -41,13 +40,7 @@ public interface UsersMapper extends BaseMapper<User> {
...
@@ -41,13 +40,7 @@ public interface UsersMapper extends BaseMapper<User> {
*/
*/
int
delById
(
@Param
(
"id"
)
Integer
id
);
int
delById
(
@Param
(
"id"
)
Integer
id
);
int
countByPhoneAnsUserId
(
@Param
(
"phone"
)
String
phone
,
@Param
(
"userId"
)
Integer
userId
);
List
<
User
>
getList
(
Map
<
String
,
Object
>
map
);
List
<
User
>
getList
(
Map
<
String
,
Object
>
map
);
Integer
getUserNumbers
(
Map
<
String
,
Object
>
map
);
User
getByPhone
(
@Param
(
"phone"
)
String
phone
);
List
<
User
>
test
(
@Param
(
"list"
)
List
<
String
>
list
);
}
}
This diff is collapsed.
Click to expand it.
wisenergy-mapper/src/main/resources/mapper/UsersMapper.xml
View file @
c9af998c
...
@@ -4,22 +4,31 @@
...
@@ -4,22 +4,31 @@
<mapper
namespace=
"cn.wisenergy.mapper.UsersMapper"
>
<mapper
namespace=
"cn.wisenergy.mapper.UsersMapper"
>
<resultMap
id=
"userMap"
type=
"cn.wisenergy.model.app.User"
>
<resultMap
id=
"userMap"
type=
"cn.wisenergy.model.app.User"
>
<id
column=
"id"
property=
"id"
/>
<id
column=
"id"
property=
"id"
/>
<result
column=
"user_
name"
property=
"userName
"
/>
<result
column=
"user_
id"
property=
"userId
"
/>
<result
column=
"password"
property=
"password"
/>
<result
column=
"password"
property=
"password"
/>
<result
column=
"phone"
property=
"phone"
/>
<result
column=
"user_level"
property=
"userLevel"
/>
<result
column=
"uuid"
property=
"uuid"
/>
<result
column=
"cross_border_line"
property=
"crossBorderLine"
/>
<result
column=
"head_image"
property=
"headImage"
/>
<result
column=
"id_card_number"
property=
"idCardNumber"
/>
<result
column=
"sex"
property=
"sex"
/>
<result
column=
"fans_nickname"
property=
"fansNickname"
/>
<result
column=
"school"
property=
"school"
/>
<result
column=
"fans_id"
property=
"fansId"
/>
<result
column=
"exam_type"
property=
"examType"
/>
<result
column=
"invite_code"
property=
"inviteCode"
/>
<result
column=
"source"
property=
"source"
/>
<result
column=
"be_invited_code"
property=
"beInvitedCode"
/>
<result
column=
"is_delete"
property=
"isDelete"
/>
<result
column=
"team_members_num"
property=
"teamMembersNum"
/>
<result
column=
"normal_user_num"
property=
"normalUserNum"
/>
<result
column=
"seedling_num"
property=
"seedlingNum"
/>
<result
column=
"bronze_tree_num"
property=
"bronzeTreeNum"
/>
<result
column=
"silver_tree_num"
property=
"silverTreeNum"
/>
<result
column=
"gold_tree_num"
property=
"goldTreeNum"
/>
<result
column=
"farmer_num"
property=
"farmerNum"
/>
<result
column=
"forest_start_num"
property=
"forestStartNum"
/>
<result
column=
"partner_num"
property=
"partnerNum"
/>
<result
column=
"referrer_num"
property=
"referrerNum"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
</resultMap>
</resultMap>
<sql
id=
"table"
>
<sql
id=
"table"
>
user
user
_info
</sql>
</sql>
<sql
id=
"cols_all"
>
<sql
id=
"cols_all"
>
...
@@ -28,40 +37,61 @@
...
@@ -28,40 +37,61 @@
</sql>
</sql>
<sql
id=
"cols_exclude_id"
>
<sql
id=
"cols_exclude_id"
>
user_name,password, phone,uuid,head_image,sex,school, exam_type,source,is_delete,create_time,update_time
user_id,password, user_level,cross_border_line,id_card_number,fans_nickname,fans_id, invite_code,
be_invited_code,team_members_num,normal_user_num,seedling_num,bronze_tree_num,silver_tree_num,
gold_tree_num,farmer_num,forest_start_num,partner_num,referrer_num,create_time,update_time
</sql>
</sql>
<sql
id=
"vals"
>
<sql
id=
"vals"
>
#{userName},#{password},#{phone},#{uuid},#{headImage},#{sex},#{school},#{examType}, #{source},
#{userId},#{password},#{userLevel},#{crossBorderLine},#{idCardNumber},#{fansNickname},#{fansId},#{inviteCode},
#{isDelete},now(),now()
#{beInvitedCode}, #{teamMembersNum},#{normalUserNum},#{seedlingNum},#{bronzeTreeNum},#{silverTreeNum},
#{goldTreeNum}, #{farmerNum},#{forestStartNum},#{partnerNum},#{referrerNum},now(),now()
</sql>
</sql>
<sql
id=
"updateCondition"
>
<sql
id=
"updateCondition"
>
<if
test=
"user
Name != null"
>
user_name = #{userName
},
</if>
<if
test=
"user
Id != null"
>
user_id = #{userId
},
</if>
<if
test=
"password != null"
>
password =#{password},
</if>
<if
test=
"password != null"
>
password =#{password},
</if>
<if
test=
"phone != null"
>
phone =#{phone},
</if>
<if
test=
"userLevel != null"
>
user_level =#{userLevel},
</if>
<if
test=
"uuid != null"
>
uuid =#{uuid},
</if>
<if
test=
"crossBorderLine != null"
>
cross_border_line =#{crossBorderLine},
</if>
<if
test=
"headImage != null"
>
head_image =#{headImage},
</if>
<if
test=
"idCardNumber != null"
>
id_card_number = #{idCardNumber},
</if>
<if
test=
"sex != null"
>
sex =#{sex},
</if>
<if
test=
"fansNickname != null"
>
fans_nickname =#{fansNickname},
</if>
<if
test=
"school != null"
>
school =#{school},
</if>
<if
test=
"fansId != null"
>
fans_id =#{fansId},
</if>
<if
test=
"examType != null"
>
exam_type = #{examType},
</if>
<if
test=
"inviteCode != null"
>
invite_code =#{inviteCode},
</if>
<if
test=
"source != null"
>
source = #{source},
</if>
<if
test=
"beInvitedCode != null"
>
be_invited_code = #{beInvitedCode},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete},
</if>
<if
test=
"teamMembersNum != null"
>
team_members_num = #{teamMembersNum},
</if>
<if
test=
"normalUserNum != null"
>
normal_user_num = #{normalUserNum},
</if>
<if
test=
"seedlingNum != null"
>
seedling_num = #{seedlingNum},
</if>
<if
test=
"bronzeTreeNum != null"
>
bronze_tree_num = #{bronzeTreeNum},
</if>
<if
test=
"silverTreeNum != null"
>
silver_tree_num = #{silverTreeNum},
</if>
<if
test=
"goldTreeNum != null"
>
gold_tree_num = #{goldTreeNum},
</if>
<if
test=
"farmerNum != null"
>
farmer_num = #{farmerNum},
</if>
<if
test=
"forestStartNum != null"
>
forest_start_num = #{forestStartNum},
</if>
<if
test=
"partnerNum != null"
>
partner_num = #{partnerNum},
</if>
<if
test=
"referrerNum != null"
>
referrer_num = #{referrerNum},
</if>
update_time =now()
update_time =now()
</sql>
</sql>
<sql
id=
"criteria"
>
<sql
id=
"criteria"
>
<if
test=
"id != null"
>
id = #{id}
</if>
<if
test=
"id != null"
>
id = #{id}
</if>
<if
test=
"user
Name != null"
>
and user_name = #{userName
}
</if>
<if
test=
"user
Id != null"
>
and user_id = #{userId
}
</if>
<if
test=
"password != null"
>
and password =#{password}
</if>
<if
test=
"password != null"
>
and password =#{password}
</if>
<if
test=
"phone != null"
>
and phone =#{phone}
</if>
<if
test=
"userLevel != null"
>
and user_level =#{userLevel}
</if>
<if
test=
"uuid != null"
>
and uuid =#{uuid}
</if>
<if
test=
"crossBorderLine != null"
>
and cross_border_line =#{crossBorderLine}
</if>
<if
test=
"headImage != null"
>
and head_image =#{headImage}
</if>
<if
test=
"idCardNumber != null"
>
and id_card_number = #{idCardNumber}
</if>
<if
test=
"sex != null"
>
and sex =#{sex}
</if>
<if
test=
"fansNickname != null"
>
and fans_nickname =#{fansNickname}
</if>
<if
test=
"school != null"
>
and school =#{school}
</if>
<if
test=
"fansId != null"
>
and fans_id =#{fansId}
</if>
<if
test=
"examType != null"
>
and exam_type = #{examType}
</if>
<if
test=
"inviteCode != null"
>
and invite_code =#{inviteCode}
</if>
<if
test=
"source != null"
>
and source = #{source}
</if>
<if
test=
"beInvitedCode != null"
>
and be_invited_code = #{beInvitedCode}
</if>
<if
test=
"isDelete != null"
>
and is_delete = #{isDelete}
</if>
<if
test=
"teamMembersNum != null"
>
and team_members_num = #{teamMembersNum}
</if>
<if
test=
"normalUserNum != null"
>
and normal_user_num = #{normalUserNum}
</if>
<if
test=
"seedlingNum != null"
>
and seedling_num = #{seedlingNum}
</if>
<if
test=
"bronzeTreeNum != null"
>
and bronze_tree_num = #{bronzeTreeNum}
</if>
<if
test=
"silverTreeNum != null"
>
and silver_tree_num = #{silverTreeNum}
</if>
<if
test=
"goldTreeNum != null"
>
and gold_tree_num = #{goldTreeNum}
</if>
<if
test=
"farmerNum != null"
>
and farmer_num = #{farmerNum}
</if>
<if
test=
"forestStartNum != null"
>
and forest_start_num = #{forestStartNum}
</if>
<if
test=
"partnerNum != null"
>
and partner_num = #{partnerNum}
</if>
<if
test=
"referrerNum != null"
>
and referrer_num = #{referrerNum}
</if>
<if
test=
"createTime != null"
>
and create_time
>
= #{createTime}
</if>
<if
test=
"createTime != null"
>
and create_time
>
= #{createTime}
</if>
<if
test=
"updateTime != null"
>
and #{updateTime}
>
= update_time
</if>
<if
test=
"updateTime != null"
>
and #{updateTime}
>
= update_time
</if>
</sql>
</sql>
...
@@ -92,13 +122,6 @@
...
@@ -92,13 +122,6 @@
where id = #{id}
where id = #{id}
</delete>
</delete>
<select
id=
"countByPhoneAnsUserId"
resultType=
"java.lang.Integer"
>
SELECT COUNT(1)
FROM
<include
refid=
"table"
/>
WHERE phone=#{phone} and id !=#{userId} and is_delete=0
</select>
<select
id=
"getList"
resultMap=
"userMap"
parameterType=
"map"
>
<select
id=
"getList"
resultMap=
"userMap"
parameterType=
"map"
>
select
select
<include
refid=
"cols_all"
/>
<include
refid=
"cols_all"
/>
...
@@ -121,47 +144,4 @@
...
@@ -121,47 +144,4 @@
limit #{pageNo},#{pageSize}
limit #{pageNo},#{pageSize}
</where>
</where>
</select>
</select>
<select
id=
"getUserNumbers"
resultType=
"java.lang.Integer"
>
SELECT COUNT(id)
FROM
<include
refid=
"table"
/>
<where>
is_delete=0
<if
test=
"startTime != null"
>
and create_time
between #{startTime}
</if>
<if
test=
"endTime != null"
>
and #{endTime}
</if>
<if
test=
"userName != null"
>
and user_name like ('%' #{userName} '%')
</if>
<if
test=
"phone != null"
>
and phone like ('%' #{phone} '%')
</if>
</where>
</select>
<select
id=
"getByPhone"
resultType=
"cn.wisenergy.model.app.User"
>
SELECT
<include
refid=
"cols_all"
/>
FROM
<include
refid=
"table"
/>
where is_delete=0 and phone=#{phone}
</select>
<select
id=
"test"
resultType=
"cn.wisenergy.model.app.User"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
<where>
<if
test=
"list != null"
>
<foreach
collection=
"list"
index=
"index"
item=
"id"
separator=
"or"
open=
"("
close=
")"
>
user_name LIKE CONCAT('%',#{id},'%')
</foreach>
</if>
</where>
</select>
</mapper>
</mapper>
This diff is collapsed.
Click to expand it.
wisenergy-model/src/main/java/cn/wisenergy/model/app/User.java
View file @
c9af998c
...
@@ -18,7 +18,7 @@ import java.util.Date;
...
@@ -18,7 +18,7 @@ import java.util.Date;
* @ CreateDate : 2020/11/8 19:59
* @ CreateDate : 2020/11/8 19:59
*/
*/
@Data
@Data
@ApiModel
(
value
=
"
AccountUsers
"
)
@ApiModel
(
value
=
"
User
"
)
@TableName
(
"user_info"
)
@TableName
(
"user_info"
)
public
class
User
extends
Model
<
User
>
implements
Serializable
{
public
class
User
extends
Model
<
User
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
2525339404301884673L
;
private
static
final
long
serialVersionUID
=
2525339404301884673L
;
...
...
This diff is collapsed.
Click to expand it.
wisenergy-service/src/main/java/cn/wisenergy/service/app/UserService.java
View file @
c9af998c
...
@@ -15,10 +15,10 @@ public interface UserService {
...
@@ -15,10 +15,10 @@ public interface UserService {
/**
/**
* 获取用户信息
* 获取用户信息
* @param
phone 电话号码
* @param
userId 用户id
* @return 用户信息
* @return 用户信息
*/
*/
User
getBy
Phone
(
String
phone
);
User
getBy
Id
(
Integer
userId
);
R
<
List
<
User
>>
test
();
R
<
List
<
User
>>
test
();
...
...
This diff is collapsed.
Click to expand it.
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UserServiceImpl.java
View file @
c9af998c
...
@@ -24,7 +24,7 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
...
@@ -24,7 +24,7 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
private
UsersMapper
usersMapper
;
private
UsersMapper
usersMapper
;
@Override
@Override
public
User
getBy
Phone
(
String
phone
)
{
public
User
getBy
Id
(
Integer
userId
)
{
return
null
;
return
null
;
}
}
...
...
This diff is collapsed.
Click to expand it.
wisenergy-web-admin/src/main/java/cn/wisenergy/web/shiro/filter/AuthRealm.java
View file @
c9af998c
...
@@ -4,6 +4,7 @@ import cn.wisenergy.common.constant.RedisConsts;
...
@@ -4,6 +4,7 @@ import cn.wisenergy.common.constant.RedisConsts;
import
cn.wisenergy.common.enums.RespCodeEnum
;
import
cn.wisenergy.common.enums.RespCodeEnum
;
import
cn.wisenergy.model.app.AccountInfo
;
import
cn.wisenergy.model.app.AccountInfo
;
import
cn.wisenergy.model.app.User
;
import
cn.wisenergy.model.app.User
;
import
cn.wisenergy.service.app.UserService
;
import
cn.wisenergy.web.config.JwtConfig
;
import
cn.wisenergy.web.config.JwtConfig
;
import
cn.wisenergy.web.shiro.AuthToken
;
import
cn.wisenergy.web.shiro.AuthToken
;
import
cn.wisenergy.web.shiro.JwtUtil
;
import
cn.wisenergy.web.shiro.JwtUtil
;
...
@@ -98,7 +99,7 @@ public class AuthRealm extends AuthorizingRealm {
...
@@ -98,7 +99,7 @@ public class AuthRealm extends AuthorizingRealm {
throw new IncorrectCredentialsException(RespCodeEnum.TOKEN_IS_NOT_TIMEOUT.getMsg());
throw new IncorrectCredentialsException(RespCodeEnum.TOKEN_IS_NOT_TIMEOUT.getMsg());
}*/
}*/
//查询用户信息
//查询用户信息
User
user
=
authUserService
.
getBy
Phone
(
userEntity
.
getPhone
());
User
user
=
authUserService
.
getBy
Id
(
userEntity
.
getId
());
// 判断请求token与redis中是否相同,如果token被刷新,则不判断
// 判断请求token与redis中是否相同,如果token被刷新,则不判断
if
(!
refreshFlag
&&
!
StringUtils
.
equals
(
accessToken
,
redisToken
))
{
if
(!
refreshFlag
&&
!
StringUtils
.
equals
(
accessToken
,
redisToken
))
{
throw
new
IncorrectCredentialsException
(
RespCodeEnum
.
NO_AUTH_REQUEST
.
getMsg
());
throw
new
IncorrectCredentialsException
(
RespCodeEnum
.
NO_AUTH_REQUEST
.
getMsg
());
...
...
This diff is collapsed.
Click to expand it.
wisenergy-web-admin/src/main/resources/application-dev.yml
View file @
c9af998c
...
@@ -3,7 +3,7 @@ spring:
...
@@ -3,7 +3,7 @@ spring:
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
druid
:
druid
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://192.168.110.16
5
:3306/shop_app?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
url
:
jdbc:mysql://192.168.110.16
4
:3306/shop_app?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
username
:
root
username
:
root
password
:
adm4HYservice$
password
:
adm4HYservice$
initial-size
:
10
initial-size
:
10
...
...
This diff is collapsed.
Click to expand it.
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