Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
signal
traffic-signal-platform
Commits
116b8526
Commit
116b8526
authored
Nov 28, 2022
by
wuxiaokai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
路网管理-路口管理
parent
6377b813
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
1634 additions
and
2 deletions
+1634
-2
pom.xml
signal-web-service/pom.xml
+68
-2
MybatisPlusGenerator.java
...ice/src/main/java/net/wanji/web/MybatisPlusGenerator.java
+71
-0
WebApplication.java
...b-service/src/main/java/net/wanji/web/WebApplication.java
+38
-0
BaseInfoInterface.java
...src/main/java/net/wanji/web/common/BaseInfoInterface.java
+18
-0
Result.java
...eb-service/src/main/java/net/wanji/web/common/Result.java
+99
-0
ResultEnum.java
...ervice/src/main/java/net/wanji/web/common/ResultEnum.java
+41
-0
TBaseAreaInfoController.java
...ava/net/wanji/web/controller/TBaseAreaInfoController.java
+20
-0
TBaseCrossInfoController.java
...va/net/wanji/web/controller/TBaseCrossInfoController.java
+61
-0
TBaseAreaInfo.java
...ice/src/main/java/net/wanji/web/entity/TBaseAreaInfo.java
+84
-0
TBaseCrossInfo.java
...ce/src/main/java/net/wanji/web/entity/TBaseCrossInfo.java
+97
-0
CrossException.java
...src/main/java/net/wanji/web/exception/CrossException.java
+61
-0
GlobalExceptionHandler.java
...in/java/net/wanji/web/handler/GlobalExceptionHandler.java
+71
-0
TBaseAreaInfoMapper.java
...c/main/java/net/wanji/web/mapper/TBaseAreaInfoMapper.java
+32
-0
TBaseCrossInfoMapper.java
.../main/java/net/wanji/web/mapper/TBaseCrossInfoMapper.java
+38
-0
CrossInfoPO.java
...b-service/src/main/java/net/wanji/web/po/CrossInfoPO.java
+77
-0
PageResultPO.java
...-service/src/main/java/net/wanji/web/po/PageResultPO.java
+28
-0
TBaseAreaInfoService.java
...main/java/net/wanji/web/service/TBaseAreaInfoService.java
+20
-0
TBaseCrossInfoService.java
...ain/java/net/wanji/web/service/TBaseCrossInfoService.java
+112
-0
BaseCrossInfoVO.java
...rvice/src/main/java/net/wanji/web/vo/BaseCrossInfoVO.java
+97
-0
CrossInfoVO.java
...b-service/src/main/java/net/wanji/web/vo/CrossInfoVO.java
+66
-0
application.yml
signal-web-service/src/main/resources/application.yml
+50
-0
TBaseAreaInfoMapper.xml
...service/src/main/resources/mapper/TBaseAreaInfoMapper.xml
+159
-0
TBaseCrossInfoMapper.xml
...ervice/src/main/resources/mapper/TBaseCrossInfoMapper.xml
+226
-0
No files found.
signal-web-service/pom.xml
View file @
116b8526
...
@@ -5,9 +5,13 @@
...
@@ -5,9 +5,13 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
net.wanji
</groupId>
<groupId>
net.wanji
</groupId>
<artifactId>
signal-web-service
</artifactId>
<artifactId>
traffic-signal-platform
</artifactId>
<version>
0.2.1
</version>
<version>
0.2.1
</version>
</parent>
<artifactId>
signal-web-service
</artifactId>
<name>
signal-web-service
</name>
<name>
signal-web-service
</name>
...
@@ -15,4 +19,66 @@
...
@@ -15,4 +19,66 @@
signal-web-service
signal-web-service
</description>
</description>
<properties>
<java.version>
1.8
</java.version>
<mybatis-plus-version>
3.5.1
</mybatis-plus-version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<!-- MP相关 start -->
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
${mybatis-plus-version}
</version>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-generator
</artifactId>
<version>
${mybatis-plus-version}
</version>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
dynamic-datasource-spring-boot-starter
</artifactId>
<version>
${mybatis-plus-version}
</version>
</dependency>
<!-- MP相关 end -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-freemarker
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid-spring-boot-starter
</artifactId>
<version>
1.1.24
</version>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
8.0.24
</version>
</dependency>
<!-- Swagger -->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
<dependency>
<groupId>
org.hibernate
</groupId>
<artifactId>
hibernate-validator
</artifactId>
<version>
6.0.1.Final
</version>
</dependency>
</dependencies>
</project>
</project>
\ No newline at end of file
signal-web-service/src/main/java/net/wanji/web/MybatisPlusGenerator.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
;
import
com.baomidou.mybatisplus.generator.FastAutoGenerator
;
import
com.baomidou.mybatisplus.generator.config.OutputFile
;
import
com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine
;
import
java.util.Collections
;
/**
* @author wuxiaokai
* @date 2022/4/14 10:50:34
*/
public
class
MybatisPlusGenerator
{
private
static
final
String
PROJECT_PATH
=
System
.
getProperty
(
"user.dir"
);
private
static
final
String
OUTPUT_DIR
=
"signal-web-service/src/main/java"
;
private
static
final
String
AUTHOR
=
"wj"
;
private
static
final
String
URL
=
"jdbc:mysql://10.100.1.74:3306/t_signal_control?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true"
;
private
static
final
String
DRIVER_NAME
=
"com.mysql.cj.jdbc.Driver"
;
private
static
final
String
USERNAME
=
"root"
;
private
static
final
String
PASSWORD
=
"Wanji300552"
;
private
static
final
String
[]
TABLES
=
{
"t_base_area_info"
,
"t_base_cross_info"
};
private
static
final
String
TEMPLATE_PATH
=
"/templates/mapper.xml.ftl"
;
private
static
final
String
MAPPER_PATH
=
"signal-web-service/src/main/resources/mapper/"
;
private
static
final
String
PARENT
=
"net.wanji.web"
;
public
static
void
main
(
String
[]
args
)
{
FastAutoGenerator
.
create
(
URL
,
USERNAME
,
PASSWORD
)
.
globalConfig
(
builder
->
{
builder
.
author
(
AUTHOR
)
// 设置作者
// .enableSwagger() // 开启 swagger 模式
.
fileOverride
()
// 覆盖已生成文件
.
outputDir
(
OUTPUT_DIR
)
// 指定输出目录
.
disableOpenDir
();
//禁止打开输出目录
})
.
packageConfig
(
builder
->
{
builder
.
parent
(
PARENT
)
// 设置父包名
//.moduleName(null) // 设置父包模块名
.
pathInfo
(
Collections
.
singletonMap
(
OutputFile
.
mapperXml
,
MAPPER_PATH
));
// 设置mapperXml生成路径
})
.
strategyConfig
(
builder
->
{
builder
.
addInclude
(
TABLES
)
// 设置需要生成的表名
//.addTablePrefix(null) // 设置过滤表前缀
//Service 策略配置
.
serviceBuilder
()
.
formatServiceFileName
(
"%sService"
)
//格式化 service 接口文件名称
.
formatServiceImplFileName
(
"%sServiceImpl"
)
//格式化 service 实现类文件名称
//Entity 策略配置
.
entityBuilder
()
.
enableChainModel
()
//开启链式模型
.
enableLombok
()
//开启Lombok模型
.
enableTableFieldAnnotation
()
//开启生成实体时生成字段注解
//.logicDeleteColumnName("deleted")//默认删除属性名称(数据库)
//.logicDeletePropertyName("deleted")//默认删除属性名称(实体)
//.versionColumnName("version")//乐观锁属性名(数据库)
//.versionPropertyName("version")//乐观锁属性名(实体)
//.addTableFills(new Column("create_Time", FieldFill.INSERT))//添加表字段填充(自动填充)
//.addTableFills(new Column("update_Time", FieldFill.INSERT_UPDATE))//添加表字段填充(自动填充)
//controller 策略配置
.
controllerBuilder
()
.
enableRestStyle
();
//开启生成@RestController 控制器
})
.
templateEngine
(
new
FreemarkerTemplateEngine
())
// 使用Freemarker引擎模板,默认的是Velocity引擎模板
.
execute
();
}
}
signal-web-service/src/main/java/net/wanji/web/WebApplication.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
;
import
org.hibernate.validator.HibernateValidator
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.Bean
;
import
javax.validation.Validation
;
import
javax.validation.Validator
;
import
javax.validation.ValidatorFactory
;
/**
* @author wj
* @date 2022/11/28 9:31:34
*/
@MapperScan
(
"net.wanji.web.mapper"
)
@SpringBootApplication
public
class
WebApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
WebApplication
.
class
,
args
);
}
/**
* Spring Validation默认会校验完所有字段,然后才抛出异常。可以通过一些简单的配置,开启Fail Fast模式,一旦校验失败就立即返回。
*/
@Bean
public
Validator
validator
()
{
ValidatorFactory
validatorFactory
=
Validation
.
byProvider
(
HibernateValidator
.
class
)
.
configure
()
// 快速失败模式
.
failFast
(
true
)
.
buildValidatorFactory
();
return
validatorFactory
.
getValidator
();
}
}
signal-web-service/src/main/java/net/wanji/web/common/BaseInfoInterface.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
common
;
/**
* @author wuxiaokai
* @date 2022/11/15 13:15:57
*/
public
interface
BaseInfoInterface
{
/**
* 错误码
*/
Integer
getResultCode
();
/**
* 错误描述
*/
String
getResultMsg
();
}
signal-web-service/src/main/java/net/wanji/web/common/Result.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
common
;
import
java.io.Serializable
;
import
static
net
.
wanji
.
web
.
common
.
ResultEnum
.
INTERNAL_SERVER_ERROR
;
import
static
net
.
wanji
.
web
.
common
.
ResultEnum
.
SUCCESS
;
/**
* @author wuxiaokai
* @date 2022/11/15 13:13:36
*/
public
class
Result
<
T
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
8491397399858539755L
;
private
Integer
state
;
private
String
message
;
private
T
content
;
public
Integer
getState
()
{
return
state
;
}
public
void
setState
(
Integer
state
)
{
this
.
state
=
state
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
T
getContent
()
{
return
content
;
}
public
void
setContent
(
T
content
)
{
this
.
content
=
content
;
}
public
Result
()
{
}
public
Result
(
Integer
state
,
String
message
,
T
content
)
{
this
.
state
=
state
;
this
.
message
=
message
;
this
.
content
=
content
;
}
public
static
<
T
>
Result
<
T
>
response
(
Integer
state
,
String
message
)
{
return
response
(
state
,
message
,
null
);
}
public
static
<
T
>
Result
<
T
>
response
(
Integer
state
,
String
message
,
T
content
)
{
return
new
Result
<>(
state
,
message
,
content
);
}
public
static
<
T
>
Result
<
T
>
success
()
{
return
Result
.
response
(
SUCCESS
.
getResultCode
(),
SUCCESS
.
getResultMsg
(),
null
);
}
public
static
<
T
>
Result
<
T
>
success
(
String
message
)
{
return
Result
.
response
(
SUCCESS
.
getResultCode
(),
message
,
null
);
}
public
static
<
T
>
Result
<
T
>
success
(
T
content
)
{
return
Result
.
response
(
SUCCESS
.
getResultCode
(),
SUCCESS
.
getResultMsg
(),
content
);
}
public
static
<
T
>
Result
<
T
>
error
(
Integer
state
,
String
message
,
T
content
)
{
return
Result
.
response
(
state
,
message
,
content
);
}
public
static
<
T
>
Result
<
T
>
error
(
Integer
state
,
String
message
)
{
return
Result
.
response
(
state
,
message
,
null
);
}
public
static
<
T
>
Result
<
T
>
error
(
Integer
state
)
{
return
Result
.
response
(
state
,
INTERNAL_SERVER_ERROR
.
getResultMsg
(),
null
);
}
public
static
<
T
>
Result
<
T
>
error
()
{
return
error
(
INTERNAL_SERVER_ERROR
);
}
public
static
<
T
>
Result
<
T
>
error
(
ResultEnum
resultEnum
,
String
message
)
{
return
Result
.
response
(
resultEnum
.
getResultCode
(),
message
,
null
);
}
public
static
<
T
>
Result
<
T
>
error
(
ResultEnum
resultEnum
)
{
return
Result
.
response
(
resultEnum
.
getResultCode
(),
resultEnum
.
getResultMsg
(),
null
);
}
public
static
<
T
>
Result
<
T
>
error
(
String
message
)
{
return
Result
.
response
(
INTERNAL_SERVER_ERROR
.
getResultCode
(),
message
,
null
);
}
}
signal-web-service/src/main/java/net/wanji/web/common/ResultEnum.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
common
;
/**
* @author wuxiaokai
* @date 2022/11/15 13:15:30
*/
public
enum
ResultEnum
implements
BaseInfoInterface
{
// 数据操作错误定义
SUCCESS
(
200
,
"成功!"
),
BODY_NOT_MATCH
(
400
,
"请求的数据格式不符!"
),
SIGNATURE_NOT_MATCH
(
401
,
"请求的数字签名不匹配!"
),
NOT_FOUND
(
404
,
"未找到该资源!"
),
PARAM_VERIFY_FAILS
(
405
,
"未找到该资源!"
),
INTERNAL_SERVER_ERROR
(
500
,
"服务器内部错误!"
),
SERVER_BUSY
(
503
,
"服务器正忙,请稍后再试!"
);
/**
* 错误码
*/
private
Integer
resultCode
;
/**
* 错误描述
*/
private
String
resultMsg
;
ResultEnum
(
Integer
resultCode
,
String
resultMsg
)
{
this
.
resultCode
=
resultCode
;
this
.
resultMsg
=
resultMsg
;
}
@Override
public
Integer
getResultCode
()
{
return
resultCode
;
}
@Override
public
String
getResultMsg
()
{
return
resultMsg
;
}
}
signal-web-service/src/main/java/net/wanji/web/controller/TBaseAreaInfoController.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* <p>
* 区域基础表 前端控制器
* </p>
*
* @author wj
* @since 2022-11-28
*/
@RestController
@RequestMapping
(
"/t-base-area-info"
)
public
class
TBaseAreaInfoController
{
}
signal-web-service/src/main/java/net/wanji/web/controller/TBaseCrossInfoController.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
controller
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
net.wanji.web.common.Result
;
import
net.wanji.web.po.CrossInfoPO
;
import
net.wanji.web.po.PageResultPO
;
import
net.wanji.web.service.TBaseCrossInfoService
;
import
net.wanji.web.vo.BaseCrossInfoVO
;
import
net.wanji.web.vo.CrossInfoVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* <p>
* 路口基础表 前端控制器
* </p>
*
* @author wj
* @since 2022-11-28
*/
@Api
(
value
=
"路网管理-路口管理"
,
description
=
"路网管理-路口管理"
,
tags
=
"路网管理-路口管理"
)
@RestController
@RequestMapping
(
"/crossInfo"
)
public
class
TBaseCrossInfoController
{
@Autowired
private
TBaseCrossInfoService
crossInfoService
;
@ApiOperation
(
value
=
"路网管理-路口管理-查询"
,
notes
=
"路网管理-路口管理-查询"
)
@PostMapping
(
"/list"
)
public
Result
<
PageResultPO
<
CrossInfoPO
>>
list
(
@RequestBody
CrossInfoVO
crossInfoVO
)
{
return
crossInfoService
.
selectAll
(
crossInfoVO
);
}
@ApiOperation
(
value
=
"路网管理-路口管理-修改"
,
notes
=
"路网管理-路口管理-修改"
)
@PostMapping
(
"/updateOne"
)
public
Result
<
String
>
updateOne
(
@RequestBody
@Validated
BaseCrossInfoVO
crossInfoPO
)
{
return
crossInfoService
.
updateOne
(
crossInfoPO
);
}
@ApiOperation
(
value
=
"路网管理-路口管理-批量删除"
,
notes
=
"路网管理-路口管理-批量删除"
)
@PostMapping
(
"/delete"
)
public
Result
<
String
>
delete
(
@RequestBody
List
<
String
>
ids
)
{
return
crossInfoService
.
delete
(
ids
);
}
@ApiOperation
(
value
=
"路网管理-路口管理-增加"
,
notes
=
"路网管理-路口管理-增加"
)
@PostMapping
(
"/addOne"
)
public
Result
<
String
>
addOne
(
@RequestBody
@Validated
BaseCrossInfoVO
crossInfoPO
)
{
return
crossInfoService
.
addOne
(
crossInfoPO
);
}
}
signal-web-service/src/main/java/net/wanji/web/entity/TBaseAreaInfo.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* <p>
* 区域基础表
* </p>
*
* @author wj
* @since 2022-11-28
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"t_base_area_info"
)
public
class
TBaseAreaInfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键
*/
@TableId
(
"id"
)
private
Integer
id
;
/**
* 行政区划代码
*/
@TableField
(
"code"
)
private
Integer
code
;
/**
* 行政区划名称
*/
@TableField
(
"name"
)
private
String
name
;
/**
* 区划类型:1行政区划;2交警辖区;3商圈;4交通小区;5热点区域
*/
@TableField
(
"type"
)
private
Integer
type
;
/**
* 父节点
*/
@TableField
(
"parent"
)
private
Integer
parent
;
/**
* 区域中心点
*/
@TableField
(
"location"
)
private
String
location
;
/**
* 区域边界
*/
@TableField
(
"polylines"
)
private
String
polylines
;
/**
* 创建时间
*/
@TableField
(
"gmt_create"
)
private
Date
gmtCreate
;
/**
* 修改时间
*/
@TableField
(
"gmt_modified"
)
private
Date
gmtModified
;
}
signal-web-service/src/main/java/net/wanji/web/entity/TBaseCrossInfo.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.experimental.Accessors
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* <p>
* 路口基础表
* </p>
*
* @author wj
* @since 2022-11-28
*/
@Getter
@Setter
@Accessors
(
chain
=
true
)
@TableName
(
"t_base_cross_info"
)
public
class
TBaseCrossInfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 路口ID
*/
@TableId
(
"id"
)
private
String
id
;
/**
* 路口名称
*/
@TableField
(
"name"
)
private
String
name
;
/**
* 路口类型
*/
@TableField
(
"type"
)
private
Integer
type
;
/**
* 路口级别
*/
@TableField
(
"level"
)
private
Integer
level
;
/**
* 行政区划代码
*/
@TableField
(
"area_code"
)
private
Integer
areaCode
;
/**
* 路口位置
*/
@TableField
(
"location"
)
private
String
location
;
/**
* 是否信控路口:1是;0否
*/
@TableField
(
"is_signal"
)
private
Integer
isSignal
;
/**
* 是否启动优化:1是;0否
*/
@TableField
(
"is_start"
)
private
Integer
isStart
;
/**
* 是否下发方案:1是;0否
*/
@TableField
(
"is_send"
)
private
Integer
isSend
;
/**
* 创建时间
*/
@TableField
(
"gmt_create"
)
private
Date
gmtCreate
;
/**
* 修改时间
*/
@TableField
(
"gmt_modified"
)
private
Date
gmtModified
;
}
signal-web-service/src/main/java/net/wanji/web/exception/CrossException.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
exception
;
import
lombok.Getter
;
import
lombok.Setter
;
import
net.wanji.web.common.BaseInfoInterface
;
import
static
net
.
wanji
.
web
.
common
.
ResultEnum
.
INTERNAL_SERVER_ERROR
;
/**
* @author wuxiaokai
* @date 2022/11/21 9:38:54
*/
@Setter
@Getter
public
class
CrossException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
9081671784110014059L
;
/**
* 错误码
*/
protected
Integer
errorCode
;
/**
* 错误信息
*/
protected
String
errorMsg
;
public
CrossException
()
{
this
(
INTERNAL_SERVER_ERROR
.
getResultCode
(),
INTERNAL_SERVER_ERROR
.
getResultMsg
());
}
public
CrossException
(
BaseInfoInterface
errorInfoInterface
)
{
super
(
errorInfoInterface
.
getResultMsg
());
this
.
errorCode
=
errorInfoInterface
.
getResultCode
();
this
.
errorMsg
=
errorInfoInterface
.
getResultMsg
();
}
public
CrossException
(
BaseInfoInterface
errorInfoInterface
,
Throwable
cause
)
{
super
(
errorInfoInterface
.
getResultMsg
(),
cause
);
this
.
errorCode
=
errorInfoInterface
.
getResultCode
();
this
.
errorMsg
=
errorInfoInterface
.
getResultMsg
();
}
public
CrossException
(
String
errorMsg
)
{
this
(
INTERNAL_SERVER_ERROR
.
getResultCode
(),
errorMsg
);
}
public
CrossException
(
Integer
errorCode
,
String
errorMsg
)
{
this
(
errorCode
,
errorMsg
,
null
);
}
public
CrossException
(
Integer
errorCode
,
String
errorMsg
,
Throwable
cause
)
{
super
(
errorMsg
,
cause
);
this
.
errorCode
=
errorCode
;
this
.
errorMsg
=
errorMsg
;
}
@Override
public
Throwable
fillInStackTrace
()
{
return
this
;
}
}
signal-web-service/src/main/java/net/wanji/web/handler/GlobalExceptionHandler.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
handler
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.web.common.Result
;
import
net.wanji.web.exception.CrossException
;
import
org.springframework.validation.FieldError
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
javax.servlet.http.HttpServletRequest
;
import
static
net
.
wanji
.
web
.
common
.
ResultEnum
.
INTERNAL_SERVER_ERROR
;
/**
* @author wuxiaokai
* @date 2022/11/21 9:06:40
*/
@RestControllerAdvice
@Slf4j
public
class
GlobalExceptionHandler
{
/**
* 处理自定义的业务异常
*/
@ExceptionHandler
(
value
=
CrossException
.
class
)
public
Result
<
String
>
exceptionHandler
(
HttpServletRequest
req
,
CrossException
e
)
{
log
.
error
(
"发生业务异常!原因是:{}"
,
e
.
getErrorMsg
());
return
Result
.
error
(
e
.
getErrorCode
(),
e
.
getErrorMsg
());
}
/**
* 处理空指针的异常
*/
@ExceptionHandler
(
value
=
NullPointerException
.
class
)
public
Result
<
String
>
exceptionHandler
(
HttpServletRequest
req
,
NullPointerException
e
)
{
String
errorMessage
=
e
.
getCause
().
getMessage
();
log
.
error
(
"发生空指针异常!原因是:{}"
,
errorMessage
);
return
Result
.
error
(
INTERNAL_SERVER_ERROR
.
getResultCode
(),
"发生空指针异常!原因是:"
+
errorMessage
);
}
/**
* 参数异常
*/
@ExceptionHandler
(
value
=
MethodArgumentNotValidException
.
class
)
public
Result
<
String
>
exceptionHandler
(
HttpServletRequest
req
,
MethodArgumentNotValidException
e
)
{
FieldError
fieldError
=
e
.
getBindingResult
().
getFieldError
();
String
errorMessage
=
INTERNAL_SERVER_ERROR
.
getResultMsg
();
if
(
fieldError
!=
null
)
{
errorMessage
=
fieldError
.
getDefaultMessage
();
}
log
.
error
(
"发生参数异常!原因是:{}"
,
errorMessage
);
return
Result
.
error
(
INTERNAL_SERVER_ERROR
.
getResultCode
(),
"发生参数异常!原因是:"
+
errorMessage
);
}
/**
* 处理其他异常
*/
@ExceptionHandler
(
value
=
Exception
.
class
)
public
Result
<
String
>
exceptionHandler
(
HttpServletRequest
req
,
Exception
e
)
{
Throwable
cause
=
e
.
getCause
();
String
errorMessage
;
if
(
cause
!=
null
)
{
errorMessage
=
cause
.
getMessage
();
}
else
{
errorMessage
=
e
.
getMessage
();
}
log
.
error
(
"未知异常!原因是:{}"
,
errorMessage
);
return
Result
.
error
(
INTERNAL_SERVER_ERROR
.
getResultCode
(),
"未知异常!原因是:"
+
errorMessage
);
}
}
signal-web-service/src/main/java/net/wanji/web/mapper/TBaseAreaInfoMapper.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
mapper
;
import
net.wanji.web.entity.TBaseAreaInfo
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.springframework.stereotype.Repository
;
/**
* <p>
* 区域基础表 Mapper 接口
* </p>
*
* @author wj
* @since 2022-11-28
*/
@Repository
public
interface
TBaseAreaInfoMapper
extends
BaseMapper
<
TBaseAreaInfo
>
{
int
deleteByPrimaryKey
(
Integer
id
);
@Override
int
insert
(
TBaseAreaInfo
record
);
int
insertSelective
(
TBaseAreaInfo
record
);
TBaseAreaInfo
selectByPrimaryKey
(
Integer
id
);
int
updateByPrimaryKeySelective
(
TBaseAreaInfo
record
);
int
updateByPrimaryKeyWithBLOBs
(
TBaseAreaInfo
record
);
int
updateByPrimaryKey
(
TBaseAreaInfo
record
);
}
signal-web-service/src/main/java/net/wanji/web/mapper/TBaseCrossInfoMapper.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
mapper
;
import
net.wanji.web.entity.TBaseCrossInfo
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
net.wanji.web.po.CrossInfoPO
;
import
net.wanji.web.vo.CrossInfoVO
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* <p>
* 路口基础表 Mapper 接口
* </p>
*
* @author wj
* @since 2022-11-28
*/
@Repository
public
interface
TBaseCrossInfoMapper
extends
BaseMapper
<
TBaseCrossInfo
>
{
int
deleteByPrimaryKey
(
String
id
);
@Override
int
insert
(
TBaseCrossInfo
record
);
int
insertSelective
(
TBaseCrossInfo
record
);
TBaseCrossInfo
selectByPrimaryKey
(
String
id
);
int
updateByPrimaryKeySelective
(
TBaseCrossInfo
record
);
int
updateByPrimaryKey
(
TBaseCrossInfo
record
);
List
<
CrossInfoPO
>
selectAll
(
CrossInfoVO
crossInfoVO
);
Integer
countSelectAll
(
CrossInfoVO
crossInfoVO
);
}
signal-web-service/src/main/java/net/wanji/web/po/CrossInfoPO.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
po
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.Date
;
/**
* @author wuxiaokai
* @date 2022/11/28 9:42:39
*/
@Getter
@Setter
public
class
CrossInfoPO
{
/**
* 路口ID
*/
private
String
id
;
/**
* 路口名称
*/
private
String
name
;
/**
* 路口类型
*/
private
Integer
type
;
/**
* 路口级别
*/
private
Integer
level
;
/**
* 行政区划代码
*/
private
Integer
areaCode
;
/**
* 行政区划名称
*/
private
String
areaName
;
/**
* 路口位置
*/
private
String
location
;
/**
* 是否信控路口:1是;0否
*/
private
Integer
isSignal
;
/**
* 是否启动优化:1是;0否
*/
private
Integer
isStart
;
/**
* 是否下发方案:1是;0否
*/
private
Integer
isSend
;
/**
* 创建时间
*/
private
Date
gmtCreate
;
/**
* 修改时间
*/
private
Date
gmtModified
;
}
signal-web-service/src/main/java/net/wanji/web/po/PageResultPO.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
po
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author wj
* @date 2022/11/28 9:52:21
*/
@Data
@ApiModel
(
value
=
"PageResultVO"
,
description
=
"分页返回结果"
)
public
class
PageResultPO
<
T
>
{
@ApiModelProperty
(
value
=
"当前页"
)
private
Integer
pageNum
;
@ApiModelProperty
(
value
=
"每页的数量"
)
private
Integer
pageSize
;
@ApiModelProperty
(
value
=
"总数"
,
required
=
false
)
private
Integer
total
;
@ApiModelProperty
(
value
=
"数据"
,
required
=
false
)
private
List
<
T
>
data
;
}
signal-web-service/src/main/java/net/wanji/web/service/TBaseAreaInfoService.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
net.wanji.web.entity.TBaseAreaInfo
;
import
net.wanji.web.mapper.TBaseAreaInfoMapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.stereotype.Service
;
/**
* <p>
* 区域基础表 服务实现类
* </p>
*
* @author wj
* @since 2022-11-28
*/
@Service
public
class
TBaseAreaInfoService
extends
ServiceImpl
<
TBaseAreaInfoMapper
,
TBaseAreaInfo
>
implements
IService
<
TBaseAreaInfo
>
{
}
signal-web-service/src/main/java/net/wanji/web/service/TBaseCrossInfoService.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
service
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
net.wanji.web.common.Result
;
import
net.wanji.web.entity.TBaseAreaInfo
;
import
net.wanji.web.entity.TBaseCrossInfo
;
import
net.wanji.web.mapper.TBaseAreaInfoMapper
;
import
net.wanji.web.mapper.TBaseCrossInfoMapper
;
import
net.wanji.web.po.CrossInfoPO
;
import
net.wanji.web.po.PageResultPO
;
import
net.wanji.web.vo.BaseCrossInfoVO
;
import
net.wanji.web.vo.CrossInfoVO
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
/**
* <p>
* 路口基础表 服务实现类
* </p>
*
* @author wj
* @since 2022-11-28
*/
@Service
public
class
TBaseCrossInfoService
extends
ServiceImpl
<
TBaseCrossInfoMapper
,
TBaseCrossInfo
>
implements
IService
<
TBaseCrossInfo
>
{
@Autowired
private
TBaseCrossInfoMapper
crossInfoMapper
;
@Autowired
private
TBaseAreaInfoMapper
areaInfoMapper
;
/**
* 查询
*
* @param crossInfoVO 查询路口管理输入参数
* @return {@link Result}<{@link PageResultPO}<{@link CrossInfoPO}>>
*/
public
Result
<
PageResultPO
<
CrossInfoPO
>>
selectAll
(
CrossInfoVO
crossInfoVO
)
{
PageResultPO
<
CrossInfoPO
>
pageResult
=
new
PageResultPO
<>();
Integer
count
=
crossInfoMapper
.
countSelectAll
(
crossInfoVO
);
List
<
CrossInfoPO
>
list
=
crossInfoMapper
.
selectAll
(
crossInfoVO
);
pageResult
.
setPageNum
(
crossInfoVO
.
getPageNum
());
pageResult
.
setPageSize
(
crossInfoVO
.
getPageSize
());
pageResult
.
setTotal
(
count
);
pageResult
.
setData
(
list
);
return
Result
.
success
(
pageResult
);
}
/**
* 添加
*
* @param crossInfoPO 增加路口管理输入参数
* @return {@link Result}<{@link String}>
*/
public
Result
<
String
>
addOne
(
BaseCrossInfoVO
crossInfoPO
)
{
TBaseCrossInfo
record
=
getBaseCrossInfo
(
crossInfoPO
);
record
.
setGmtCreate
(
new
Date
());
int
insert
=
crossInfoMapper
.
insertSelective
(
record
);
if
(
insert
>
0
)
{
return
Result
.
success
(
"添加成功"
);
}
return
Result
.
error
(
"添加失败"
);
}
/**
* 更新
*
* @param crossInfoPO 修改路口管理输入参数
* @return {@link Result}<{@link String}>
*/
public
Result
<
String
>
updateOne
(
BaseCrossInfoVO
crossInfoPO
)
{
TBaseCrossInfo
record
=
getBaseCrossInfo
(
crossInfoPO
);
int
update
=
crossInfoMapper
.
updateByPrimaryKeySelective
(
record
);
if
(
update
>
0
)
{
return
Result
.
success
(
"修改成功"
);
}
return
Result
.
error
(
"修改失败"
);
}
private
TBaseCrossInfo
getBaseCrossInfo
(
BaseCrossInfoVO
crossInfoPO
)
{
QueryWrapper
<
TBaseAreaInfo
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
like
(
"name"
,
crossInfoPO
.
getAreaName
());
// 查询areaCode
List
<
TBaseAreaInfo
>
tBaseAreaInfos
=
areaInfoMapper
.
selectList
(
queryWrapper
);
if
(
tBaseAreaInfos
!=
null
&&
tBaseAreaInfos
.
size
()
>
0
)
{
crossInfoPO
.
setAreaCode
(
tBaseAreaInfos
.
get
(
0
).
getCode
());
}
TBaseCrossInfo
record
=
new
TBaseCrossInfo
();
BeanUtils
.
copyProperties
(
crossInfoPO
,
record
);
record
.
setGmtModified
(
new
Date
());
return
record
;
}
/**
* 删除
*
* @param ids id集合
* @return {@link Result}<{@link String}>
*/
public
Result
<
String
>
delete
(
List
<
String
>
ids
)
{
crossInfoMapper
.
deleteBatchIds
(
ids
);
return
Result
.
success
(
"删除成功"
);
}
}
signal-web-service/src/main/java/net/wanji/web/vo/BaseCrossInfoVO.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.Max
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
/**
* <p>
* 路口基础表
* </p>
*
* @author wj
* @since 2022-11-28
*/
@Data
@ApiModel
(
value
=
"BaseCrossInfoVO"
,
description
=
"增加和修改路口管理输入参数"
)
public
class
BaseCrossInfoVO
{
/**
* 路口ID
*/
@ApiModelProperty
(
value
=
"路口ID"
,
required
=
true
)
@NotNull
(
message
=
"路口ID不可为空"
)
private
String
id
;
/**
* 路口名称
*/
@ApiModelProperty
(
value
=
"路口名称"
,
required
=
true
)
@NotNull
(
message
=
"路口名称不可为空"
)
private
String
name
;
/**
* 路口类型
*/
@ApiModelProperty
(
value
=
"路口类型"
,
required
=
true
)
@NotNull
(
message
=
"路口类型不可为空"
)
private
Integer
type
;
/**
* 路口级别
*/
@ApiModelProperty
(
value
=
"路口级别"
,
required
=
true
)
@NotNull
(
message
=
"路口级别不可为空"
)
private
Integer
level
;
/**
* 行政区划代码
*/
@ApiModelProperty
(
value
=
"行政区划代码"
)
private
Integer
areaCode
;
/**
* 行政区划名称
*/
@ApiModelProperty
(
value
=
"行政区划名称"
,
required
=
true
)
@NotNull
(
message
=
"行政区划名称不可为空"
)
private
Integer
areaName
;
/**
* 路口位置
*/
@ApiModelProperty
(
value
=
"路口位置"
,
required
=
true
)
@NotNull
(
message
=
"路口位置不可为空"
)
private
String
location
;
/**
* 是否信控路口:1是;0否
*/
@ApiModelProperty
(
value
=
"是否信控路口:1是;0否"
,
required
=
true
)
@NotNull
(
message
=
"是否信控路口不可为空"
)
@Max
(
value
=
1
,
message
=
"是否信控路口:1是;0否"
)
@Min
(
value
=
0
,
message
=
"是否信控路口:1是;0否"
)
private
Integer
isSignal
;
/**
* 是否启动优化:1是;0否
*/
@ApiModelProperty
(
value
=
"是否启动优化:1是;0否"
,
required
=
true
)
@NotNull
(
message
=
"是否启动优化不可为空"
)
@Max
(
value
=
1
,
message
=
"是否启动优化:1是;0否"
)
@Min
(
value
=
0
,
message
=
"是否启动优化:1是;0否"
)
private
Integer
isStart
;
/**
* 是否下发方案:1是;0否
*/
@ApiModelProperty
(
value
=
"是否下发方案:1是;0否"
,
required
=
true
)
@NotNull
(
message
=
"是否下发方案不可为空"
)
@Max
(
value
=
1
,
message
=
"是否下发方案:1是;0否"
)
@Min
(
value
=
0
,
message
=
"是否下发方案:1是;0否"
)
private
Integer
isSend
;
}
signal-web-service/src/main/java/net/wanji/web/vo/CrossInfoVO.java
0 → 100644
View file @
116b8526
package
net
.
wanji
.
web
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.Max
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
/**
* @author wj
* @date 2022/11/28 9:42:39
*/
@Data
@ApiModel
(
value
=
"CrossInfoVO"
,
description
=
"查询路口管理输入参数"
)
public
class
CrossInfoVO
{
/**
* 路口名称
*/
@ApiModelProperty
(
value
=
"路口名称"
,
required
=
true
)
@NotNull
(
message
=
"路口名称不可为空"
)
private
String
name
;
/**
* 行政区划名称
*/
@ApiModelProperty
(
value
=
"行政区划名称"
,
required
=
true
)
@NotNull
(
message
=
"行政区划名称不可为空"
)
private
String
areaName
;
/**
* 是否信控路口:1是;0否
*/
@ApiModelProperty
(
value
=
"是否信控路口:1是;0否"
,
required
=
true
)
@NotNull
(
message
=
"是否信控路口不可为空"
)
@Max
(
value
=
1
,
message
=
"是否信控路口:1是;0否"
)
@Min
(
value
=
0
,
message
=
"是否信控路口:1是;0否"
)
private
Integer
isSignal
;
/**
* 是否启动优化:1是;0否
*/
@ApiModelProperty
(
value
=
"是否启动优化:1是;0否"
,
required
=
true
)
@NotNull
(
message
=
"是否启动优化不可为空"
)
@Max
(
value
=
1
,
message
=
"是否启动优化:1是;0否"
)
@Min
(
value
=
0
,
message
=
"是否启动优化:1是;0否"
)
private
Integer
isStart
;
/**
* 是否下发方案:1是;0否
*/
@ApiModelProperty
(
value
=
"是否下发方案:1是;0否"
,
required
=
true
)
@NotNull
(
message
=
"是否下发方案不可为空"
)
@Max
(
value
=
1
,
message
=
"是否下发方案:1是;0否"
)
@Min
(
value
=
0
,
message
=
"是否下发方案:1是;0否"
)
private
Integer
isSend
;
@ApiModelProperty
(
value
=
"当前页"
)
private
Integer
pageNum
;
@ApiModelProperty
(
value
=
"每页的数量"
)
private
Integer
pageSize
;
}
signal-web-service/src/main/resources/application.yml
0 → 100644
View file @
116b8526
server
:
port
:
32001
servlet
:
context-path
:
/web
spring
:
datasource
:
dynamic
:
primary
:
master
datasource
:
master
:
type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:mysql://10.100.1.74:3306/t_signal_control?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username
:
root
password
:
Wanji300552
driverClassName
:
com.mysql.cj.jdbc.Driver
slave
:
type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:mysql://10.100.1.74:3306/t_signal_control?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username
:
root
password
:
Wanji300552
driverClassName
:
com.mysql.cj.jdbc.Driver
redis
:
host
:
10.100.1.74
port
:
6379
password
:
Wanji300552
jedis
:
pool
:
max-active
:
200
max-wait
:
5000
max-idle
:
20
min-idle
:
10
timeout
:
5000
database
:
5
mybatis-plus
:
mapper-locations
:
classpath:mapper/*.xml
typeAliasesPackage
:
net.wanji.web.entity
check-config-location
:
true
configuration
:
#是否开启自动驼峰命名规则(camel case)映射
map-underscore-to-camel-case
:
true
#全局地开启或关闭配置文件中的所有映射器已经配置的任何缓存
cache-enabled
:
false
call-setters-on-nulls
:
true
#配置JdbcTypeForNull, oracle数据库必须配置
jdbc-type-for-null
:
'
null'
#MyBatis 自动映射时未知列或未知属性处理策略 NONE:不做任何处理 (默认值), WARNING:以日志的形式打印相关警告信息, FAILING:当作映射失败处理,并抛出异常和详细信息
auto-mapping-unknown-column-behavior
:
warning
#开启SQL打印
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
signal-web-service/src/main/resources/mapper/TBaseAreaInfoMapper.xml
0 → 100644
View file @
116b8526
<?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=
"net.wanji.web.mapper.TBaseAreaInfoMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"net.wanji.web.entity.TBaseAreaInfo"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"code"
property=
"code"
jdbcType=
"INTEGER"
/>
<result
column=
"name"
property=
"name"
jdbcType=
"VARCHAR"
/>
<result
column=
"type"
property=
"type"
jdbcType=
"TINYINT"
/>
<result
column=
"parent"
property=
"parent"
jdbcType=
"INTEGER"
/>
<result
column=
"location"
property=
"location"
jdbcType=
"VARCHAR"
/>
<result
column=
"gmt_create"
property=
"gmtCreate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"gmt_modified"
property=
"gmtModified"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<resultMap
id=
"ResultMapWithBLOBs"
type=
"net.wanji.web.entity.TBaseAreaInfo"
extends=
"BaseResultMap"
>
<result
column=
"polylines"
property=
"polylines"
jdbcType=
"LONGVARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, code, name, type, parent, location, gmt_create, gmt_modified
</sql>
<sql
id=
"Blob_Column_List"
>
polylines
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"ResultMapWithBLOBs"
parameterType=
"java.lang.Integer"
>
select
<include
refid=
"Base_Column_List"
/>
,
<include
refid=
"Blob_Column_List"
/>
from t_base_area_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from t_base_area_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"net.wanji.web.entity.TBaseAreaInfo"
>
insert into t_base_area_info (id, code, name,
type, parent, location,
gmt_create, gmt_modified, polylines
)
values (#{id,jdbcType=INTEGER}, #{code,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{type,jdbcType=TINYINT}, #{parent,jdbcType=INTEGER}, #{location,jdbcType=VARCHAR},
#{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP}, #{polylines,jdbcType=LONGVARCHAR}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"net.wanji.web.entity.TBaseAreaInfo"
>
insert into t_base_area_info
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"code != null"
>
code,
</if>
<if
test=
"name != null"
>
name,
</if>
<if
test=
"type != null"
>
type,
</if>
<if
test=
"parent != null"
>
parent,
</if>
<if
test=
"location != null"
>
location,
</if>
<if
test=
"gmtCreate != null"
>
gmt_create,
</if>
<if
test=
"gmtModified != null"
>
gmt_modified,
</if>
<if
test=
"polylines != null"
>
polylines,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=INTEGER},
</if>
<if
test=
"code != null"
>
#{code,jdbcType=INTEGER},
</if>
<if
test=
"name != null"
>
#{name,jdbcType=VARCHAR},
</if>
<if
test=
"type != null"
>
#{type,jdbcType=TINYINT},
</if>
<if
test=
"parent != null"
>
#{parent,jdbcType=INTEGER},
</if>
<if
test=
"location != null"
>
#{location,jdbcType=VARCHAR},
</if>
<if
test=
"gmtCreate != null"
>
#{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if
test=
"gmtModified != null"
>
#{gmtModified,jdbcType=TIMESTAMP},
</if>
<if
test=
"polylines != null"
>
#{polylines,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"net.wanji.web.entity.TBaseAreaInfo"
>
update t_base_area_info
<set>
<if
test=
"code != null"
>
code = #{code,jdbcType=INTEGER},
</if>
<if
test=
"name != null"
>
name = #{name,jdbcType=VARCHAR},
</if>
<if
test=
"type != null"
>
type = #{type,jdbcType=TINYINT},
</if>
<if
test=
"parent != null"
>
parent = #{parent,jdbcType=INTEGER},
</if>
<if
test=
"location != null"
>
location = #{location,jdbcType=VARCHAR},
</if>
<if
test=
"gmtCreate != null"
>
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if
test=
"gmtModified != null"
>
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
</if>
<if
test=
"polylines != null"
>
polylines = #{polylines,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKeyWithBLOBs"
parameterType=
"net.wanji.web.entity.TBaseAreaInfo"
>
update t_base_area_info
set code = #{code,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR},
type = #{type,jdbcType=TINYINT},
parent = #{parent,jdbcType=INTEGER},
location = #{location,jdbcType=VARCHAR},
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
polylines = #{polylines,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"net.wanji.web.entity.TBaseAreaInfo"
>
update t_base_area_info
set code = #{code,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR},
type = #{type,jdbcType=TINYINT},
parent = #{parent,jdbcType=INTEGER},
location = #{location,jdbcType=VARCHAR},
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
signal-web-service/src/main/resources/mapper/TBaseCrossInfoMapper.xml
0 → 100644
View file @
116b8526
<?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=
"net.wanji.web.mapper.TBaseCrossInfoMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"net.wanji.web.entity.TBaseCrossInfo"
>
<id
column=
"id"
property=
"id"
jdbcType=
"CHAR"
/>
<result
column=
"name"
property=
"name"
jdbcType=
"VARCHAR"
/>
<result
column=
"type"
property=
"type"
jdbcType=
"TINYINT"
/>
<result
column=
"level"
property=
"level"
jdbcType=
"TINYINT"
/>
<result
column=
"area_code"
property=
"areaCode"
jdbcType=
"INTEGER"
/>
<result
column=
"location"
property=
"location"
jdbcType=
"VARCHAR"
/>
<result
column=
"is_signal"
property=
"isSignal"
jdbcType=
"TINYINT"
/>
<result
column=
"is_start"
property=
"isStart"
jdbcType=
"TINYINT"
/>
<result
column=
"is_send"
property=
"isSend"
jdbcType=
"TINYINT"
/>
<result
column=
"gmt_create"
property=
"gmtCreate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"gmt_modified"
property=
"gmtModified"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<resultMap
id=
"SelectAllMap"
type=
"net.wanji.web.po.CrossInfoPO"
>
<id
column=
"id"
property=
"id"
jdbcType=
"CHAR"
/>
<result
column=
"name"
property=
"name"
jdbcType=
"VARCHAR"
/>
<result
column=
"type"
property=
"type"
jdbcType=
"TINYINT"
/>
<result
column=
"level"
property=
"level"
jdbcType=
"TINYINT"
/>
<result
column=
"area_code"
property=
"areaCode"
jdbcType=
"INTEGER"
/>
<result
column=
"area_name"
property=
"areaName"
jdbcType=
"VARCHAR"
/>
<result
column=
"location"
property=
"location"
jdbcType=
"VARCHAR"
/>
<result
column=
"is_signal"
property=
"isSignal"
jdbcType=
"TINYINT"
/>
<result
column=
"is_start"
property=
"isStart"
jdbcType=
"TINYINT"
/>
<result
column=
"is_send"
property=
"isSend"
jdbcType=
"TINYINT"
/>
<result
column=
"gmt_create"
property=
"gmtCreate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"gmt_modified"
property=
"gmtModified"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, name, type, level, area_code, location, is_signal, is_start, is_send, gmt_create,
gmt_modified
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from t_base_cross_info
where id = #{id,jdbcType=CHAR}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.String"
>
delete from t_base_cross_info
where id = #{id,jdbcType=CHAR}
</delete>
<insert
id=
"insert"
parameterType=
"net.wanji.web.entity.TBaseCrossInfo"
>
insert into t_base_cross_info (id, name, type,
level, area_code, location,
is_signal, is_start, is_send,
gmt_create, gmt_modified)
values (#{id,jdbcType=CHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT},
#{level,jdbcType=TINYINT}, #{areaCode,jdbcType=INTEGER}, #{location,jdbcType=VARCHAR},
#{isSignal,jdbcType=TINYINT}, #{isStart,jdbcType=TINYINT}, #{isSend,jdbcType=TINYINT},
#{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"net.wanji.web.entity.TBaseCrossInfo"
>
insert into t_base_cross_info
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"name != null"
>
name,
</if>
<if
test=
"type != null"
>
type,
</if>
<if
test=
"level != null"
>
level,
</if>
<if
test=
"areaCode != null"
>
area_code,
</if>
<if
test=
"location != null"
>
location,
</if>
<if
test=
"isSignal != null"
>
is_signal,
</if>
<if
test=
"isStart != null"
>
is_start,
</if>
<if
test=
"isSend != null"
>
is_send,
</if>
<if
test=
"gmtCreate != null"
>
gmt_create,
</if>
<if
test=
"gmtModified != null"
>
gmt_modified,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=CHAR},
</if>
<if
test=
"name != null"
>
#{name,jdbcType=VARCHAR},
</if>
<if
test=
"type != null"
>
#{type,jdbcType=TINYINT},
</if>
<if
test=
"level != null"
>
#{level,jdbcType=TINYINT},
</if>
<if
test=
"areaCode != null"
>
#{areaCode,jdbcType=INTEGER},
</if>
<if
test=
"location != null"
>
#{location,jdbcType=VARCHAR},
</if>
<if
test=
"isSignal != null"
>
#{isSignal,jdbcType=TINYINT},
</if>
<if
test=
"isStart != null"
>
#{isStart,jdbcType=TINYINT},
</if>
<if
test=
"isSend != null"
>
#{isSend,jdbcType=TINYINT},
</if>
<if
test=
"gmtCreate != null"
>
#{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if
test=
"gmtModified != null"
>
#{gmtModified,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"net.wanji.web.entity.TBaseCrossInfo"
>
update t_base_cross_info
<set>
<if
test=
"name != null"
>
name = #{name,jdbcType=VARCHAR},
</if>
<if
test=
"type != null"
>
type = #{type,jdbcType=TINYINT},
</if>
<if
test=
"level != null"
>
level = #{level,jdbcType=TINYINT},
</if>
<if
test=
"areaCode != null"
>
area_code = #{areaCode,jdbcType=INTEGER},
</if>
<if
test=
"location != null"
>
location = #{location,jdbcType=VARCHAR},
</if>
<if
test=
"isSignal != null"
>
is_signal = #{isSignal,jdbcType=TINYINT},
</if>
<if
test=
"isStart != null"
>
is_start = #{isStart,jdbcType=TINYINT},
</if>
<if
test=
"isSend != null"
>
is_send = #{isSend,jdbcType=TINYINT},
</if>
<if
test=
"gmtCreate != null"
>
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if
test=
"gmtModified != null"
>
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=CHAR}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"net.wanji.web.entity.TBaseCrossInfo"
>
update t_base_cross_info
set name = #{name,jdbcType=VARCHAR},
type = #{type,jdbcType=TINYINT},
level = #{level,jdbcType=TINYINT},
area_code = #{areaCode,jdbcType=INTEGER},
location = #{location,jdbcType=VARCHAR},
is_signal = #{isSignal,jdbcType=TINYINT},
is_start = #{isStart,jdbcType=TINYINT},
is_send = #{isSend,jdbcType=TINYINT},
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=CHAR}
</update>
<select
id=
"selectAll"
parameterType=
"net.wanji.web.vo.CrossInfoVO"
resultMap=
"SelectAllMap"
>
<bind
name=
"startNum"
value=
"(pageNum - 1) * pageSize"
/>
select c.id,c.name,c.type,c.level,c.area_code,a.name area_name,c.location,c.is_signal,c.is_start,c.is_send,c.gmt_create,c.gmt_modified
from t_base_cross_info c
left join t_base_area_info a on c.area_code=a.code
<where>
<if
test=
"name != null and name != ''"
>
and c.name like concat('%',#{name},'%')
</if>
<if
test=
"areaName != null and areaName != ''"
>
and a.name = #{areaName}
</if>
<if
test=
"isSignal != null and isSignal != ''"
>
and c.is_signal = #{isSignal}
</if>
<if
test=
"isStart != null and isStart != ''"
>
and c.is_start = #{isStart}
</if>
<if
test=
"isSend != null and isSend != ''"
>
and c.is_send = #{isSend}
</if>
</where>
<if
test=
"pageNum != null and pageSize != null"
>
limit #{startNum}, #{pageSize}
</if>
</select>
<select
id=
"countSelectAll"
parameterType=
"net.wanji.web.vo.CrossInfoVO"
resultType=
"integer"
>
select count(1)
from t_base_cross_info c
left join t_base_area_info a on c.area_code=a.code
<where>
<if
test=
"name != null and name != ''"
>
and c.name like concat('%',#{name},'%')
</if>
<if
test=
"areaName != null and areaName != ''"
>
and a.name = #{areaName}
</if>
<if
test=
"isSignal != null and isSignal != ''"
>
and c.is_signal = #{isSignal}
</if>
<if
test=
"isStart != null and isStart != ''"
>
and c.is_start = #{isStart}
</if>
<if
test=
"isSend != null and isSend != ''"
>
and c.is_send = #{isSend}
</if>
</where>
</select>
</mapper>
\ 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