Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zhny
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王夏晖
zhny
Commits
d3a70c95
Commit
d3a70c95
authored
May 04, 2018
by
王夏晖
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备参数模板后台管理
parent
d9e3b2e8
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
306 additions
and
2 deletions
+306
-2
BusDeviceParamController.java
.../business/manage/controller/BusDeviceParamController.java
+68
-0
BusDevicetpParamController.java
...usiness/manage/controller/BusDevicetpParamController.java
+0
-1
BusDeviceParamRepository.java
...rcisoft/business/manage/dao/BusDeviceParamRepository.java
+36
-0
BusDeviceParam.java
...va/org/rcisoft/business/manage/entity/BusDeviceParam.java
+35
-0
BusDeviceParamService.java
...cisoft/business/manage/service/BusDeviceParamService.java
+43
-0
BusDeviceParamServiceImpl.java
...siness/manage/service/impl/BusDeviceParamServiceImpl.java
+95
-0
BusDevicetpParamServiceImpl.java
...ness/manage/service/impl/BusDevicetpParamServiceImpl.java
+0
-1
BusDeviceParamList.java
...va/org/rcisoft/business/manage/vo/BusDeviceParamList.java
+17
-0
BusDeviceParamMapper.xml
...sources/mapper/sys/manage.mapper/BusDeviceParamMapper.xml
+12
-0
BusDeviceTpMapper.xml
.../resources/mapper/sys/manage.mapper/BusDeviceTpMapper.xml
+0
-0
BusDevicetpParamMapper.xml
...urces/mapper/sys/manage.mapper/BusDevicetpParamMapper.xml
+0
-0
No files found.
src/main/java/org/rcisoft/business/manage/controller/BusDeviceParamController.java
0 → 100644
View file @
d3a70c95
package
org
.
rcisoft
.
business
.
manage
.
controller
;
/*固定导入*/
import
io.swagger.annotations.ApiOperation
;
import
org.rcisoft.business.manage.entity.BusDeviceParam
;
import
org.rcisoft.business.manage.service.BusDeviceParamService
;
import
org.rcisoft.business.manage.vo.BusDeviceParamList
;
import
org.rcisoft.core.constant.MessageConstant
;
import
org.rcisoft.core.controller.PaginationController
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.result.Result
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by on 2018-5-2 16:09:29.
*/
@RestController
@RequestMapping
(
"manage/busdeviceparam"
)
public
class
BusDeviceParamController
extends
PaginationController
<
BusDeviceParam
>
{
@Autowired
private
BusDeviceParamService
busDeviceParamServiceImpl
;
@ApiOperation
(
value
=
"添加设备参数模板"
,
notes
=
"添加设备参数模板"
)
@PostMapping
(
value
=
"/add"
)
public
Result
add
(
@Valid
BusDeviceParamList
busDeviceParamList
)
{
PersistModel
data
=
busDeviceParamServiceImpl
.
save
(
busDeviceParamList
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busDeviceParamList
);
}
@ApiOperation
(
value
=
"修改设备参数模板"
,
notes
=
"修改设备参数模板"
)
@PutMapping
(
"/update"
)
public
Result
update
(
@Valid
BusDeviceParamList
busDeviceParamList
)
{
PersistModel
data
=
busDeviceParamServiceImpl
.
merge
(
busDeviceParamList
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busDeviceParamList
);
}
@ApiOperation
(
value
=
"删除设备参数模板"
,
notes
=
"删除设备参数模板"
)
@PutMapping
(
"/delete"
)
public
Result
delete
(
@RequestParam
String
devNum
)
{
PersistModel
data
=
busDeviceParamServiceImpl
.
delete
(
devNum
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
devNum
);
}
@ApiOperation
(
value
=
"查看单个设备的参数模板"
,
notes
=
"查看单个设备的参数模板"
)
@GetMapping
(
"/detail"
)
public
List
<
Map
<
String
,
Object
>>
detail
(
@RequestParam
String
devNum
,
@RequestParam
String
proId
)
{
return
busDeviceParamServiceImpl
.
findByDev
(
devNum
,
proId
);
}
}
src/main/java/org/rcisoft/business/manage/controller/BusDevicetpParamController.java
View file @
d3a70c95
...
...
@@ -11,7 +11,6 @@ import org.rcisoft.core.controller.PaginationController;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.result.Result
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
...
src/main/java/org/rcisoft/business/manage/dao/BusDeviceParamRepository.java
0 → 100644
View file @
d3a70c95
package
org
.
rcisoft
.
business
.
manage
.
dao
;
import
org.apache.ibatis.annotations.Select
;
import
org.rcisoft.business.manage.entity.BusDeviceParam
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created with on 2018-5-2 16:09:29.
*/
@Repository
public
interface
BusDeviceParamRepository
extends
BaseMapper
<
BusDeviceParam
>
{
/**
* 根据设备编号查询参数模板
* @param map
* @return
*/
@Select
(
"<script>select a.*,b.PARAM_NM from bus_device_param a,bus_devicetp_param b where a.PARAM_CODE = b.PARAM_CODE"
+
" and b.PRO_ID = #{pro_id} and a.DEV_NUM = #{dev_num}"
+
"</script>"
)
List
<
Map
<
String
,
Object
>>
detail
(
Map
<
String
,
Object
>
map
);
/**
* 查询设备是否有参数库模板,存在的话无法删除设备模板
* @param map
* @return
*/
@Select
(
"<script>select * from bus_library_param where dev_num = #{dev_num}"
+
"</script>"
)
List
<
Map
<
String
,
Object
>>
queryLibraryParamByDev
(
Map
<
String
,
Object
>
map
);
}
src/main/java/org/rcisoft/business/manage/entity/BusDeviceParam.java
0 → 100644
View file @
d3a70c95
package
org
.
rcisoft
.
business
.
manage
.
entity
;
import
lombok.*
;
import
org.rcisoft.core.entity.IdNotDataEntity
;
import
javax.persistence.*
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* Created with on 2018-5-2 16:09:29.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"bus_device_param"
)
public
class
BusDeviceParam
{
private
String
id
;
private
String
devNum
;
private
String
param
;
private
String
paramCode
;
}
src/main/java/org/rcisoft/business/manage/service/BusDeviceParamService.java
0 → 100644
View file @
d3a70c95
package
org
.
rcisoft
.
business
.
manage
.
service
;
import
org.rcisoft.business.manage.entity.BusDeviceParam
;
import
org.rcisoft.business.manage.vo.BusDeviceParamList
;
import
org.rcisoft.core.model.PersistModel
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by on 2018-5-2 16:09:29.
*/
public
interface
BusDeviceParamService
{
/**
* 保存
* @return
*/
PersistModel
save
(
BusDeviceParamList
busDeviceParamList
);
/**
* 删除
* @return
*/
PersistModel
delete
(
String
devNum
);
/**
* 修改
* @return
*/
PersistModel
merge
(
BusDeviceParamList
busDeviceParamList
);
/**
* 根据设备编号查询设备参数模板
* @return
*/
List
<
Map
<
String
,
Object
>>
findByDev
(
String
devid
,
String
proid
);
}
src/main/java/org/rcisoft/business/manage/service/impl/BusDeviceParamServiceImpl.java
0 → 100644
View file @
d3a70c95
package
org
.
rcisoft
.
business
.
manage
.
service
.
impl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.business.manage.dao.BusDeviceParamRepository
;
import
org.rcisoft.business.manage.entity.BusDeviceParam
;
import
org.rcisoft.business.manage.service.BusDeviceParamService
;
import
org.rcisoft.business.manage.vo.BusDeviceParamList
;
import
org.rcisoft.core.model.PersistModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Isolation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
/**
* Created by on 2018-5-2 16:09:29.
*/
@Service
@Transactional
(
readOnly
=
true
,
propagation
=
Propagation
.
NOT_SUPPORTED
)
@Slf4j
public
class
BusDeviceParamServiceImpl
implements
BusDeviceParamService
{
@Autowired
private
BusDeviceParamRepository
busDeviceParamRepository
;
/**
* 保存 busDeviceParam
* @return
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@Override
public
PersistModel
save
(
BusDeviceParamList
busDeviceParamList
){
int
line
=
0
;
List
<
BusDeviceParam
>
list
=
busDeviceParamList
.
getBusDeviceParamList
();
for
(
BusDeviceParam
bp
:
list
){
bp
.
setId
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
line
=
busDeviceParamRepository
.
insertSelective
(
bp
);
}
return
new
PersistModel
(
line
);
}
/**
* 删除
* @return
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@Override
public
PersistModel
delete
(
String
devNum
){
int
line
=
0
;
Example
example
=
new
Example
(
BusDeviceParam
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"devNum"
,
devNum
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"dev_num"
,
devNum
);
if
(
busDeviceParamRepository
.
queryLibraryParamByDev
(
map
)==
null
||
busDeviceParamRepository
.
queryLibraryParamByDev
(
map
).
size
()<
1
){
line
=
busDeviceParamRepository
.
deleteByExample
(
example
);
}
return
new
PersistModel
(
line
);
}
/**
* 修改 busDeviceParam
* @return
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@Override
public
PersistModel
merge
(
BusDeviceParamList
busDeviceParamList
){
int
line
=
0
;
PersistModel
pm
=
delete
(
busDeviceParamList
.
getBusDeviceParamList
().
get
(
0
).
getDevNum
());
if
(
pm
.
isSuccessBySinglePersist
()){
return
save
(
busDeviceParamList
);
}
return
new
PersistModel
(
line
);
}
/**
* 根据设备编号查询参数模板
* @return
*/
public
List
<
Map
<
String
,
Object
>>
findByDev
(
String
devNum
,
String
proid
){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"dev_num"
,
devNum
);
map
.
put
(
"pro_id"
,
proid
);
return
busDeviceParamRepository
.
detail
(
map
);
}
}
src/main/java/org/rcisoft/business/manage/service/impl/BusDevicetpParamServiceImpl.java
View file @
d3a70c95
...
...
@@ -2,7 +2,6 @@ package org.rcisoft.business.manage.service.impl;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.business.manage.dao.BusDevicetpParamRepository
;
import
org.rcisoft.business.manage.entity.BusDeviceTp
;
import
org.rcisoft.business.manage.entity.BusDevicetpParam
;
import
org.rcisoft.business.manage.service.BusDevicetpParamService
;
import
org.rcisoft.business.manage.vo.BusDevicetpParamList
;
...
...
src/main/java/org/rcisoft/business/manage/vo/BusDeviceParamList.java
0 → 100644
View file @
d3a70c95
package
org
.
rcisoft
.
business
.
manage
.
vo
;
import
org.rcisoft.business.manage.entity.BusDeviceParam
;
import
java.util.List
;
public
class
BusDeviceParamList
{
private
List
<
BusDeviceParam
>
busDeviceParamList
;
public
List
<
BusDeviceParam
>
getBusDeviceParamList
()
{
return
busDeviceParamList
;
}
public
void
setBusDeviceParamList
(
List
<
BusDeviceParam
>
busDeviceParamList
)
{
this
.
busDeviceParamList
=
busDeviceParamList
;
}
}
src/main/resources/mapper/sys/manage.mapper/BusDeviceParamMapper.xml
0 → 100644
View file @
d3a70c95
<?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=
"org.rcisoft.business.manage.dao.BusDeviceParamRepository"
>
<resultMap
id=
"BaseResultMap"
type=
"org.rcisoft.business.manage.entity.BusDeviceParam"
>
<id
column=
"ID"
jdbcType=
"VARCHAR"
property=
"id"
/>
<result
column=
"DEV_NUM"
jdbcType=
"VARCHAR"
property=
"devNum"
/>
<result
column=
"PARAM"
jdbcType=
"VARCHAR"
property=
"param"
/>
<result
column=
"PARAM_CODE"
jdbcType=
"VARCHAR"
property=
"paramCode"
/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
src/main/resources/mapper/sys/ma
inte/fault
.mapper/BusDeviceTpMapper.xml
→
src/main/resources/mapper/sys/ma
nage
.mapper/BusDeviceTpMapper.xml
View file @
d3a70c95
File moved
src/main/resources/mapper/sys/ma
inte/fault
.mapper/BusDevicetpParamMapper.xml
→
src/main/resources/mapper/sys/ma
nage
.mapper/BusDevicetpParamMapper.xml
View file @
d3a70c95
File moved
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