Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-tool
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
王通通
amos-tool
Commits
776b61b4
Commit
776b61b4
authored
Jun 25, 2023
by
Code-KingTT
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
阶段任务-后端-王通通
parent
32f0742a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
327 additions
and
3 deletions
+327
-3
Application.java
src/main/java/com/yeejoin/amos/Application.java
+2
-1
ViewController.java
.../com/yeejoin/amos/api/tool/controller/ViewController.java
+88
-0
ViewModel.java
.../java/com/yeejoin/amos/api/tool/face/model/ViewModel.java
+40
-0
ViewMapper.java
...va/com/yeejoin/amos/api/tool/face/orm/dao/ViewMapper.java
+32
-0
View.java
.../java/com/yeejoin/amos/api/tool/face/orm/entity/View.java
+75
-0
ViewService.java
...a/com/yeejoin/amos/api/tool/face/service/ViewService.java
+80
-0
application-dev.properties
src/main/resources/application-dev.properties
+3
-2
ViewMapper.xml
src/main/resources/mapper/ViewMapper.xml
+7
-0
No files found.
src/main/java/com/yeejoin/amos/Application.java
View file @
776b61b4
...
@@ -36,6 +36,7 @@ public class Application {
...
@@ -36,6 +36,7 @@ public class Application {
String
path
=
oConvertUtils
.
getString
(
env
.
getProperty
(
"server.servlet.context-path"
));
String
path
=
oConvertUtils
.
getString
(
env
.
getProperty
(
"server.servlet.context-path"
));
log
.
info
(
"\n----------------------------------------------------------\n\t"
log
.
info
(
"\n----------------------------------------------------------\n\t"
+
"Application AMOS-API-TOOL is running! Access URLs:\n\t"
+
"Swagger文档: \thttp://"
+
ip
+
":"
+
port
+
"Application AMOS-API-TOOL is running! Access URLs:\n\t"
+
"Swagger文档: \thttp://"
+
ip
+
":"
+
port
+
path
+
"/doc.html\n"
+
"----------------------------------------------------------"
);
+
path
+
"/doc.html\n"
+
"-----------------"
+
"-----------------------------------------"
);
}
}
}
}
src/main/java/com/yeejoin/amos/api/tool/controller/ViewController.java
0 → 100644
View file @
776b61b4
package
com
.
yeejoin
.
amos
.
api
.
tool
.
controller
;
import
com.yeejoin.amos.api.tool.face.model.ViewModel
;
import
com.yeejoin.amos.api.tool.face.service.ViewService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.doc.TycloudResource
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.annotation.Resource
;
import
java.util.List
;
@RestController
@TycloudResource
(
module
=
"iot"
,
value
=
"view"
)
@RequestMapping
(
value
=
"/v1/iot/View"
)
@Api
(
tags
=
"测试"
)
public
class
ViewController
{
private
final
Logger
logger
=
LogManager
.
getLogger
(
ViewController
.
class
);
@Resource
private
ViewService
viewService
;
@TycloudOperation
(
ApiLevel
=
UserType
.
SUPER_ADMIN
,
needAuth
=
false
)
@ApiOperation
(
value
=
"根据所属机构查询"
)
@GetMapping
(
"/list"
)
public
ResponseModel
selectForList
(
@RequestParam
(
value
=
"agency"
)
String
agency
)
{
return
ResponseHelper
.
buildResponse
(
viewService
.
queryForAViewList
(
agency
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
SUPER_ADMIN
,
needAuth
=
false
)
@PostMapping
(
"/save"
)
@ApiOperation
(
value
=
"新增"
,
notes
=
"新增"
)
public
ResponseModel
<
ViewModel
>
save
(
@RequestBody
ViewModel
viewModel
){
viewModel
=
viewService
.
createWithModel
(
viewModel
);
return
ResponseHelper
.
buildResponse
(
viewModel
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
SUPER_ADMIN
,
needAuth
=
false
)
@PostMapping
(
"/sences/list"
)
@ApiOperation
(
value
=
"根据场景查询"
)
public
ResponseModel
selectByScene
(
@RequestParam
(
value
=
"sences"
)
String
sences
){
return
ResponseHelper
.
buildResponse
(
viewService
.
queryByScene
(
sences
));
}
/**
* 根据字段查询
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
SUPER_ADMIN
,
needAuth
=
false
)
@PostMapping
(
"/select/all"
)
@ApiOperation
(
value
=
"查询大全"
)
public
ResponseModel
query
(
@RequestParam
(
value
=
"sences"
)
String
sences
,
@RequestParam
(
value
=
"miniSences"
)
String
miniSences
){
return
ResponseHelper
.
buildResponse
(
viewService
.
query
(
sences
,
miniSences
));
}
/**
* 查询所有
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
SUPER_ADMIN
,
needAuth
=
false
)
@PostMapping
(
"/every"
)
@ApiOperation
(
"平台"
)
public
ResponseModel
<
List
<
ViewModel
>>
queryEvery
(){
return
ResponseHelper
.
buildResponse
(
viewService
.
queryEvery
());
}
/**
* 根据ID删除
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
SUPER_ADMIN
,
needAuth
=
false
)
@PostMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除"
)
public
ResponseModel
<
Boolean
>
deleteById
(
@RequestParam
(
value
=
"SEQUENCE_NBR"
)
Long
SEQUENCE_NBR
){
return
ResponseHelper
.
buildResponse
(
viewService
.
deleteBySeq
(
SEQUENCE_NBR
));
}
/**
* 根据ID更新
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
SUPER_ADMIN
,
needAuth
=
false
)
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"更新"
)
public
ResponseModel
updateById
(
@RequestParam
(
value
=
"SEQUENCE_NBR"
)
Long
SEQUENCE_NBR
){
return
ResponseHelper
.
buildResponse
(
viewService
.
updateTimes
(
SEQUENCE_NBR
));
}
}
src/main/java/com/yeejoin/amos/api/tool/face/model/ViewModel.java
0 → 100644
View file @
776b61b4
package
com
.
yeejoin
.
amos
.
api
.
tool
.
face
.
model
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
org.typroject.tyboot.core.rdbms.model.BaseModel
;
import
java.sql.Timestamp
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
public
class
ViewModel
extends
BaseModel
{
/**
* 编号
*/
private
Long
sequenceNbr
;
/**
* 名称
*/
private
String
name
;
/**
* 场景
*/
private
String
sences
;
/**
* 所属机构
*/
private
String
agency
;
/**
* 查看次数
*/
private
Integer
times
;
/**
* URL
*/
private
String
url
;
/**
* 发布时间
*/
private
Timestamp
release
;
}
src/main/java/com/yeejoin/amos/api/tool/face/orm/dao/ViewMapper.java
0 → 100644
View file @
776b61b4
package
com
.
yeejoin
.
amos
.
api
.
tool
.
face
.
orm
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.api.tool.face.model.ViewModel
;
import
com.yeejoin.amos.api.tool.face.orm.entity.View
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
org.apache.ibatis.annotations.Update
;
import
java.util.List
;
public
interface
ViewMapper
extends
BaseMapper
<
View
>
{
/**
* 全部
*/
@Select
(
"select url,name,agency,times,releasetime from view order by ${miniSences} ${way}"
)
List
<
ViewModel
>
queryAll
(
@Param
(
"miniSences"
)
String
miniSences
,
@Param
(
"way"
)
String
way
);
/**
* 具体场景
*/
@Select
(
"select url,name,agency,times,releasetime from view where sences=#{sences} order by ${miniSences} ${way}"
)
List
<
ViewModel
>
queryBySences
(
@Param
(
"sences"
)
String
sences
,
@Param
(
"miniSences"
)
String
miniSences
,
@Param
(
"way"
)
String
way
);
@Select
(
"select SEQUENCE_NBR,name,sences,agency,times,url,releasetime from view"
)
List
<
ViewModel
>
queryEvery
();
/**
* 更新查看次数
*/
@Update
(
"update view set times = times+1 where SEQUENCE_NBR = #{SEQUENCE_NBR}"
)
boolean
update
(
Long
SEQUENCE_NBR
);
}
src/main/java/com/yeejoin/amos/api/tool/face/orm/entity/View.java
0 → 100644
View file @
776b61b4
package
com
.
yeejoin
.
amos
.
api
.
tool
.
face
.
orm
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity
;
import
java.util.Date
;
import
java.sql.Timestamp
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@TableName
(
"view"
)
public
class
View
extends
BaseEntity
{
@TableId
(
value
=
"SEQUENCE_NBR"
,
type
=
IdType
.
ID_WORKER
)
protected
Long
sequenceNbr
;
/**
* 继承的无关字段
*/
@TableField
(
value
=
"REC_DATE"
,
exist
=
false
,
select
=
false
)
protected
Date
recDate
;
@TableField
(
value
=
"REC_USER_ID"
,
exist
=
false
,
select
=
false
)
protected
String
recUserId
;
/**
* 编号
*/
// @TableId(type = IdType.ID_WORKER_STR)
// private String vid;
/**
* 名称
*/
@TableField
(
"NAME"
)
private
String
name
;
/**
* 场景
*/
@TableField
(
"SENCES"
)
private
String
sences
;
/**
* 所属机构
*/
@TableField
(
"AGENCY"
)
private
String
agency
;
/**
* 查看次数
*/
@TableField
(
"TIMES"
)
private
Integer
times
;
/**
* URL
*/
@TableField
(
"URL"
)
private
String
url
;
/**
* 发布时间
*/
@TableField
(
"RELEASE"
)
private
Timestamp
release
;
}
src/main/java/com/yeejoin/amos/api/tool/face/service/ViewService.java
0 → 100644
View file @
776b61b4
package
com
.
yeejoin
.
amos
.
api
.
tool
.
face
.
service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.api.tool.face.model.ViewModel
;
import
com.yeejoin.amos.api.tool.face.orm.dao.ViewMapper
;
import
com.yeejoin.amos.api.tool.face.orm.entity.View
;
import
org.apache.ibatis.annotations.Select
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
javax.annotation.Resource
;
import
java.util.List
;
@Component
public
class
ViewService
extends
BaseService
<
ViewModel
,
View
,
ViewMapper
>
{
@Resource
ViewMapper
viewMapper
;
/**
* 根据所属机构分页查询
*/
public
Page
<
ViewModel
>
queryForViewPageByAgency
(
Page
page
,
String
agency
)
{
return
this
.
queryForPage
(
page
,
null
,
false
,
agency
);
}
/**
* 查询所有
*/
public
List
<
ViewModel
>
queryEvery
(){
return
viewMapper
.
queryEvery
();
}
/**
* 根据所属机构列表查询
*/
public
List
<
ViewModel
>
queryForAViewList
(
String
agency
)
{
return
this
.
queryForList
(
""
,
false
,
agency
);
}
/**
* 根据场景分页查询
*/
public
Page
<
ViewModel
>
queryByScene
(
Page
page
,
String
sences
)
{
return
this
.
queryForPage
(
page
,
null
,
false
,
sences
);
}
/**
* 根据场景列表查询
*/
public
List
<
ViewModel
>
queryByScene
(
String
sences
)
{
return
this
.
queryForList
(
""
,
false
,
sences
);
}
/**
* 查看次数更新
*/
public
boolean
updateTimes
(
Long
SEQUENCE_NBR
){
return
viewMapper
.
update
(
SEQUENCE_NBR
);
}
/**
* 统一处理
*/
public
List
<
ViewModel
>
query
(
String
sences
,
String
miniSences
){
if
(
sences
.
equals
(
"全部"
)){
if
(
miniSences
.
equals
(
"综合排序"
)){
return
viewMapper
.
queryAll
(
"SEQUENCE_NBR"
,
"asc"
);
}
else
if
(
miniSences
.
equals
(
"最新发布"
)){
return
viewMapper
.
queryAll
(
"releasetime"
,
"desc"
);
}
else
return
viewMapper
.
queryAll
(
"times"
,
"desc"
);
}
else
{
if
(
miniSences
.
equals
(
"综合排序"
)){
return
viewMapper
.
queryBySences
(
sences
,
"SEQUENCE_NBR"
,
"asc"
);
}
else
if
(
miniSences
.
equals
(
"最新发布"
)){
return
viewMapper
.
queryBySences
(
sences
,
"releasetime"
,
"desc"
);
}
else
return
viewMapper
.
queryBySences
(
sences
,
"times"
,
"desc"
);
}
}
}
src/main/resources/application-dev.properties
View file @
776b61b4
# jdbc_config
# jdbc_config
spring.datasource.url
=
jdbc:mysql://172.16.3.18:3306/amos_studio?allowMultiQueries=true
#spring.datasource.url=jdbc:mysql://172.16.3.18:3306/amos_studio?allowMultiQueries=true
spring.datasource.url
=
jdbc:mysql://39.98.45.134:3306/amos_idx_biz?allowMultiQueries=true
spring.datasource.username
=
root
spring.datasource.username
=
root
spring.datasource.password
=
Yeejoin@2020
spring.datasource.password
=
Yeejoin@2020
spring.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
spring.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
...
@@ -21,7 +22,7 @@ spring.redis.password=yeejoin@2020
...
@@ -21,7 +22,7 @@ spring.redis.password=yeejoin@2020
spring.redis.timeout
=
0
spring.redis.timeout
=
0
#注册中心地址
#注册中心地址
eureka.client.service-url.defaultZone
=
http://
admin:a1234560@172.16.3.18
:10001/eureka/
eureka.client.service-url.defaultZone
=
http://
39.98.45.134
:10001/eureka/
eureka.instance.prefer-ip-address
=
true
eureka.instance.prefer-ip-address
=
true
management.endpoints.web.exposure.include
=
*
management.endpoints.web.exposure.include
=
*
eureka.instance.health-check-url
=
http://localhost:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.health-check-url
=
http://localhost:${server.port}${server.servlet.context-path}/actuator/health
...
...
src/main/resources/mapper/ViewMapper.xml
0 → 100644
View file @
776b61b4
<?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=
"com.yeejoin.amos.api.tool.face.orm.dao.ViewMapper"
>
<!-- <select id="queryAll" parameterType="com.yeejoin.amos.api.tool.face.orm.dao.ViewMapper">-->
<!-- select * from view;-->
<!-- </select>-->
</mapper>
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