Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
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
zengtianlai3
ioc_sixiang_license
Commits
a9761422
Commit
a9761422
authored
Feb 02, 2023
by
ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善查询应用列表
parent
6ac67a3d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
8 deletions
+18
-8
AuthManager.java
...e/src/main/java/iot/sixiang/license/auth/AuthManager.java
+1
-1
ApplyController.java
.../java/iot/sixiang/license/controller/ApplyController.java
+8
-1
ApplyMapper.java
...src/main/java/iot/sixiang/license/mapper/ApplyMapper.java
+1
-1
ApplyService.java
...c/main/java/iot/sixiang/license/service/ApplyService.java
+1
-1
ApplyServiceImpl.java
...va/iot/sixiang/license/service/impl/ApplyServiceImpl.java
+2
-2
ApplyMapper.xml
license/src/main/resources/mapper/ApplyMapper.xml
+5
-2
No files found.
license/src/main/java/iot/sixiang/license/auth/AuthManager.java
View file @
a9761422
...
@@ -46,7 +46,7 @@ public class AuthManager {
...
@@ -46,7 +46,7 @@ public class AuthManager {
public
void
initApps
()
{
public
void
initApps
()
{
allApply
=
new
HashMap
<>();
allApply
=
new
HashMap
<>();
PageInfoModel
<
AppVo
>
records
=
applyService
.
getAppList
(
1
,
10000
,
""
);
PageInfoModel
<
AppVo
>
records
=
applyService
.
getAppList
(
1
,
10000
,
null
,
""
);
List
<
AppVo
>
appList
=
records
.
getResult
();
List
<
AppVo
>
appList
=
records
.
getResult
();
for
(
Apply
apply
:
appList
)
{
for
(
Apply
apply
:
appList
)
{
String
appId
=
apply
.
getAppId
();
String
appId
=
apply
.
getAppId
();
...
...
license/src/main/java/iot/sixiang/license/controller/ApplyController.java
View file @
a9761422
...
@@ -9,6 +9,8 @@ import io.swagger.annotations.Api;
...
@@ -9,6 +9,8 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
iot.sixiang.license.handler.IotLicenseException
;
import
iot.sixiang.license.jwt.UserUtils
;
import
iot.sixiang.license.log.BusinessType
;
import
iot.sixiang.license.log.BusinessType
;
import
iot.sixiang.license.log.MyLog
;
import
iot.sixiang.license.log.MyLog
;
import
iot.sixiang.license.model.BaseResult
;
import
iot.sixiang.license.model.BaseResult
;
...
@@ -17,6 +19,7 @@ import iot.sixiang.license.model.PageResult;
...
@@ -17,6 +19,7 @@ import iot.sixiang.license.model.PageResult;
import
iot.sixiang.license.model.vo.AppVo
;
import
iot.sixiang.license.model.vo.AppVo
;
import
iot.sixiang.license.service.ApplyService
;
import
iot.sixiang.license.service.ApplyService
;
import
iot.sixiang.license.xss.XssUtil
;
import
iot.sixiang.license.xss.XssUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.DigestUtils
;
import
org.springframework.util.DigestUtils
;
import
org.springframework.web.bind.WebDataBinder
;
import
org.springframework.web.bind.WebDataBinder
;
...
@@ -90,7 +93,11 @@ public class ApplyController {
...
@@ -90,7 +93,11 @@ public class ApplyController {
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"0"
)
int
pageSize
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"0"
)
int
pageSize
,
@RequestParam
(
value
=
"appName"
,
required
=
false
)
String
appName
)
{
@RequestParam
(
value
=
"appName"
,
required
=
false
)
String
appName
)
{
appName
=
XssUtil
.
checkXSS
(
appName
);
appName
=
XssUtil
.
checkXSS
(
appName
);
PageInfoModel
<
AppVo
>
records
=
applyService
.
getAppList
(
pageNo
,
pageSize
,
appName
);
String
userId
=
UserUtils
.
getLoginUserId
();
if
(
StringUtils
.
isEmpty
(
userId
))
{
throw
new
IotLicenseException
(
403
,
"请重新登录"
);
}
PageInfoModel
<
AppVo
>
records
=
applyService
.
getAppList
(
pageNo
,
pageSize
,
Integer
.
parseInt
(
userId
),
appName
);
int
total
=
records
.
getTotal
();
int
total
=
records
.
getTotal
();
int
pages
=
total
/
pageSize
;
//pages为总页数
int
pages
=
total
/
pageSize
;
//pages为总页数
int
mod
=
total
%
pageSize
;
int
mod
=
total
%
pageSize
;
...
...
license/src/main/java/iot/sixiang/license/mapper/ApplyMapper.java
View file @
a9761422
...
@@ -18,7 +18,7 @@ public interface ApplyMapper extends BaseMapper<Apply> {
...
@@ -18,7 +18,7 @@ public interface ApplyMapper extends BaseMapper<Apply> {
boolean
addApply
(
String
appId
,
String
appName
,
String
appKey
,
int
userId
);
boolean
addApply
(
String
appId
,
String
appName
,
String
appKey
,
int
userId
);
List
<
AppVo
>
getAppList
(
String
appName
);
List
<
AppVo
>
getAppList
(
Integer
userId
,
String
appName
);
Apply
getApplyByAppName
(
String
appName
);
Apply
getApplyByAppName
(
String
appName
);
}
}
license/src/main/java/iot/sixiang/license/service/ApplyService.java
View file @
a9761422
...
@@ -17,5 +17,5 @@ public interface ApplyService extends IService<Apply> {
...
@@ -17,5 +17,5 @@ public interface ApplyService extends IService<Apply> {
boolean
addApply
(
String
appName
,
String
appKey
,
int
userId
);
boolean
addApply
(
String
appName
,
String
appKey
,
int
userId
);
PageInfoModel
<
AppVo
>
getAppList
(
int
pageNo
,
int
pageSize
,
String
appName
);
PageInfoModel
<
AppVo
>
getAppList
(
int
pageNo
,
int
pageSize
,
Integer
userId
,
String
appName
);
}
}
license/src/main/java/iot/sixiang/license/service/impl/ApplyServiceImpl.java
View file @
a9761422
...
@@ -54,11 +54,11 @@ public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements
...
@@ -54,11 +54,11 @@ public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements
}
}
@Override
@Override
public
PageInfoModel
<
AppVo
>
getAppList
(
int
pageNo
,
int
pageSize
,
String
appName
)
{
public
PageInfoModel
<
AppVo
>
getAppList
(
int
pageNo
,
int
pageSize
,
Integer
userId
,
String
appName
)
{
if
(
pageNo
==
0
||
pageSize
==
0
)
{
if
(
pageNo
==
0
||
pageSize
==
0
)
{
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
throw
new
IotLicenseException
(
ResultCode
.
VALIDATE_FAILED
.
getCode
(),
ResultCode
.
VALIDATE_FAILED
.
getMsg
());
}
}
List
<
AppVo
>
records
=
applyMapper
.
getAppList
(
appName
);
List
<
AppVo
>
records
=
applyMapper
.
getAppList
(
userId
,
appName
);
records
=
records
.
stream
().
sorted
(
Comparator
.
comparing
(
AppVo:
:
getCreateTime
,
Comparator
.
reverseOrder
())).
collect
(
Collectors
.
toList
());
records
=
records
.
stream
().
sorted
(
Comparator
.
comparing
(
AppVo:
:
getCreateTime
,
Comparator
.
reverseOrder
())).
collect
(
Collectors
.
toList
());
List
<
AppVo
>
result
=
new
ArrayList
<>();
List
<
AppVo
>
result
=
new
ArrayList
<>();
int
begin
=
(
pageNo
-
1
)
*
pageSize
;
int
begin
=
(
pageNo
-
1
)
*
pageSize
;
...
...
license/src/main/resources/mapper/ApplyMapper.xml
View file @
a9761422
...
@@ -14,8 +14,11 @@
...
@@ -14,8 +14,11 @@
FROM apply AS app LEFT JOIN device AS de ON app.app_id = de.app_id
FROM apply AS app LEFT JOIN device AS de ON app.app_id = de.app_id
LEFT JOIN user AS us ON us.user_id = app.user_id
LEFT JOIN user AS us ON us.user_id = app.user_id
where 1=1
where 1=1
<if
test=
"null != _parameter and '' != _parameter"
>
<if
test=
"null != userId"
>
and app_name like concat('%',#{_parameter},'%')
and us.user_id = #{userId}
</if>
<if
test=
"null != appName and '' != appName"
>
and app_name like concat('%',#{appName},'%')
</if>
</if>
GROUP BY app.app_id
GROUP BY app.app_id
</select>
</select>
...
...
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