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
16468730
Commit
16468730
authored
Feb 27, 2023
by
hanbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 策略管理-方法库、策略库接口
parent
684eef49
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
653 additions
and
0 deletions
+653
-0
IdeaController.java
...ava/net/wanji/opt/controller/strategy/IdeaController.java
+78
-0
StrategyController.java
...net/wanji/opt/controller/strategy/StrategyController.java
+78
-0
IdeaMapper.java
...in/java/net/wanji/opt/dao/mapper/strategy/IdeaMapper.java
+23
-0
StrategyMapper.java
...ava/net/wanji/opt/dao/mapper/strategy/StrategyMapper.java
+23
-0
IntegerIdsDTO.java
...ervice/src/main/java/net/wanji/opt/dto/IntegerIdsDTO.java
+16
-0
AddOrUpdateIdeaDTO.java
...n/java/net/wanji/opt/dto/strategy/AddOrUpdateIdeaDTO.java
+27
-0
AddOrUpdateStrategyDTO.java
...va/net/wanji/opt/dto/strategy/AddOrUpdateStrategyDTO.java
+27
-0
QueryIdeaDTO.java
...rc/main/java/net/wanji/opt/dto/strategy/QueryIdeaDTO.java
+16
-0
QueryStrategyDTO.java
...ain/java/net/wanji/opt/dto/strategy/QueryStrategyDTO.java
+16
-0
IdeaPO.java
...rvice/src/main/java/net/wanji/opt/po/strategy/IdeaPO.java
+36
-0
StrategyPO.java
...e/src/main/java/net/wanji/opt/po/strategy/StrategyPO.java
+35
-0
IdeaService.java
...main/java/net/wanji/opt/service/strategy/IdeaService.java
+23
-0
StrategyService.java
.../java/net/wanji/opt/service/strategy/StrategyService.java
+23
-0
IdeaServiceImpl.java
.../net/wanji/opt/service/strategy/impl/IdeaServiceImpl.java
+64
-0
StrategyServiceImpl.java
.../wanji/opt/service/strategy/impl/StrategyServiceImpl.java
+64
-0
IdeaMapper.xml
...service/src/main/resources/mapper/strategy/IdeaMapper.xml
+52
-0
StrategyMapper.xml
...ice/src/main/resources/mapper/strategy/StrategyMapper.xml
+52
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/controller/strategy/IdeaController.java
0 → 100644
View file @
16468730
package
net
.
wanji
.
opt
.
controller
.
strategy
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.opt.dto.IntegerIdsDTO
;
import
net.wanji.opt.dto.strategy.AddOrUpdateIdeaDTO
;
import
net.wanji.opt.dto.strategy.QueryIdeaDTO
;
import
net.wanji.opt.po.strategy.IdeaPO
;
import
net.wanji.opt.service.strategy.impl.IdeaServiceImpl
;
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
javax.ws.rs.core.MediaType
;
import
java.util.List
;
/**
* 策略管理-方法库
*
* @author Kent HAN
* @date 2023/2/27 9:25
*/
@Api
(
value
=
"IdeaController"
,
description
=
"策略管理-方法库"
)
@RequestMapping
(
"/idea"
)
@RestController
public
class
IdeaController
{
private
final
IdeaServiceImpl
ideaService
;
public
IdeaController
(
IdeaServiceImpl
ideaService
)
{
this
.
ideaService
=
ideaService
;
}
@ApiOperation
(
value
=
"新增/修改方法"
,
notes
=
"新增/修改方法"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/addOrUpdateIdea"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
JsonViewObject
.
class
),
})
public
JsonViewObject
addOrUpdateIdea
(
@RequestBody
AddOrUpdateIdeaDTO
addOrUpdateIdeaDTO
)
{
ideaService
.
addOrUpdateIdea
(
addOrUpdateIdeaDTO
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
success
();
}
@ApiOperation
(
value
=
"删除方法"
,
notes
=
"删除方法"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/deleteIdea"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
JsonViewObject
.
class
),
})
public
JsonViewObject
deleteIdea
(
@RequestBody
IntegerIdsDTO
integerIdsDTO
)
{
ideaService
.
deleteIdea
(
integerIdsDTO
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
success
();
}
@ApiOperation
(
value
=
"查询方法"
,
notes
=
"查询方法"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/queryIdea"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
IdeaPO
.
class
),
})
public
JsonViewObject
queryIdea
(
@RequestBody
QueryIdeaDTO
queryIdeaDTO
)
{
List
<
IdeaPO
>
ideaPOList
=
ideaService
.
queryIdea
(
queryIdeaDTO
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
success
(
ideaPOList
);
}
}
signal-optimize-service/src/main/java/net/wanji/opt/controller/strategy/StrategyController.java
0 → 100644
View file @
16468730
package
net
.
wanji
.
opt
.
controller
.
strategy
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.opt.dto.IntegerIdsDTO
;
import
net.wanji.opt.dto.strategy.AddOrUpdateStrategyDTO
;
import
net.wanji.opt.dto.strategy.QueryStrategyDTO
;
import
net.wanji.opt.po.strategy.StrategyPO
;
import
net.wanji.opt.service.strategy.impl.StrategyServiceImpl
;
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
javax.ws.rs.core.MediaType
;
import
java.util.List
;
/**
* 策略管理-策略库
*
* @author Kent HAN
* @date 2023/2/27 9:25
*/
@Api
(
value
=
"StrategyController"
,
description
=
"策略管理-策略库"
)
@RequestMapping
(
"/strategy"
)
@RestController
public
class
StrategyController
{
private
final
StrategyServiceImpl
strategyService
;
public
StrategyController
(
StrategyServiceImpl
strategyService
)
{
this
.
strategyService
=
strategyService
;
}
@ApiOperation
(
value
=
"新增/修改策略"
,
notes
=
"新增/修改策略"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/addOrUpdateStrategy"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
JsonViewObject
.
class
),
})
public
JsonViewObject
addOrUpdateStrategy
(
@RequestBody
AddOrUpdateStrategyDTO
addOrUpdateStrategyDTO
)
{
strategyService
.
addOrUpdateStrategy
(
addOrUpdateStrategyDTO
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
success
();
}
@ApiOperation
(
value
=
"删除策略"
,
notes
=
"删除策略"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/deleteStrategy"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
JsonViewObject
.
class
),
})
public
JsonViewObject
deleteStrategy
(
@RequestBody
IntegerIdsDTO
integerIdsDTO
)
{
strategyService
.
deleteStrategy
(
integerIdsDTO
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
success
();
}
@ApiOperation
(
value
=
"查询策略"
,
notes
=
"查询策略"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/queryStrategy"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
StrategyPO
.
class
),
})
public
JsonViewObject
queryStrategy
(
@RequestBody
QueryStrategyDTO
queryStrategyDTO
)
{
List
<
StrategyPO
>
strategyPOList
=
strategyService
.
queryStrategy
(
queryStrategyDTO
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
success
(
strategyPOList
);
}
}
signal-optimize-service/src/main/java/net/wanji/opt/dao/mapper/strategy/IdeaMapper.java
0 → 100644
View file @
16468730
package
net
.
wanji
.
opt
.
dao
.
mapper
.
strategy
;
import
net.wanji.opt.po.strategy.IdeaPO
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* @author Kent HAN
* @date 2023/2/27 9:33
*/
@Repository
public
interface
IdeaMapper
{
void
insertOne
(
IdeaPO
ideaPO
);
void
deleteById
(
Integer
id
);
void
updateOne
(
IdeaPO
ideaPO
);
void
deleteByIds
(
List
<
Integer
>
ids
);
List
<
IdeaPO
>
selectByIdeaName
(
String
ideaName
);
}
signal-optimize-service/src/main/java/net/wanji/opt/dao/mapper/strategy/StrategyMapper.java
0 → 100644
View file @
16468730
package
net
.
wanji
.
opt
.
dao
.
mapper
.
strategy
;
import
net.wanji.opt.po.strategy.StrategyPO
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* @author Kent HAN
* @date 2023/2/27 9:33
*/
@Repository
public
interface
StrategyMapper
{
void
insertOne
(
StrategyPO
strategyPO
);
void
deleteById
(
Integer
id
);
void
updateOne
(
StrategyPO
strategyPO
);
void
deleteByIds
(
List
<
Integer
>
ids
);
List
<
StrategyPO
>
selectByStrategyName
(
String
strategyName
);
}
signal-optimize-service/src/main/java/net/wanji/opt/dto/IntegerIdsDTO.java
0 → 100644
View file @
16468730
package
net
.
wanji
.
opt
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author Kent HAN
* @date 2023/2/27 9:56
*/
@Data
public
class
IntegerIdsDTO
{
@ApiModelProperty
(
name
=
"自增数值型主键ID列表"
,
notes
=
""
)
private
List
<
Integer
>
ids
;
}
signal-optimize-service/src/main/java/net/wanji/opt/dto/strategy/AddOrUpdateIdeaDTO.java
0 → 100644
View file @
16468730
package
net
.
wanji
.
opt
.
dto
.
strategy
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author Kent HAN
* @date 2023/2/27 9:39
*/
@Data
@ApiModel
(
value
=
"AddOrUpdateIdeaDTO"
,
description
=
"策略管理-方法库-新增/修改方法"
)
public
class
AddOrUpdateIdeaDTO
{
@ApiModelProperty
(
value
=
"方法ID(不传ID为新增,传ID为修改)"
,
notes
=
""
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"编号"
,
required
=
true
,
notes
=
""
)
private
String
ideaCode
;
/** 优化方法 */
@ApiModelProperty
(
value
=
"优化方法"
,
required
=
true
,
notes
=
""
)
private
String
ideaName
;
/** 应用对象 1路口;2干线;3区域 */
@ApiModelProperty
(
value
=
"应用对象 1路口;2干线;3区域"
,
required
=
true
,
notes
=
""
)
private
Integer
ideaTarget
;
/** 优化详情 */
@ApiModelProperty
(
value
=
"优化详情"
,
required
=
true
,
notes
=
""
)
private
String
ideaDetail
;
}
signal-optimize-service/src/main/java/net/wanji/opt/dto/strategy/AddOrUpdateStrategyDTO.java
0 → 100644
View file @
16468730
package
net
.
wanji
.
opt
.
dto
.
strategy
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author Kent HAN
* @date 2023/2/27 9:39
*/
@Data
@ApiModel
(
value
=
"AddOrUpdateStrategyDTO"
,
description
=
"策略管理-策略库-新增/修改策略"
)
public
class
AddOrUpdateStrategyDTO
{
@ApiModelProperty
(
value
=
"策略ID(不传ID为新增,传ID为修改)"
,
notes
=
""
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"编号"
,
required
=
true
,
notes
=
""
)
private
String
strategyCode
;
/** 优化方法 */
@ApiModelProperty
(
value
=
"策略名称"
,
required
=
true
,
notes
=
""
)
private
String
strategyName
;
/** 应用对象 1路口;2干线;3区域 */
@ApiModelProperty
(
value
=
"应用对象 1路口;2干线;3区域"
,
required
=
true
,
notes
=
""
)
private
Integer
strategyTarget
;
/** 优化详情 */
@ApiModelProperty
(
value
=
"策略详情"
,
required
=
true
,
notes
=
""
)
private
String
strategyDetail
;
}
signal-optimize-service/src/main/java/net/wanji/opt/dto/strategy/QueryIdeaDTO.java
0 → 100644
View file @
16468730
package
net
.
wanji
.
opt
.
dto
.
strategy
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author Kent HAN
* @date 2023/2/27 9:39
*/
@Data
@ApiModel
(
value
=
"QueryIdeaDTO"
,
description
=
"策略管理-方法库-查询方法"
)
public
class
QueryIdeaDTO
{
@ApiModelProperty
(
value
=
"方法名称"
,
notes
=
""
)
private
String
ideaName
;
}
signal-optimize-service/src/main/java/net/wanji/opt/dto/strategy/QueryStrategyDTO.java
0 → 100644
View file @
16468730
package
net
.
wanji
.
opt
.
dto
.
strategy
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author Kent HAN
* @date 2023/2/27 9:39
*/
@Data
@ApiModel
(
value
=
"QueryStrategyDTO"
,
description
=
"策略管理-策略库-查询策略"
)
public
class
QueryStrategyDTO
{
@ApiModelProperty
(
value
=
"策略名称"
,
notes
=
""
)
private
String
strategyName
;
}
signal-optimize-service/src/main/java/net/wanji/opt/po/strategy/IdeaPO.java
0 → 100644
View file @
16468730
package
net
.
wanji
.
opt
.
po
.
strategy
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author hanbing
* @date 2023/1/10 16:36
* @desc CrossDataRealtimePO
*/
@Data
public
class
IdeaPO
{
/** 方法ID */
@ApiModelProperty
(
value
=
"方法ID"
,
notes
=
""
)
private
Integer
id
;
/** 编号 */
@ApiModelProperty
(
value
=
"编号"
,
notes
=
""
)
private
String
ideaCode
;
/** 优化方法 */
@ApiModelProperty
(
value
=
"优化方法"
,
notes
=
""
)
private
String
ideaName
;
/** 应用对象 1路口;2干线;3区域 */
@ApiModelProperty
(
value
=
"应用对象 1路口;2干线;3区域"
,
notes
=
""
)
private
Integer
ideaTarget
;
/** 优化详情 */
@ApiModelProperty
(
value
=
"优化详情"
,
notes
=
""
)
private
String
ideaDetail
;
/** 创建时间 */
@ApiModelProperty
(
value
=
"创建时间"
,
notes
=
""
)
private
Date
gmtCreate
;
/** 修改时间 */
@ApiModelProperty
(
value
=
"修改时间"
,
notes
=
""
)
private
Date
gmtModified
;
}
signal-optimize-service/src/main/java/net/wanji/opt/po/strategy/StrategyPO.java
0 → 100644
View file @
16468730
package
net
.
wanji
.
opt
.
po
.
strategy
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author hanbing
* @date 2023/1/10 16:36
* @desc CrossDataRealtimePO
*/
@Data
public
class
StrategyPO
{
@ApiModelProperty
(
value
=
"策略ID"
,
notes
=
""
)
private
Integer
id
;
/** 编号 */
@ApiModelProperty
(
value
=
"编号"
,
notes
=
""
)
private
String
strategyCode
;
/** 优化方法 */
@ApiModelProperty
(
value
=
"策略名称"
,
notes
=
""
)
private
String
strategyName
;
/** 应用对象 1路口;2干线;3区域 */
@ApiModelProperty
(
value
=
"应用对象 1路口;2干线;3区域"
,
notes
=
""
)
private
Integer
strategyTarget
;
/** 优化详情 */
@ApiModelProperty
(
value
=
"策略详情"
,
notes
=
""
)
private
String
strategyDetail
;
/** 创建时间 */
@ApiModelProperty
(
value
=
"创建时间"
,
notes
=
""
)
private
Date
gmtCreate
;
/** 修改时间 */
@ApiModelProperty
(
value
=
"修改时间"
,
notes
=
""
)
private
Date
gmtModified
;
}
signal-optimize-service/src/main/java/net/wanji/opt/service/strategy/IdeaService.java
0 → 100644
View file @
16468730
package
net
.
wanji
.
opt
.
service
.
strategy
;
import
net.wanji.opt.dto.IntegerIdsDTO
;
import
net.wanji.opt.dto.strategy.AddOrUpdateIdeaDTO
;
import
net.wanji.opt.dto.strategy.QueryIdeaDTO
;
import
net.wanji.opt.po.strategy.IdeaPO
;
import
java.util.List
;
/**
* @author hanbing
* @date 2023/1/12 15:12
* @desc 策略管理-方法库接口服务
*/
public
interface
IdeaService
{
void
addOrUpdateIdea
(
AddOrUpdateIdeaDTO
addOrUpdateIdeaDTO
);
void
deleteIdea
(
IntegerIdsDTO
integerIdsDTO
);
List
<
IdeaPO
>
queryIdea
(
QueryIdeaDTO
queryIdeaDTO
);
}
signal-optimize-service/src/main/java/net/wanji/opt/service/strategy/StrategyService.java
0 → 100644
View file @
16468730
package
net
.
wanji
.
opt
.
service
.
strategy
;
import
net.wanji.opt.dto.IntegerIdsDTO
;
import
net.wanji.opt.dto.strategy.AddOrUpdateStrategyDTO
;
import
net.wanji.opt.dto.strategy.QueryStrategyDTO
;
import
net.wanji.opt.po.strategy.StrategyPO
;
import
java.util.List
;
/**
* @author hanbing
* @date 2023/1/12 15:12
* @desc 策略管理-策略库接口服务
*/
public
interface
StrategyService
{
void
addOrUpdateStrategy
(
AddOrUpdateStrategyDTO
addOrUpdateStrategyDTO
);
void
deleteStrategy
(
IntegerIdsDTO
integerIdsDTO
);
List
<
StrategyPO
>
queryStrategy
(
QueryStrategyDTO
queryStrategyDTO
);
}
signal-optimize-service/src/main/java/net/wanji/opt/service/strategy/impl/IdeaServiceImpl.java
0 → 100644
View file @
16468730
package
net
.
wanji
.
opt
.
service
.
strategy
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
net.wanji.opt.dao.mapper.strategy.IdeaMapper
;
import
net.wanji.opt.dto.IntegerIdsDTO
;
import
net.wanji.opt.dto.strategy.AddOrUpdateIdeaDTO
;
import
net.wanji.opt.dto.strategy.QueryIdeaDTO
;
import
net.wanji.opt.po.strategy.IdeaPO
;
import
net.wanji.opt.service.strategy.IdeaService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
/**
* @author Kent HAN
* @date 2023/2/27 9:43
*/
@Service
public
class
IdeaServiceImpl
implements
IdeaService
{
private
final
IdeaMapper
ideaMapper
;
public
IdeaServiceImpl
(
IdeaMapper
ideaMapper
)
{
this
.
ideaMapper
=
ideaMapper
;
}
@Override
@Transactional
public
void
addOrUpdateIdea
(
AddOrUpdateIdeaDTO
addOrUpdateIdeaDTO
)
{
Integer
id
=
addOrUpdateIdeaDTO
.
getId
();
if
(
id
==
0
||
ObjectUtil
.
isEmpty
(
id
))
{
// 不传ID为新增
IdeaPO
ideaPO
=
new
IdeaPO
();
ideaPO
.
setIdeaCode
(
addOrUpdateIdeaDTO
.
getIdeaCode
());
ideaPO
.
setIdeaName
(
addOrUpdateIdeaDTO
.
getIdeaName
());
ideaPO
.
setIdeaTarget
(
addOrUpdateIdeaDTO
.
getIdeaTarget
());
ideaPO
.
setIdeaDetail
(
addOrUpdateIdeaDTO
.
getIdeaDetail
());
ideaMapper
.
insertOne
(
ideaPO
);
}
else
{
// 传ID为修改
IdeaPO
ideaPO
=
new
IdeaPO
();
ideaPO
.
setId
(
id
);
ideaPO
.
setIdeaCode
(
addOrUpdateIdeaDTO
.
getIdeaCode
());
ideaPO
.
setIdeaName
(
addOrUpdateIdeaDTO
.
getIdeaName
());
ideaPO
.
setIdeaTarget
(
addOrUpdateIdeaDTO
.
getIdeaTarget
());
ideaPO
.
setIdeaDetail
(
addOrUpdateIdeaDTO
.
getIdeaDetail
());
ideaMapper
.
updateOne
(
ideaPO
);
}
}
@Override
public
void
deleteIdea
(
IntegerIdsDTO
integerIdsDTO
)
{
List
<
Integer
>
ids
=
integerIdsDTO
.
getIds
();
ideaMapper
.
deleteByIds
(
ids
);
// todo 删除关系表数据
}
@Override
public
List
<
IdeaPO
>
queryIdea
(
QueryIdeaDTO
queryIdeaDTO
)
{
String
ideaName
=
queryIdeaDTO
.
getIdeaName
();
List
<
IdeaPO
>
ideaPOList
=
ideaMapper
.
selectByIdeaName
(
ideaName
);
return
ideaPOList
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/service/strategy/impl/StrategyServiceImpl.java
0 → 100644
View file @
16468730
package
net
.
wanji
.
opt
.
service
.
strategy
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
net.wanji.opt.dao.mapper.strategy.StrategyMapper
;
import
net.wanji.opt.dto.IntegerIdsDTO
;
import
net.wanji.opt.dto.strategy.AddOrUpdateStrategyDTO
;
import
net.wanji.opt.dto.strategy.QueryStrategyDTO
;
import
net.wanji.opt.po.strategy.StrategyPO
;
import
net.wanji.opt.service.strategy.StrategyService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
/**
* @author Kent HAN
* @date 2023/2/27 9:43
*/
@Service
public
class
StrategyServiceImpl
implements
StrategyService
{
private
final
StrategyMapper
strategyMapper
;
public
StrategyServiceImpl
(
StrategyMapper
strategyMapper
)
{
this
.
strategyMapper
=
strategyMapper
;
}
@Override
@Transactional
public
void
addOrUpdateStrategy
(
AddOrUpdateStrategyDTO
addOrUpdateStrategyDTO
)
{
Integer
id
=
addOrUpdateStrategyDTO
.
getId
();
if
(
id
==
0
||
ObjectUtil
.
isEmpty
(
id
))
{
// 不传ID为新增
StrategyPO
strategyPO
=
new
StrategyPO
();
strategyPO
.
setStrategyCode
(
addOrUpdateStrategyDTO
.
getStrategyCode
());
strategyPO
.
setStrategyName
(
addOrUpdateStrategyDTO
.
getStrategyName
());
strategyPO
.
setStrategyTarget
(
addOrUpdateStrategyDTO
.
getStrategyTarget
());
strategyPO
.
setStrategyDetail
(
addOrUpdateStrategyDTO
.
getStrategyDetail
());
strategyMapper
.
insertOne
(
strategyPO
);
}
else
{
// 传ID为修改
StrategyPO
strategyPO
=
new
StrategyPO
();
strategyPO
.
setId
(
id
);
strategyPO
.
setStrategyCode
(
addOrUpdateStrategyDTO
.
getStrategyCode
());
strategyPO
.
setStrategyName
(
addOrUpdateStrategyDTO
.
getStrategyName
());
strategyPO
.
setStrategyTarget
(
addOrUpdateStrategyDTO
.
getStrategyTarget
());
strategyPO
.
setStrategyDetail
(
addOrUpdateStrategyDTO
.
getStrategyDetail
());
strategyMapper
.
updateOne
(
strategyPO
);
}
}
@Override
public
void
deleteStrategy
(
IntegerIdsDTO
integerIdsDTO
)
{
List
<
Integer
>
ids
=
integerIdsDTO
.
getIds
();
strategyMapper
.
deleteByIds
(
ids
);
// todo 删除关系表数据
}
@Override
public
List
<
StrategyPO
>
queryStrategy
(
QueryStrategyDTO
queryStrategyDTO
)
{
String
strategyName
=
queryStrategyDTO
.
getStrategyName
();
List
<
StrategyPO
>
strategyPOList
=
strategyMapper
.
selectByStrategyName
(
strategyName
);
return
strategyPOList
;
}
}
signal-optimize-service/src/main/resources/mapper/strategy/IdeaMapper.xml
0 → 100644
View file @
16468730
<?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.opt.dao.mapper.strategy.IdeaMapper"
>
<insert
id=
"insertOne"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into t_strategy_idea(idea_code,idea_name,idea_target,idea_detail)
values (#{ideaCode},#{ideaName},#{ideaTarget},#{ideaDetail})
</insert>
<update
id=
"updateOne"
>
update t_strategy_idea
<set>
<if
test=
"ideaCode != null and ideaCode != ''"
>
idea_code = #{ideaCode},
</if>
<if
test=
"ideaName != null and ideaName != ''"
>
idea_name = #{ideaName},
</if>
<if
test=
"ideaTarget != null and ideaTarget != ''"
>
idea_target = #{ideaTarget},
</if>
<if
test=
"ideaDetail != null and ideaDetail != ''"
>
idea_detail = #{ideaDetail},
</if>
</set>
where id = #{id}
</update>
<delete
id=
"deleteById"
>
DELETE FROM t_strategy_idea WHERE id = ${id}
</delete>
<delete
id=
"deleteByIds"
>
DELETE FROM t_strategy_idea
WHERE id IN
<foreach
collection=
"ids"
item=
"id"
separator=
","
open=
"("
close=
")"
>
#{id}
</foreach>
</delete>
<select
id=
"selectByIdeaName"
resultType=
"net.wanji.opt.po.strategy.IdeaPO"
>
select
id,idea_code,idea_name,idea_target,idea_detail,gmt_create,gmt_modified
from t_strategy_idea
<where>
<if
test=
"ideaName != null and ideaName != ''"
>
AND idea_name LIKE CONCAT('%',#{ideaName},'%')
</if>
</where>
</select>
</mapper>
signal-optimize-service/src/main/resources/mapper/strategy/StrategyMapper.xml
0 → 100644
View file @
16468730
<?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.opt.dao.mapper.strategy.StrategyMapper"
>
<insert
id=
"insertOne"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into t_strategy_strategy(strategy_code,strategy_name,strategy_target,strategy_detail)
values (#{strategyCode},#{strategyName},#{strategyTarget},#{strategyDetail})
</insert>
<update
id=
"updateOne"
>
update t_strategy_strategy
<set>
<if
test=
"strategyCode != null and strategyCode != ''"
>
strategy_code = #{strategyCode},
</if>
<if
test=
"strategyName != null and strategyName != ''"
>
strategy_name = #{strategyName},
</if>
<if
test=
"strategyTarget != null and strategyTarget != ''"
>
strategy_target = #{strategyTarget},
</if>
<if
test=
"strategyDetail != null and strategyDetail != ''"
>
strategy_detail = #{strategyDetail},
</if>
</set>
where id = #{id}
</update>
<delete
id=
"deleteById"
>
DELETE FROM t_strategy_strategy WHERE id = ${id}
</delete>
<delete
id=
"deleteByIds"
>
DELETE FROM t_strategy_strategy
WHERE id IN
<foreach
collection=
"ids"
item=
"id"
separator=
","
open=
"("
close=
")"
>
#{id}
</foreach>
</delete>
<select
id=
"selectByStrategyName"
resultType=
"net.wanji.opt.po.strategy.StrategyPO"
>
select
id,strategy_code,strategy_name,strategy_target,strategy_detail,gmt_create,gmt_modified
from t_strategy_strategy
<where>
<if
test=
"strategyName != null and strategyName != ''"
>
AND strategy_name LIKE CONCAT('%',#{strategyName},'%')
</if>
</where>
</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