Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
operation-control-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王锦盛
operation-control-platform
Commits
12ceff04
Commit
12ceff04
authored
Mar 10, 2022
by
王锦盛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加模型拓步关系CRUD
parent
cd94d86a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
480 additions
and
5 deletions
+480
-5
src/main/java/com/pms/ocp/controller/ModelBaseController.java
...main/java/com/pms/ocp/controller/ModelBaseController.java
+31
-5
src/main/java/com/pms/ocp/mapper/ModelRelationMapper.java
src/main/java/com/pms/ocp/mapper/ModelRelationMapper.java
+15
-0
src/main/java/com/pms/ocp/model/dto/ModelRelationDTO.java
src/main/java/com/pms/ocp/model/dto/ModelRelationDTO.java
+86
-0
src/main/java/com/pms/ocp/model/entity/ModelRelation.java
src/main/java/com/pms/ocp/model/entity/ModelRelation.java
+109
-0
src/main/java/com/pms/ocp/model/vo/ModelRelationVO.java
src/main/java/com/pms/ocp/model/vo/ModelRelationVO.java
+86
-0
src/main/java/com/pms/ocp/service/ModelRelationService.java
src/main/java/com/pms/ocp/service/ModelRelationService.java
+65
-0
src/main/java/com/pms/ocp/service/impl/ModelRelationServiceImpl.java
...va/com/pms/ocp/service/impl/ModelRelationServiceImpl.java
+88
-0
No files found.
src/main/java/com/pms/ocp/controller/ModelBaseController.java
View file @
12ceff04
...
...
@@ -2,6 +2,7 @@ package com.pms.ocp.controller;
import
com.pms.ocp.model.dto.ModelIssueDTO
;
import
com.pms.ocp.model.dto.ModelPropertyDTO
;
import
com.pms.ocp.model.dto.ModelRelationDTO
;
import
com.pms.ocp.model.entity.Model
;
import
com.pms.ocp.model.entity.ModelNote
;
import
com.pms.ocp.model.vo.ResponseVO
;
...
...
@@ -33,9 +34,6 @@ public class ModelBaseController {
@Autowired
private
ModelService
modelService
;
@Autowired
private
ModelGroupService
modelGroupService
;
@Autowired
private
ModelPropertyService
modelPropertyService
;
...
...
@@ -45,6 +43,8 @@ public class ModelBaseController {
@Autowired
private
ModelIssueService
modelIssueService
;
@Autowired
private
ModelRelationService
modelRelationService
;
/**
* 模型分类-查询
*
...
...
@@ -276,6 +276,19 @@ public class ModelBaseController {
return
ResponseVO
.
ok
(
modelPropertyService
.
deletePatchModelProperty
(
ids
));
}
/**
* 模型拓扑关系-增加
*
* @return
*/
@ApiOperation
(
"模型拓扑关系-增加"
)
@PostMapping
(
"create/model/topology"
)
public
ResponseVO
createModelTopology
(
@RequestBody
ModelRelationDTO
modelRelationDTO
)
{
Integer
i
=
modelRelationService
.
createModelRelation
(
modelRelationDTO
);
return
ResponseVO
.
ok
(
i
);
}
/**
* 模型拓扑关系-查询
*
...
...
@@ -283,8 +296,21 @@ public class ModelBaseController {
*/
@ApiOperation
(
"模型拓扑关系-查询"
)
@GetMapping
(
"/get/model/topology"
)
public
ResponseVO
getModelTopology
()
{
return
ResponseVO
.
ok
();
public
ResponseVO
getModelTopology
(
@ApiParam
(
value
=
"模型拓扑关系编号"
)
@RequestParam
(
value
=
"objId"
,
required
=
false
)
String
objId
,
@ApiParam
(
value
=
"模型编码"
)
@RequestParam
(
value
=
"modelCode"
,
required
=
false
)
String
modelCode
)
{
return
ResponseVO
.
ok
(
modelRelationService
.
getModelRelationList
(
objId
,
modelCode
));
}
/**
* 模型拓扑关系-删除
*
* @return
*/
@ApiOperation
(
"模型拓扑关系-删除"
)
@PostMapping
(
"/delete/model/topology"
)
public
ResponseVO
deleteModelTopology
(
@ApiParam
(
value
=
"模型拓扑关系编号"
)
@RequestParam
(
value
=
"objId"
,
required
=
false
)
String
objId
,
@ApiParam
(
value
=
"模型编码"
)
@RequestParam
(
value
=
"modelCode"
,
required
=
false
)
String
modelCode
)
{
return
ResponseVO
.
ok
(
modelRelationService
.
deleteModelRelation
(
objId
,
modelCode
));
}
}
src/main/java/com/pms/ocp/mapper/ModelRelationMapper.java
0 → 100644
View file @
12ceff04
package
com.pms.ocp.mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.pms.ocp.model.entity.ModelRelation
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:25
* @Description:模型关系数据层接口
*/
@Mapper
public
interface
ModelRelationMapper
extends
BaseMapper
<
ModelRelation
>
{
}
src/main/java/com/pms/ocp/model/dto/ModelRelationDTO.java
0 → 100644
View file @
12ceff04
package
com.pms.ocp.model.dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
/**
* @Auther: wangjian
* @Date: 2022/3/10 19:24
* @Description:模型关系DTO对象
*/
@ApiModel
(
value
=
"模型关系DTO对象"
)
@Data
public
class
ModelRelationDTO
{
/**
* 模型关系编号
* 主键
*/
@ApiModelProperty
(
value
=
"模型关系编号"
)
private
String
objId
;
/**
* 模型编码
*/
@ApiModelProperty
(
value
=
"模型编码"
)
private
String
modelCode
;
/**
* 模型属性编码
*/
@ApiModelProperty
(
value
=
"模型属性编码"
)
private
String
modelPropCode
;
/**
* 关联模型编码
*/
@ApiModelProperty
(
value
=
"关联模型编码"
)
private
String
relationModeCode
;
/**
* 关联模型属性编码
*/
@ApiModelProperty
(
value
=
"关联模型属性编码"
)
private
String
relationModePropCode
;
/**
* 提交人id
*/
@ApiModelProperty
(
value
=
"提交人编号"
)
private
String
modelUserId
;
/**
* 提交人姓名
*/
@ApiModelProperty
(
value
=
"提交人姓名"
)
private
String
modelUserName
;
/**
* 订阅时间
*/
@ApiModelProperty
(
value
=
"订阅时间"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
modelCtime
;
/**
* 修改时间
*/
@ApiModelProperty
(
value
=
"修改时间"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
modelMtime
;
/**
* 是否已删除 0:未删除 1:已删除
*/
@ApiModelProperty
(
value
=
"是否已删除"
)
private
String
boolDelete
;
}
src/main/java/com/pms/ocp/model/entity/ModelRelation.java
0 → 100644
View file @
12ceff04
package
com.pms.ocp.model.entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
/**
* @Auther: wangjian
* @Date: 2022/3/10 19:16
* @Description:模型关系对象
*/
@Data
@Accessors
(
chain
=
true
)
@TableName
(
"ocp_model_rel"
)
public
class
ModelRelation
{
/**
* 模型关系编号
* 主键
*/
@TableId
(
value
=
"obj_id"
)
private
String
objId
;
/**
* 模型编码
*/
private
String
modelCode
;
/**
* 模型属性编码
*/
private
String
modelPropCode
;
/**
* 关联模型编码
*/
private
String
relationModeCode
;
/**
* 关联模型属性编码
*/
private
String
relationModePropCode
;
/**
* 提交人编号
*/
private
String
modelUserId
;
/**
* 提交人姓名
*/
private
String
modelUserName
;
/**
* 订阅时间
*/
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
modelCtime
;
/**
* 修改时间
*/
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
modelMtime
;
/**
* 是否已删除 0:未删除 1:已删除
*/
@TableField
(
"is_delete"
)
private
String
boolDelete
;
}
// create table ocp_model_rel
// (
// obj_id varchar(42) constraint ocp_model_rel_pkey primary key,
// model_code varchar(42) default ''::character varying not null,
// model_prop_code varchar(42) default ''::character varying not null,
// relation_mode_code varchar(42) default ''::character varying not null,
// relation_mode_prop_code varchar(43) default ''::character varying not null,
// model_user_id varchar(42) default ''::character varying,
// model_user_name varchar(64) default ''::character varying,
// model_ctime timestamp(6) default '2000-01-01 00:00:00'::timestamp(0) without time zone,
// model_mtime timestamp(6) default '2000-01-01 00:00:00'::timestamp(0) without time zone,
// is_delete smallint default '-1'::integer
// );
//
// comment on table ocp_model_rel is '模型关系表';
// comment on column ocp_model_rel.obj_id is '主键';
// comment on column ocp_model_rel.model_code is '模型编码';
// comment on column ocp_model_rel.model_prop_code is '模型属性编码';
// comment on column ocp_model_rel.relation_mode_code is '关联模型编码';
// comment on column ocp_model_rel.relation_mode_prop_code is '关联模型属性编码';
// comment on column ocp_model_rel.model_user_id is '提交人id';
// comment on column ocp_model_rel.model_user_name is '提交人姓名';
// comment on column ocp_model_rel.model_ctime is '创建时间';
// comment on column ocp_model_rel.model_mtime is '修改时间';
// comment on column ocp_model_rel.is_delete is '是否已删除0:未删除 1:已删除';
\ No newline at end of file
src/main/java/com/pms/ocp/model/vo/ModelRelationVO.java
0 → 100644
View file @
12ceff04
package
com.pms.ocp.model.vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
/**
* @Auther: wangjian
* @Date: 2022/3/10 19:24
* @Description:模型关系VO对象
*/
@ApiModel
(
value
=
"模型关系VO对象"
)
@Data
public
class
ModelRelationVO
{
/**
* 模型关系编号
* 主键
*/
@ApiModelProperty
(
value
=
"模型关系编号"
)
private
String
objId
;
/**
* 模型编码
*/
@ApiModelProperty
(
value
=
"模型编码"
)
private
String
modelCode
;
/**
* 模型属性编码
*/
@ApiModelProperty
(
value
=
"模型属性编码"
)
private
String
modelPropCode
;
/**
* 关联模型编码
*/
@ApiModelProperty
(
value
=
"关联模型编码"
)
private
String
relationModeCode
;
/**
* 关联模型属性编码
*/
@ApiModelProperty
(
value
=
"关联模型属性编码"
)
private
String
relationModePropCode
;
/**
* 提交人id
*/
@ApiModelProperty
(
value
=
"提交人编号"
)
private
String
modelUserId
;
/**
* 提交人姓名
*/
@ApiModelProperty
(
value
=
"提交人姓名"
)
private
String
modelUserName
;
/**
* 订阅时间
*/
@ApiModelProperty
(
value
=
"订阅时间"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
modelCtime
;
/**
* 修改时间
*/
@ApiModelProperty
(
value
=
"修改时间"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
modelMtime
;
/**
* 是否已删除 0:未删除 1:已删除
*/
@ApiModelProperty
(
value
=
"是否已删除"
)
private
String
boolDelete
;
}
src/main/java/com/pms/ocp/service/ModelRelationService.java
0 → 100644
View file @
12ceff04
package
com.pms.ocp.service
;
import
com.pms.ocp.model.dto.ModelRelationDTO
;
import
com.pms.ocp.model.entity.ModelRelation
;
import
com.pms.ocp.model.vo.ModelRelationVO
;
import
java.util.List
;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:07
* @Description:模型关系业务层接口
*/
public
interface
ModelRelationService
{
/**
* 创建模型关系
*
* @param modelRelationDTO
* @return
*/
Integer
createModelRelation
(
ModelRelationDTO
modelRelationDTO
);
/**
* 删除模型关系
*
* @param objId
* @param modelCode
* @return
*/
Integer
deleteModelRelation
(
String
objId
,
String
modelCode
);
/**
* 批量删除模型关系
*
* @param ids
* @return
*/
Integer
deletePatchModelRelation
(
List
<
String
>
ids
);
/**
* 更新模型关系
*
* @param modelRelation
* @return
*/
Integer
updateModelRelation
(
ModelRelation
modelRelation
);
/**
* 获取模型关系
*
* @param
* @return
*/
List
<
ModelRelation
>
getModelRelationList
(
String
objId
,
String
modelCode
);
/**
* 获取模型关系列表
*
* @param modelId
* @return
*/
ModelRelationVO
getModelRelation
(
String
modelId
);
}
src/main/java/com/pms/ocp/service/impl/ModelRelationServiceImpl.java
0 → 100644
View file @
12ceff04
package
com.pms.ocp.service.impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.pms.ocp.mapper.ModelRelationMapper
;
import
com.pms.ocp.model.dto.ModelRelationDTO
;
import
com.pms.ocp.model.entity.ModelIssue
;
import
com.pms.ocp.model.entity.ModelRelation
;
import
com.pms.ocp.model.vo.ModelRelationVO
;
import
com.pms.ocp.service.ModelRelationService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.util.List
;
/**
* @Auther: wangjian
* @Date: 2022/3/10 19:34
* @Description:
*/
@Service
public
class
ModelRelationServiceImpl
implements
ModelRelationService
{
@Autowired
private
ModelRelationMapper
modelRelationMapper
;
@Override
public
Integer
createModelRelation
(
ModelRelationDTO
modelRelationDTO
)
{
ModelRelation
modelRelation
=
new
ModelRelation
();
BeanUtils
.
copyProperties
(
modelRelationDTO
,
modelRelation
);
modelRelation
.
setModelCtime
(
LocalDateTime
.
now
());
return
modelRelationMapper
.
insert
(
modelRelation
);
}
@Override
public
Integer
deleteModelRelation
(
String
objId
,
String
modelCode
)
{
QueryWrapper
<
ModelRelation
>
queryWrapper
=
new
QueryWrapper
();
if
(
StringUtils
.
isNotEmpty
(
objId
))
{
queryWrapper
.
lambda
().
eq
(
ModelRelation:
:
getObjId
,
objId
);
}
if
(
StringUtils
.
isNotEmpty
(
modelCode
))
{
queryWrapper
.
lambda
().
eq
(
ModelRelation:
:
getModelCode
,
modelCode
);
}
return
modelRelationMapper
.
delete
(
queryWrapper
);
}
@Override
public
Integer
deletePatchModelRelation
(
List
<
String
>
ids
)
{
return
modelRelationMapper
.
deleteBatchIds
(
ids
);
}
@Override
public
Integer
updateModelRelation
(
ModelRelation
modelRelation
)
{
return
null
;
}
@Override
public
List
<
ModelRelation
>
getModelRelationList
(
String
objId
,
String
modelCode
)
{
QueryWrapper
<
ModelRelation
>
queryWrapper
=
new
QueryWrapper
();
if
(
StringUtils
.
isNotEmpty
(
objId
))
{
queryWrapper
.
lambda
().
eq
(
ModelRelation:
:
getObjId
,
objId
);
}
if
(
StringUtils
.
isNotEmpty
(
modelCode
))
{
queryWrapper
.
lambda
().
eq
(
ModelRelation:
:
getModelCode
,
modelCode
);
}
return
modelRelationMapper
.
selectList
(
queryWrapper
);
}
@Override
public
ModelRelationVO
getModelRelation
(
String
modelId
)
{
return
null
;
}
}
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