Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Z
zh-mes-device-data-process
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
zh-mes-device-data-process
Commits
5a51c8b4
Commit
5a51c8b4
authored
May 29, 2025
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
扫码结果解析及同步
parent
79d410d2
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1262 additions
and
10 deletions
+1262
-10
pom.xml
pom.xml
+16
-0
FastJson2JsonRedisSerializer.java
.../java/com/zehong/config/FastJson2JsonRedisSerializer.java
+72
-0
RedisConfig.java
src/main/java/com/zehong/config/RedisConfig.java
+50
-0
MesDeviceDataConstant.java
src/main/java/com/zehong/constant/MesDeviceDataConstant.java
+19
-0
PCBACodeRules.java
src/main/java/com/zehong/constant/PCBACodeRules.java
+32
-0
ScanCodeResultController.java
.../java/com/zehong/controller/ScanCodeResultController.java
+27
-0
PCBADevicesMapper.java
src/main/java/com/zehong/dao/PCBADevicesMapper.java
+28
-0
PCBADevices.java
src/main/java/com/zehong/entity/PCBADevices.java
+56
-1
ScanCodeResultService.java
src/main/java/com/zehong/service/ScanCodeResultService.java
+14
-0
AoiTestResultServiceImpl.java
...ava/com/zehong/service/impl/AoiTestResultServiceImpl.java
+6
-7
ScanCodeResultServiceImpl.java
...va/com/zehong/service/impl/ScanCodeResultServiceImpl.java
+164
-0
RedisCache.java
src/main/java/com/zehong/utils/RedisCache.java
+231
-0
StringUtils.java
src/main/java/com/zehong/utils/StringUtils.java
+432
-0
application-prd.yml
src/main/resources/application-prd.yml
+22
-1
application-test.yml
src/main/resources/application-test.yml
+22
-1
PCBADevicesMapper.xml
src/main/resources/mapper/PCBADevicesMapper.xml
+71
-0
No files found.
pom.xml
View file @
5a51c8b4
...
@@ -84,6 +84,22 @@
...
@@ -84,6 +84,22 @@
<version>
1.2.76
</version>
<version>
1.2.76
</version>
</dependency>
</dependency>
<!-- redis 缓存操作 -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
<exclusions>
<exclusion>
<groupId>
io.lettuce
</groupId>
<artifactId>
lettuce-core
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
redis.clients
</groupId>
<artifactId>
jedis
</artifactId>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/java/com/zehong/config/FastJson2JsonRedisSerializer.java
0 → 100644
View file @
5a51c8b4
package
com
.
zehong
.
config
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.parser.ParserConfig
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.fasterxml.jackson.databind.JavaType
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.type.TypeFactory
;
import
org.springframework.data.redis.serializer.RedisSerializer
;
import
org.springframework.data.redis.serializer.SerializationException
;
import
org.springframework.util.Assert
;
import
java.nio.charset.Charset
;
/**
* Redis使用FastJson序列化
*
* @author zehong
*/
public
class
FastJson2JsonRedisSerializer
<
T
>
implements
RedisSerializer
<
T
>
{
@SuppressWarnings
(
"unused"
)
private
ObjectMapper
objectMapper
=
new
ObjectMapper
();
public
static
final
Charset
DEFAULT_CHARSET
=
Charset
.
forName
(
"UTF-8"
);
private
Class
<
T
>
clazz
;
static
{
ParserConfig
.
getGlobalInstance
().
setAutoTypeSupport
(
true
);
}
public
FastJson2JsonRedisSerializer
(
Class
<
T
>
clazz
)
{
super
();
this
.
clazz
=
clazz
;
}
@Override
public
byte
[]
serialize
(
T
t
)
throws
SerializationException
{
if
(
t
==
null
)
{
return
new
byte
[
0
];
}
return
JSON
.
toJSONString
(
t
,
SerializerFeature
.
WriteClassName
).
getBytes
(
DEFAULT_CHARSET
);
}
@Override
public
T
deserialize
(
byte
[]
bytes
)
throws
SerializationException
{
if
(
bytes
==
null
||
bytes
.
length
<=
0
)
{
return
null
;
}
String
str
=
new
String
(
bytes
,
DEFAULT_CHARSET
);
return
JSON
.
parseObject
(
str
,
clazz
);
}
public
void
setObjectMapper
(
ObjectMapper
objectMapper
)
{
Assert
.
notNull
(
objectMapper
,
"'objectMapper' must not be null"
);
this
.
objectMapper
=
objectMapper
;
}
protected
JavaType
getJavaType
(
Class
<?>
clazz
)
{
return
TypeFactory
.
defaultInstance
().
constructType
(
clazz
);
}
}
src/main/java/com/zehong/config/RedisConfig.java
0 → 100644
View file @
5a51c8b4
package
com
.
zehong
.
config
;
import
com.fasterxml.jackson.annotation.JsonAutoDetect
;
import
com.fasterxml.jackson.annotation.JsonTypeInfo
;
import
com.fasterxml.jackson.annotation.PropertyAccessor
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator
;
import
org.springframework.cache.annotation.CachingConfigurerSupport
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.serializer.StringRedisSerializer
;
/**
* redis配置
*
* @author zehong
*/
@Configuration
@EnableCaching
public
class
RedisConfig
extends
CachingConfigurerSupport
{
@Bean
@SuppressWarnings
(
value
=
{
"unchecked"
,
"rawtypes"
})
public
RedisTemplate
<
Object
,
Object
>
redisTemplate
(
RedisConnectionFactory
connectionFactory
)
{
RedisTemplate
<
Object
,
Object
>
template
=
new
RedisTemplate
<>();
template
.
setConnectionFactory
(
connectionFactory
);
FastJson2JsonRedisSerializer
serializer
=
new
FastJson2JsonRedisSerializer
(
Object
.
class
);
ObjectMapper
mapper
=
new
ObjectMapper
();
mapper
.
setVisibility
(
PropertyAccessor
.
ALL
,
JsonAutoDetect
.
Visibility
.
ANY
);
mapper
.
activateDefaultTyping
(
LaissezFaireSubTypeValidator
.
instance
,
ObjectMapper
.
DefaultTyping
.
NON_FINAL
,
JsonTypeInfo
.
As
.
PROPERTY
);
serializer
.
setObjectMapper
(
mapper
);
// 使用StringRedisSerializer来序列化和反序列化redis的key值
template
.
setKeySerializer
(
new
StringRedisSerializer
());
template
.
setValueSerializer
(
serializer
);
// Hash的key也采用StringRedisSerializer的序列化方式
template
.
setHashKeySerializer
(
new
StringRedisSerializer
());
template
.
setHashValueSerializer
(
serializer
);
template
.
afterPropertiesSet
();
return
template
;
}
}
src/main/java/com/zehong/constant/MesDeviceDataConstant.java
0 → 100644
View file @
5a51c8b4
package
com
.
zehong
.
constant
;
/**
* 设备数据接收项目常量类
* @author geng
* @since 2025-05-28
*/
public
class
MesDeviceDataConstant
{
/**
* 设备对接 redis 前缀
*/
public
static
final
String
EQUIPMENT_DOCKING
=
"equipment_docking"
;
/**
* pcba device key
*/
public
static
final
String
PCBA_DEVICE_KEY
=
"pcba_device_key"
;
}
src/main/java/com/zehong/constant/PCBACodeRules.java
0 → 100644
View file @
5a51c8b4
package
com
.
zehong
.
constant
;
/**
* pcba扫码规则
*/
public
enum
PCBACodeRules
{
/**
* 卡批次码
*/
CARDBATCHCODE
(
"(SL|SD|SY|QL|QD|QY)\\d{9}"
),
/**
* 主板码
*/
MAINBOARDCODE
(
"PCBA\\d{14}"
),
/**
* 传感器批次码
*/
SENSORBATCHCODE
(
"SEN\\d{9}"
);
private
String
regex
;
PCBACodeRules
(
String
regex
)
{
this
.
regex
=
regex
;
}
public
String
getRegex
()
{
return
regex
;
}
}
src/main/java/com/zehong/controller/ScanCodeResultController.java
0 → 100644
View file @
5a51c8b4
package
com
.
zehong
.
controller
;
import
com.zehong.entity.AjaxResult
;
import
com.zehong.service.ScanCodeResultService
;
import
org.springframework.beans.factory.annotation.Autowired
;
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
;
/**
* 扫码结果
* @author geng
* @since 2025-05-27
*/
@RestController
@RequestMapping
(
"/scan"
)
public
class
ScanCodeResultController
extends
BaseController
{
@Autowired
private
ScanCodeResultService
scanCodeResultService
;
@PostMapping
(
"/scanCode"
)
public
AjaxResult
scanCode
(
@RequestBody
String
message
)
{
return
toAjax
(
scanCodeResultService
.
scanCodeResult
(
message
));
}
}
src/main/java/com/zehong/dao/
AoiTestResult
Mapper.java
→
src/main/java/com/zehong/dao/
PCBADevices
Mapper.java
View file @
5a51c8b4
package
com
.
zehong
.
dao
;
package
com
.
zehong
.
dao
;
import
com.zehong.entity.P
cba
Devices
;
import
com.zehong.entity.P
CBA
Devices
;
import
java.util.List
;
import
java.util.List
;
public
interface
AoiTestResult
Mapper
{
public
interface
PCBADevices
Mapper
{
/**
/**
* 根据主板号查询设备信息
* 根据主板号查询设备信息
* @param motherboardCode 主板吗
* @param motherboardCode 主板吗
* @return
* @return
*/
*/
List
<
P
cba
Devices
>
selectPcbaDeviceInfoByBoardCode
(
String
motherboardCode
);
List
<
P
CBA
Devices
>
selectPcbaDeviceInfoByBoardCode
(
String
motherboardCode
);
/**
/**
* 更新设备信息
* 更新设备信息
* @param devices 设备信息
* @param devices 设备信息
* @return
* @return
*/
*/
int
updatePcbaDeviceInfo
(
PcbaDevices
devices
);
int
updatePcbaDeviceInfo
(
PCBADevices
devices
);
/**
* 新增设备信息
* @param devices 设备信息
* @return
*/
int
insertPcbaDevices
(
PCBADevices
devices
);
}
}
src/main/java/com/zehong/entity/P
cba
Devices.java
→
src/main/java/com/zehong/entity/P
CBA
Devices.java
View file @
5a51c8b4
package
com
.
zehong
.
entity
;
package
com
.
zehong
.
entity
;
public
class
PcbaDevices
{
import
java.util.Date
;
public
class
PCBADevices
{
/** id */
/** id */
private
Long
pcbaDevicesId
;
private
Long
pcbaDevicesId
;
...
@@ -17,6 +19,19 @@ public class PcbaDevices {
...
@@ -17,6 +19,19 @@ public class PcbaDevices {
/**aoi检测结果*/
/**aoi检测结果*/
private
String
aoiDetectionResult
;
private
String
aoiDetectionResult
;
/** 物联网卡批次号 */
private
String
iotCardBatchNumber
;
/** 传感器码 */
private
String
sensorCode
;
/** NB码 */
private
String
nbCode
;
private
Long
materialInfoId
;
private
Date
createTime
;
public
Long
getPcbaDevicesId
()
{
public
Long
getPcbaDevicesId
()
{
return
pcbaDevicesId
;
return
pcbaDevicesId
;
}
}
...
@@ -56,4 +71,44 @@ public class PcbaDevices {
...
@@ -56,4 +71,44 @@ public class PcbaDevices {
public
void
setAoiDetectionResult
(
String
aoiDetectionResult
)
{
public
void
setAoiDetectionResult
(
String
aoiDetectionResult
)
{
this
.
aoiDetectionResult
=
aoiDetectionResult
;
this
.
aoiDetectionResult
=
aoiDetectionResult
;
}
}
public
String
getIotCardBatchNumber
()
{
return
iotCardBatchNumber
;
}
public
void
setIotCardBatchNumber
(
String
iotCardBatchNumber
)
{
this
.
iotCardBatchNumber
=
iotCardBatchNumber
;
}
public
String
getSensorCode
()
{
return
sensorCode
;
}
public
void
setSensorCode
(
String
sensorCode
)
{
this
.
sensorCode
=
sensorCode
;
}
public
String
getNbCode
()
{
return
nbCode
;
}
public
void
setNbCode
(
String
nbCode
)
{
this
.
nbCode
=
nbCode
;
}
public
Long
getMaterialInfoId
()
{
return
materialInfoId
;
}
public
void
setMaterialInfoId
(
Long
materialInfoId
)
{
this
.
materialInfoId
=
materialInfoId
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
}
}
src/main/java/com/zehong/service/ScanCodeResultService.java
0 → 100644
View file @
5a51c8b4
package
com
.
zehong
.
service
;
/**
* 扫码结果
*/
public
interface
ScanCodeResultService
{
/**
* 扫码结果
* @param message 扫码信息
* @return
*/
int
scanCodeResult
(
String
message
);
}
src/main/java/com/zehong/service/impl/AoiTestResultServiceImpl.java
View file @
5a51c8b4
...
@@ -4,14 +4,13 @@ import com.alibaba.fastjson.JSON;
...
@@ -4,14 +4,13 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.zehong.dao.
AoiTestResult
Mapper
;
import
com.zehong.dao.
PCBADevices
Mapper
;
import
com.zehong.entity.P
cba
Devices
;
import
com.zehong.entity.P
CBA
Devices
;
import
com.zehong.service.AoiTestResultService
;
import
com.zehong.service.AoiTestResultService
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.List
;
...
@@ -27,7 +26,7 @@ public class AoiTestResultServiceImpl implements AoiTestResultService{
...
@@ -27,7 +26,7 @@ public class AoiTestResultServiceImpl implements AoiTestResultService{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
AoiTestResultServiceImpl
.
class
);
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
AoiTestResultServiceImpl
.
class
);
@Resource
@Resource
private
AoiTestResultMapper
aoiTestResult
Mapper
;
private
PCBADevicesMapper
pcbaDevices
Mapper
;
/**
/**
* AOI检查结果同步
* AOI检查结果同步
...
@@ -42,12 +41,12 @@ public class AoiTestResultServiceImpl implements AoiTestResultService{
...
@@ -42,12 +41,12 @@ public class AoiTestResultServiceImpl implements AoiTestResultService{
for
(
Object
obj
:
boardData
){
for
(
Object
obj
:
boardData
){
JSONObject
boardInfo
=
(
JSONObject
)
obj
;
JSONObject
boardInfo
=
(
JSONObject
)
obj
;
String
motherboardCode
=
boardInfo
.
getString
(
"board_sn"
);
String
motherboardCode
=
boardInfo
.
getString
(
"board_sn"
);
List
<
P
cbaDevices
>
devices
=
aoiTestResult
Mapper
.
selectPcbaDeviceInfoByBoardCode
(
motherboardCode
);
List
<
P
CBADevices
>
devices
=
pcbaDevices
Mapper
.
selectPcbaDeviceInfoByBoardCode
(
motherboardCode
);
if
(!
CollectionUtils
.
isEmpty
(
devices
)){
if
(!
CollectionUtils
.
isEmpty
(
devices
)){
for
(
P
cba
Devices
device
:
devices
){
for
(
P
CBA
Devices
device
:
devices
){
String
finalResult
=
boardInfo
.
getString
(
"board_final_result"
);
String
finalResult
=
boardInfo
.
getString
(
"board_final_result"
);
device
.
setAoiDetectionResult
(
finalResult
);
device
.
setAoiDetectionResult
(
finalResult
);
insertResult
+=
aoiTestResult
Mapper
.
updatePcbaDeviceInfo
(
device
);
insertResult
+=
pcbaDevices
Mapper
.
updatePcbaDeviceInfo
(
device
);
}
}
}
}
}
}
...
...
src/main/java/com/zehong/service/impl/ScanCodeResultServiceImpl.java
0 → 100644
View file @
5a51c8b4
package
com
.
zehong
.
service
.
impl
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.zehong.constant.MesDeviceDataConstant
;
import
com.zehong.constant.PCBACodeRules
;
import
com.zehong.dao.PCBADevicesMapper
;
import
com.zehong.entity.PCBADevices
;
import
com.zehong.service.ScanCodeResultService
;
import
com.zehong.utils.RedisCache
;
import
com.zehong.utils.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* 扫码结果
*/
@Service
@DS
(
"mes"
)
public
class
ScanCodeResultServiceImpl
implements
ScanCodeResultService
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
ScanCodeResultServiceImpl
.
class
);
@Autowired
private
RedisCache
redisCache
;
@Resource
private
PCBADevicesMapper
pcbaDevicesMapper
;
/**
* 扫码规则
*/
private
final
Map
<
String
,
Pattern
>
rules
=
new
HashMap
<>();
{
for
(
PCBACodeRules
rule:
PCBACodeRules
.
values
()){
rules
.
put
(
rule
.
name
(),
Pattern
.
compile
(
rule
.
getRegex
()));
}
}
/**
* 扫码结果
* @param message 扫码信息
* @return
*/
@Override
public
int
scanCodeResult
(
String
message
)
{
log
.
info
(
"扫码结果字符串========="
+
message
);
//解析字符串
Map
<
String
,
Object
>
analysisResult
=
analysis
(
message
);
//数据处理
return
dealStrategy
(
analysisResult
);
}
/**
* 解析扫码结果
* @param message
*/
private
Map
<
String
,
Object
>
analysis
(
String
message
){
Map
<
String
,
Object
>
analysisResult
=
new
HashMap
<>();
for
(
Map
.
Entry
<
String
,
Pattern
>
rule
:
rules
.
entrySet
()){
List
<
String
>
codes
=
new
ArrayList
<>();
Matcher
m
=
rule
.
getValue
().
matcher
(
message
);
while
(
m
.
find
()){
String
code
=
m
.
group
();
codes
.
add
(
code
);
message
=
message
.
replace
(
code
,
""
);
}
if
(!
CollectionUtils
.
isEmpty
(
codes
))
analysisResult
.
put
(
rule
.
getKey
(),
codes
);
}
//nb码无规则
if
(
StringUtils
.
isNotEmpty
(
message
))
analysisResult
.
put
(
"nbCode"
,
message
);
return
analysisResult
;
}
/**
* 处理策略
* @param analysisResult
*/
private
int
dealStrategy
(
Map
<
String
,
Object
>
analysisResult
){
// NB码 + 卡批次码
if
(
analysisResult
.
containsKey
(
"nbCode"
)
&&
analysisResult
.
containsKey
(
PCBACodeRules
.
CARDBATCHCODE
.
name
())){
return
addNbAndCardCode
(
analysisResult
);
}
// 主板码 + 传感器批次码
if
(
analysisResult
.
containsKey
(
PCBACodeRules
.
MAINBOARDCODE
.
name
())
&&
analysisResult
.
containsKey
(
PCBACodeRules
.
SENSORBATCHCODE
.
name
())){
return
addMainBoardCodeAndSensorBatchCode
(
analysisResult
);
}
//主板码 + NB码
if
(
analysisResult
.
containsKey
(
PCBACodeRules
.
MAINBOARDCODE
.
name
())
&&
analysisResult
.
containsKey
(
"nbCode"
)){
return
updateMainBoardCodeAndNb
(
analysisResult
);
}
return
0
;
}
/**
* 新增nb+卡批次码
* @param analysisResult
* @return
*/
public
int
addNbAndCardCode
(
Map
<
String
,
Object
>
analysisResult
){
Map
<
String
,
Object
>
cache
=
redisCache
.
getCacheMap
(
MesDeviceDataConstant
.
EQUIPMENT_DOCKING
+
":"
+
MesDeviceDataConstant
.
PCBA_DEVICE_KEY
);
if
(
null
!=
cache
){
PCBADevices
devices
=
new
PCBADevices
();
devices
.
setMotherboardCode
(
analysisResult
.
get
(
"nbCode"
).
toString
());
List
<
String
>
codes
=
(
List
<
String
>)
analysisResult
.
get
(
PCBACodeRules
.
CARDBATCHCODE
.
name
());
devices
.
setIotCardBatchNumber
(
codes
.
get
(
0
));
devices
.
setPcbaProductionTasksNumber
(
cache
.
get
(
"pcbaProductionTasksNumber"
).
toString
());
devices
.
setMaterialInfoId
((
Long
)
cache
.
get
(
"materialInfoId"
));
devices
.
setCreateTime
(
new
Date
());
return
pcbaDevicesMapper
.
insertPcbaDevices
(
devices
);
}
return
0
;
}
/**
* 新增主板码+传感器批次码
* @param analysisResult
* @return
*/
public
int
addMainBoardCodeAndSensorBatchCode
(
Map
<
String
,
Object
>
analysisResult
){
Map
<
String
,
Object
>
cache
=
redisCache
.
getCacheMap
(
MesDeviceDataConstant
.
EQUIPMENT_DOCKING
+
":"
+
MesDeviceDataConstant
.
PCBA_DEVICE_KEY
);
if
(
null
!=
cache
){
PCBADevices
devices
=
new
PCBADevices
();
List
<
String
>
mainCodes
=
(
List
<
String
>)
analysisResult
.
get
(
PCBACodeRules
.
MAINBOARDCODE
.
name
());
devices
.
setMotherboardCode
(
mainCodes
.
get
(
0
));
List
<
String
>
sensorCodes
=
(
List
<
String
>)
analysisResult
.
get
(
PCBACodeRules
.
SENSORBATCHCODE
.
name
());
devices
.
setSensorCode
(
sensorCodes
.
get
(
0
));
devices
.
setPcbaProductionTasksNumber
(
cache
.
get
(
"pcbaProductionTasksNumber"
).
toString
());
devices
.
setMaterialInfoId
((
Long
)
cache
.
get
(
"materialInfoId"
));
devices
.
setCreateTime
(
new
Date
());
return
pcbaDevicesMapper
.
insertPcbaDevices
(
devices
);
}
return
0
;
}
/**
* 修改主板码和nb码
* @param analysisResult
* @return
*/
public
int
updateMainBoardCodeAndNb
(
Map
<
String
,
Object
>
analysisResult
){
Map
<
String
,
Object
>
cache
=
redisCache
.
getCacheMap
(
MesDeviceDataConstant
.
EQUIPMENT_DOCKING
+
":"
+
MesDeviceDataConstant
.
PCBA_DEVICE_KEY
);
if
(
null
!=
cache
){
PCBADevices
devices
=
new
PCBADevices
();
List
<
String
>
mainCodes
=
(
List
<
String
>)
analysisResult
.
get
(
PCBACodeRules
.
MAINBOARDCODE
.
name
());
devices
.
setMotherboardCode
(
mainCodes
.
get
(
0
));
devices
.
setNbCode
(
analysisResult
.
get
(
"nbCode"
).
toString
());
devices
.
setPcbaBatchNumber
(
cache
.
get
(
"pcbaProductionTasksNumber"
).
toString
());
devices
.
setMaterialInfoId
((
Long
)
cache
.
get
(
"materialInfoId"
));
devices
.
setCreateTime
(
new
Date
());
return
pcbaDevicesMapper
.
insertPcbaDevices
(
devices
);
}
return
0
;
}
}
src/main/java/com/zehong/utils/RedisCache.java
0 → 100644
View file @
5a51c8b4
package
com
.
zehong
.
utils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.BoundSetOperations
;
import
org.springframework.data.redis.core.HashOperations
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.ValueOperations
;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
/**
* spring redis 工具类
*
* @author zehong
**/
@SuppressWarnings
(
value
=
{
"unchecked"
,
"rawtypes"
})
@Component
public
class
RedisCache
{
@Autowired
public
RedisTemplate
redisTemplate
;
/**
* 缓存基本的对象,Integer、String、实体类等
*
* @param key 缓存的键值
* @param value 缓存的值
*/
public
<
T
>
void
setCacheObject
(
final
String
key
,
final
T
value
)
{
redisTemplate
.
opsForValue
().
set
(
key
,
value
);
}
/**
* 缓存基本的对象,Integer、String、实体类等
*
* @param key 缓存的键值
* @param value 缓存的值
* @param timeout 时间
* @param timeUnit 时间颗粒度
*/
public
<
T
>
void
setCacheObject
(
final
String
key
,
final
T
value
,
final
Integer
timeout
,
final
TimeUnit
timeUnit
)
{
redisTemplate
.
opsForValue
().
set
(
key
,
value
,
timeout
,
timeUnit
);
}
/**
* 设置有效时间
*
* @param key Redis键
* @param timeout 超时时间
* @return true=设置成功;false=设置失败
*/
public
boolean
expire
(
final
String
key
,
final
long
timeout
)
{
return
expire
(
key
,
timeout
,
TimeUnit
.
SECONDS
);
}
/**
* 设置有效时间
*
* @param key Redis键
* @param timeout 超时时间
* @param unit 时间单位
* @return true=设置成功;false=设置失败
*/
public
boolean
expire
(
final
String
key
,
final
long
timeout
,
final
TimeUnit
unit
)
{
return
redisTemplate
.
expire
(
key
,
timeout
,
unit
);
}
/**
* 获得缓存的基本对象。
*
* @param key 缓存键值
* @return 缓存键值对应的数据
*/
public
<
T
>
T
getCacheObject
(
final
String
key
)
{
ValueOperations
<
String
,
T
>
operation
=
redisTemplate
.
opsForValue
();
return
operation
.
get
(
key
);
}
/**
* 删除单个对象
*
* @param key
*/
public
boolean
deleteObject
(
final
String
key
)
{
return
redisTemplate
.
delete
(
key
);
}
/**
* 删除集合对象
*
* @param collection 多个对象
* @return
*/
public
long
deleteObject
(
final
Collection
collection
)
{
return
redisTemplate
.
delete
(
collection
);
}
/**
* 缓存List数据
*
* @param key 缓存的键值
* @param dataList 待缓存的List数据
* @return 缓存的对象
*/
public
<
T
>
long
setCacheList
(
final
String
key
,
final
List
<
T
>
dataList
)
{
Long
count
=
redisTemplate
.
opsForList
().
rightPushAll
(
key
,
dataList
);
return
count
==
null
?
0
:
count
;
}
/**
* 获得缓存的list对象
*
* @param key 缓存的键值
* @return 缓存键值对应的数据
*/
public
<
T
>
List
<
T
>
getCacheList
(
final
String
key
)
{
return
redisTemplate
.
opsForList
().
range
(
key
,
0
,
-
1
);
}
/**
* 缓存Set
*
* @param key 缓存键值
* @param dataSet 缓存的数据
* @return 缓存数据的对象
*/
public
<
T
>
BoundSetOperations
<
String
,
T
>
setCacheSet
(
final
String
key
,
final
Set
<
T
>
dataSet
)
{
BoundSetOperations
<
String
,
T
>
setOperation
=
redisTemplate
.
boundSetOps
(
key
);
Iterator
<
T
>
it
=
dataSet
.
iterator
();
while
(
it
.
hasNext
())
{
setOperation
.
add
(
it
.
next
());
}
return
setOperation
;
}
/**
* 获得缓存的set
*
* @param key
* @return
*/
public
<
T
>
Set
<
T
>
getCacheSet
(
final
String
key
)
{
return
redisTemplate
.
opsForSet
().
members
(
key
);
}
/**
* 缓存Map
*
* @param key
* @param dataMap
*/
public
<
T
>
void
setCacheMap
(
final
String
key
,
final
Map
<
String
,
T
>
dataMap
)
{
if
(
dataMap
!=
null
)
{
redisTemplate
.
opsForHash
().
putAll
(
key
,
dataMap
);
}
}
/**
* 获得缓存的Map
*
* @param key
* @return
*/
public
<
T
>
Map
<
String
,
T
>
getCacheMap
(
final
String
key
)
{
return
redisTemplate
.
opsForHash
().
entries
(
key
);
}
/**
* 往Hash中存入数据
*
* @param key Redis键
* @param hKey Hash键
* @param value 值
*/
public
<
T
>
void
setCacheMapValue
(
final
String
key
,
final
String
hKey
,
final
T
value
)
{
redisTemplate
.
opsForHash
().
put
(
key
,
hKey
,
value
);
}
/**
* 获取Hash中的数据
*
* @param key Redis键
* @param hKey Hash键
* @return Hash中的对象
*/
public
<
T
>
T
getCacheMapValue
(
final
String
key
,
final
String
hKey
)
{
HashOperations
<
String
,
String
,
T
>
opsForHash
=
redisTemplate
.
opsForHash
();
return
opsForHash
.
get
(
key
,
hKey
);
}
/**
* 获取多个Hash中的数据
*
* @param key Redis键
* @param hKeys Hash键集合
* @return Hash对象集合
*/
public
<
T
>
List
<
T
>
getMultiCacheMapValue
(
final
String
key
,
final
Collection
<
Object
>
hKeys
)
{
return
redisTemplate
.
opsForHash
().
multiGet
(
key
,
hKeys
);
}
/**
* 获得缓存的基本对象列表
*
* @param pattern 字符串前缀
* @return 对象列表
*/
public
Collection
<
String
>
keys
(
final
String
pattern
)
{
return
redisTemplate
.
keys
(
pattern
);
}
}
src/main/java/com/zehong/utils/StringUtils.java
0 → 100644
View file @
5a51c8b4
package
com
.
zehong
.
utils
;
import
java.util.*
;
/**
* 字符串工具类
*
* @author zehong
*/
public
class
StringUtils
extends
org
.
apache
.
commons
.
lang3
.
StringUtils
{
/** 空字符串 */
private
static
final
String
NULLSTR
=
""
;
/** 下划线 */
private
static
final
char
SEPARATOR
=
'_'
;
/**
* 获取参数不为空值
*
* @param value defaultValue 要判断的value
* @return value 返回值
*/
public
static
<
T
>
T
nvl
(
T
value
,
T
defaultValue
)
{
return
value
!=
null
?
value
:
defaultValue
;
}
/**
* * 判断一个Collection是否为空, 包含List,Set,Queue
*
* @param coll 要判断的Collection
* @return true:为空 false:非空
*/
public
static
boolean
isEmpty
(
Collection
<?>
coll
)
{
return
isNull
(
coll
)
||
coll
.
isEmpty
();
}
/**
* * 判断一个Collection是否非空,包含List,Set,Queue
*
* @param coll 要判断的Collection
* @return true:非空 false:空
*/
public
static
boolean
isNotEmpty
(
Collection
<?>
coll
)
{
return
!
isEmpty
(
coll
);
}
/**
* * 判断一个对象数组是否为空
*
* @param objects 要判断的对象数组
** @return true:为空 false:非空
*/
public
static
boolean
isEmpty
(
Object
[]
objects
)
{
return
isNull
(
objects
)
||
(
objects
.
length
==
0
);
}
/**
* * 判断一个对象数组是否非空
*
* @param objects 要判断的对象数组
* @return true:非空 false:空
*/
public
static
boolean
isNotEmpty
(
Object
[]
objects
)
{
return
!
isEmpty
(
objects
);
}
/**
* * 判断一个Map是否为空
*
* @param map 要判断的Map
* @return true:为空 false:非空
*/
public
static
boolean
isEmpty
(
Map
<?,
?>
map
)
{
return
isNull
(
map
)
||
map
.
isEmpty
();
}
/**
* * 判断一个Map是否为空
*
* @param map 要判断的Map
* @return true:非空 false:空
*/
public
static
boolean
isNotEmpty
(
Map
<?,
?>
map
)
{
return
!
isEmpty
(
map
);
}
/**
* * 判断一个字符串是否为空串
*
* @param str String
* @return true:为空 false:非空
*/
public
static
boolean
isEmpty
(
String
str
)
{
return
isNull
(
str
)
||
NULLSTR
.
equals
(
str
.
trim
());
}
/**
* * 判断一个字符串是否为非空串
*
* @param str String
* @return true:非空串 false:空串
*/
public
static
boolean
isNotEmpty
(
String
str
)
{
return
!
isEmpty
(
str
);
}
/**
* * 判断一个对象是否为空
*
* @param object Object
* @return true:为空 false:非空
*/
public
static
boolean
isNull
(
Object
object
)
{
return
object
==
null
;
}
/**
* * 判断一个对象是否非空
*
* @param object Object
* @return true:非空 false:空
*/
public
static
boolean
isNotNull
(
Object
object
)
{
return
!
isNull
(
object
);
}
/**
* * 判断一个对象是否是数组类型(Java基本型别的数组)
*
* @param object 对象
* @return true:是数组 false:不是数组
*/
public
static
boolean
isArray
(
Object
object
)
{
return
isNotNull
(
object
)
&&
object
.
getClass
().
isArray
();
}
/**
* 去空格
*/
public
static
String
trim
(
String
str
)
{
return
(
str
==
null
?
""
:
str
.
trim
());
}
/**
* 截取字符串
*
* @param str 字符串
* @param start 开始
* @return 结果
*/
public
static
String
substring
(
final
String
str
,
int
start
)
{
if
(
str
==
null
)
{
return
NULLSTR
;
}
if
(
start
<
0
)
{
start
=
str
.
length
()
+
start
;
}
if
(
start
<
0
)
{
start
=
0
;
}
if
(
start
>
str
.
length
())
{
return
NULLSTR
;
}
return
str
.
substring
(
start
);
}
/**
* 截取字符串
*
* @param str 字符串
* @param start 开始
* @param end 结束
* @return 结果
*/
public
static
String
substring
(
final
String
str
,
int
start
,
int
end
)
{
if
(
str
==
null
)
{
return
NULLSTR
;
}
if
(
end
<
0
)
{
end
=
str
.
length
()
+
end
;
}
if
(
start
<
0
)
{
start
=
str
.
length
()
+
start
;
}
if
(
end
>
str
.
length
())
{
end
=
str
.
length
();
}
if
(
start
>
end
)
{
return
NULLSTR
;
}
if
(
start
<
0
)
{
start
=
0
;
}
if
(
end
<
0
)
{
end
=
0
;
}
return
str
.
substring
(
start
,
end
);
}
/**
* 字符串转set
*
* @param str 字符串
* @param sep 分隔符
* @return set集合
*/
public
static
final
Set
<
String
>
str2Set
(
String
str
,
String
sep
)
{
return
new
HashSet
<
String
>(
str2List
(
str
,
sep
,
true
,
false
));
}
/**
* 字符串转list
*
* @param str 字符串
* @param sep 分隔符
* @param filterBlank 过滤纯空白
* @param trim 去掉首尾空白
* @return list集合
*/
public
static
final
List
<
String
>
str2List
(
String
str
,
String
sep
,
boolean
filterBlank
,
boolean
trim
)
{
List
<
String
>
list
=
new
ArrayList
<
String
>();
if
(
StringUtils
.
isEmpty
(
str
))
{
return
list
;
}
// 过滤空白字符串
if
(
filterBlank
&&
StringUtils
.
isBlank
(
str
))
{
return
list
;
}
String
[]
split
=
str
.
split
(
sep
);
for
(
String
string
:
split
)
{
if
(
filterBlank
&&
StringUtils
.
isBlank
(
string
))
{
continue
;
}
if
(
trim
)
{
string
=
string
.
trim
();
}
list
.
add
(
string
);
}
return
list
;
}
/**
* 驼峰转下划线命名
*/
public
static
String
toUnderScoreCase
(
String
str
)
{
if
(
str
==
null
)
{
return
null
;
}
StringBuilder
sb
=
new
StringBuilder
();
// 前置字符是否大写
boolean
preCharIsUpperCase
=
true
;
// 当前字符是否大写
boolean
curreCharIsUpperCase
=
true
;
// 下一字符是否大写
boolean
nexteCharIsUpperCase
=
true
;
for
(
int
i
=
0
;
i
<
str
.
length
();
i
++)
{
char
c
=
str
.
charAt
(
i
);
if
(
i
>
0
)
{
preCharIsUpperCase
=
Character
.
isUpperCase
(
str
.
charAt
(
i
-
1
));
}
else
{
preCharIsUpperCase
=
false
;
}
curreCharIsUpperCase
=
Character
.
isUpperCase
(
c
);
if
(
i
<
(
str
.
length
()
-
1
))
{
nexteCharIsUpperCase
=
Character
.
isUpperCase
(
str
.
charAt
(
i
+
1
));
}
if
(
preCharIsUpperCase
&&
curreCharIsUpperCase
&&
!
nexteCharIsUpperCase
)
{
sb
.
append
(
SEPARATOR
);
}
else
if
((
i
!=
0
&&
!
preCharIsUpperCase
)
&&
curreCharIsUpperCase
)
{
sb
.
append
(
SEPARATOR
);
}
sb
.
append
(
Character
.
toLowerCase
(
c
));
}
return
sb
.
toString
();
}
/**
* 是否包含字符串
*
* @param str 验证字符串
* @param strs 字符串组
* @return 包含返回true
*/
public
static
boolean
inStringIgnoreCase
(
String
str
,
String
...
strs
)
{
if
(
str
!=
null
&&
strs
!=
null
)
{
for
(
String
s
:
strs
)
{
if
(
str
.
equalsIgnoreCase
(
trim
(
s
)))
{
return
true
;
}
}
}
return
false
;
}
/**
* 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld
*
* @param name 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串
*/
public
static
String
convertToCamelCase
(
String
name
)
{
StringBuilder
result
=
new
StringBuilder
();
// 快速检查
if
(
name
==
null
||
name
.
isEmpty
())
{
// 没必要转换
return
""
;
}
else
if
(!
name
.
contains
(
"_"
))
{
// 不含下划线,仅将首字母大写
return
name
.
substring
(
0
,
1
).
toUpperCase
()
+
name
.
substring
(
1
);
}
// 用下划线将原始字符串分割
String
[]
camels
=
name
.
split
(
"_"
);
for
(
String
camel
:
camels
)
{
// 跳过原始字符串中开头、结尾的下换线或双重下划线
if
(
camel
.
isEmpty
())
{
continue
;
}
// 首字母大写
result
.
append
(
camel
.
substring
(
0
,
1
).
toUpperCase
());
result
.
append
(
camel
.
substring
(
1
).
toLowerCase
());
}
return
result
.
toString
();
}
/**
* 驼峰式命名法 例如:user_name->userName
*/
public
static
String
toCamelCase
(
String
s
)
{
if
(
s
==
null
)
{
return
null
;
}
s
=
s
.
toLowerCase
();
StringBuilder
sb
=
new
StringBuilder
(
s
.
length
());
boolean
upperCase
=
false
;
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
char
c
=
s
.
charAt
(
i
);
if
(
c
==
SEPARATOR
)
{
upperCase
=
true
;
}
else
if
(
upperCase
)
{
sb
.
append
(
Character
.
toUpperCase
(
c
));
upperCase
=
false
;
}
else
{
sb
.
append
(
c
);
}
}
return
sb
.
toString
();
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
T
cast
(
Object
obj
)
{
return
(
T
)
obj
;
}
}
\ No newline at end of file
src/main/resources/application-prd.yml
View file @
5a51c8b4
...
@@ -4,4 +4,25 @@ spring:
...
@@ -4,4 +4,25 @@ spring:
username
:
root
username
:
root
password
:
zehong_/sjz!D
password
:
zehong_/sjz!D
url
:
jdbc:mysql://36.148.1.253:3309/gas_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url
:
jdbc:mysql://36.148.1.253:3309/gas_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
driver-class-name
:
com.mysql.jdbc.Driver
driver-class-name
:
com.mysql.jdbc.Driver
\ No newline at end of file
# redis 配置
redis
:
host
:
36.138.180.82
port
:
63798
# 数据库索引
database
:
0
# 密码
password
:
1qaz2wsx3edc@
# 连接超时时间
timeout
:
10s
jedis
:
pool
:
# 连接池中的最小空闲连接
min-idle
:
0
# 连接池中的最大空闲连接
max-idle
:
8
# 连接池的最大数据库连接数
max-active
:
8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait
:
-1ms
\ No newline at end of file
src/main/resources/application-test.yml
View file @
5a51c8b4
...
@@ -14,4 +14,25 @@ spring:
...
@@ -14,4 +14,25 @@ spring:
driver-class-name
:
com.mysql.jdbc.Driver
driver-class-name
:
com.mysql.jdbc.Driver
url
:
jdbc:mysql://36.138.180.82:3309/zh_mes_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
url
:
jdbc:mysql://36.138.180.82:3309/zh_mes_db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
username
:
zh_mes_db
username
:
zh_mes_db
password
:
Dba5CdmBm3tdJ4ph
password
:
Dba5CdmBm3tdJ4ph
\ No newline at end of file
# redis 配置
redis
:
host
:
36.138.180.82
port
:
63798
# 数据库索引
database
:
0
# 密码
password
:
1qaz2wsx3edc@
# 连接超时时间
timeout
:
10s
jedis
:
pool
:
# 连接池中的最小空闲连接
min-idle
:
0
# 连接池中的最大空闲连接
max-idle
:
8
# 连接池的最大数据库连接数
max-active
:
8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait
:
-1ms
src/main/resources/mapper/
AoiTestResult
Mapper.xml
→
src/main/resources/mapper/
PCBADevices
Mapper.xml
View file @
5a51c8b4
<?xml version="1.0" encoding="UTF-8"?>
<?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">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.zehong.dao.
AoiTestResult
Mapper"
>
<mapper
namespace=
"com.zehong.dao.
PCBADevices
Mapper"
>
<resultMap
type=
"P
cba
Devices"
id=
"PcbaDevicesResult"
>
<resultMap
type=
"P
CBA
Devices"
id=
"PcbaDevicesResult"
>
<result
property=
"pcbaDevicesId"
column=
"f_pcba_devices_id"
/>
<result
property=
"pcbaDevicesId"
column=
"f_pcba_devices_id"
/>
<result
property=
"motherboardCode"
column=
"f_motherboard_code"
/>
<result
property=
"motherboardCode"
column=
"f_motherboard_code"
/>
<result
property=
"pcbaProductionTasksNumber"
column=
"f_pcba_production_tasks_number"
/>
<result
property=
"pcbaProductionTasksNumber"
column=
"f_pcba_production_tasks_number"
/>
<result
property=
"pcbaBatchNumber"
column=
"f_pcba_batch_number"
/>
<result
property=
"pcbaBatchNumber"
column=
"f_pcba_batch_number"
/>
<result
property=
"aoiDetectionResult"
column=
"f_aoi_detection_result"
/>
<result
property=
"aoiDetectionResult"
column=
"f_aoi_detection_result"
/>
<result
property=
"iotCardBatchNumber"
column=
"iot_card_batch_number"
/>
<result
property=
"sensorCode"
column=
"f_sensor_code"
/>
<result
property=
"nbCode"
column=
"f_nb_code"
/>
<result
property=
"materialInfoId"
column=
"f_material_info_id"
/>
</resultMap>
</resultMap>
...
@@ -30,8 +34,38 @@
...
@@ -30,8 +34,38 @@
<if
test=
"pcbaProductionTasksNumber != null"
>
f_pcba_production_tasks_number = #{pcbaProductionTasksNumber},
</if>
<if
test=
"pcbaProductionTasksNumber != null"
>
f_pcba_production_tasks_number = #{pcbaProductionTasksNumber},
</if>
<if
test=
"pcbaBatchNumber != null"
>
f_pcba_batch_number = #{pcbaBatchNumber},
</if>
<if
test=
"pcbaBatchNumber != null"
>
f_pcba_batch_number = #{pcbaBatchNumber},
</if>
<if
test=
"aoiDetectionResult != null"
>
f_aoi_detection_result = #{aoiDetectionResult},
</if>
<if
test=
"aoiDetectionResult != null"
>
f_aoi_detection_result = #{aoiDetectionResult},
</if>
<if
test=
"sensorCode != null"
>
f_sensor_code = #{sensorCode},
</if>
<if
test=
"nbCode != null"
>
f_nb_code = #{nbCode},
</if>
<if
test=
"iotCardBatchNumber != null"
>
iot_card_batch_number = #{iotCardBatchNumber},
</if>
<if
test=
"materialInfoId != null"
>
f_material_info_id,
</if>
</trim>
</trim>
where f_pcba_devices_id = #{pcbaDevicesId}
where f_pcba_devices_id = #{pcbaDevicesId}
</update>
</update>
<insert
id=
"insertPcbaDevices"
parameterType=
"PcbaDevices"
useGeneratedKeys=
"true"
keyProperty=
"pcbaDevicesId"
>
insert into t_pcba_devices
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"motherboardCode != null"
>
f_motherboard_code,
</if>
<if
test=
"pcbaProductionTasksNumber != null"
>
f_pcba_production_tasks_number,
</if>
<if
test=
"pcbaBatchNumber != null"
>
f_pcba_batch_number,
</if>
<if
test=
"materialInfoId != null"
>
f_material_info_id,
</if>
<if
test=
"sensorCode != null"
>
f_sensor_code,
</if>
<if
test=
"nbCode != null"
>
f_nb_code,
</if>
<if
test=
"createTime != null"
>
f_create_time,
</if>
<if
test=
"iotCardBatchNumber != null"
>
iot_card_batch_number,
</if>
<if
test=
"aoiDetectionResult != null"
>
f_aoi_detection_result,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"motherboardCode != null"
>
#{motherboardCode},
</if>
<if
test=
"pcbaProductionTasksNumber != null"
>
#{pcbaProductionTasksNumber},
</if>
<if
test=
"pcbaBatchNumber != null"
>
#{pcbaBatchNumber},
</if>
<if
test=
"materialInfoId != null"
>
#{materialInfoId},
</if>
<if
test=
"sensorCode != null"
>
#{sensorCode},
</if>
<if
test=
"nbCode != null"
>
#{nbCode},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"iotCardBatchNumber != null"
>
#{iotCardBatchNumber},
</if>
<if
test=
"aoiDetectionResult != null"
>
#{aoiDetectionResult},
</if>
</trim>
</insert>
</mapper>
</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