Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
data-computing-proxy-test
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
李振振
data-computing-proxy-test
Commits
0e421f5e
You need to sign in or sign up before continuing.
Commit
0e421f5e
authored
Jul 28, 2023
by
李振振
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1232
parent
cb3b0f8e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
43 deletions
+33
-43
src/main/java/com/beagle/informix/entity/mybatis/Vccinfo.java
...main/java/com/beagle/informix/entity/mybatis/Vccinfo.java
+11
-19
src/main/java/com/beagle/informix/mapper/VccinfoMapper.java
src/main/java/com/beagle/informix/mapper/VccinfoMapper.java
+2
-4
src/main/java/com/beagle/informix/service/impl/InformixJdbcProxyServiceImpl.java
...e/informix/service/impl/InformixJdbcProxyServiceImpl.java
+1
-1
src/main/java/com/beagle/informix/service/impl/InformixMybatisServiceImpl.java
...gle/informix/service/impl/InformixMybatisServiceImpl.java
+19
-19
No files found.
src/main/java/com/beagle/informix/entity/mybatis/Vccinfo.java
View file @
0e421f5e
...
...
@@ -18,24 +18,16 @@ import java.sql.Blob;
public
class
Vccinfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"vccid"
,
type
=
IdType
.
AUTO
)
private
Integer
vId
;
@TableField
(
value
=
"vccname"
)
private
String
vName
;
@TableField
(
value
=
"effective"
)
private
Integer
effective
;
@TableField
(
value
=
"agentmax"
)
private
Integer
agentMax
;
@TableField
(
value
=
"ivrmax"
)
private
Integer
ivrMax
;
@TableField
(
value
=
"updatekey"
)
private
String
updateKey
;
@TableField
(
value
=
"tclob"
)
private
String
tClob
;
/**
* 如果是pg等数据库,字段声明为bytea,则不需要BlobTypeHandler转换,如果声明为blob,则需要转换
*/
private
String
vId
;
// @TableField(value = "vccname")
// private String vName;
// @TableField(value = "effective")
// private Integer effective;
// @TableField(value = "agentmax")
// private Integer agentMax;
// @TableField(value = "ivrmax")
// private Integer ivrMax;
// @TableField(value = "updatekey")
// private String updateKey;
// @TableField(value = "tblob", typeHandler = org.apache.ibatis.type.BlobTypeHandler.class)
@TableField
(
value
=
"tblob"
)
private
byte
[]
tBlob
;
}
src/main/java/com/beagle/informix/mapper/VccinfoMapper.java
View file @
0e421f5e
...
...
@@ -8,11 +8,9 @@ import java.util.List;
@Mapper
public
interface
VccinfoMapper
extends
BaseMapper
<
Vccinfo
>
{
@Results
(
@Result
(
column
=
"tblob"
,
property
=
"tBlobStr"
)
)
@Select
(
"SELECT * FROM cti_vccinfo_new where vccid = #{vId}"
)
List
<
Vccinfo
>
queryList
(
@Param
(
"vId"
)
Integer
vId
);
List
<
Vccinfo
>
queryList
(
@Param
(
"vId"
)
String
vId
);
/**
* 必须使用org.apache.ibatis.type.BlobTypeHandler转换后,才能保存到数据库
...
...
src/main/java/com/beagle/informix/service/impl/InformixJdbcProxyServiceImpl.java
View file @
0e421f5e
...
...
@@ -68,7 +68,7 @@ public class InformixJdbcProxyServiceImpl implements InformixService {
// 插入
String
insertSql
=
"insert into cti_vccinfo_new (vccid ,vccname, effective, agentmax,ivrmax,updatekey,tclob,tblob) values (?, ? , ?, ?, ? , ?,?,? )"
;
PreparedStatement
stat
=
conn
.
prepareStatement
(
insertSql
);
stat
.
setObject
(
1
,
"1
23456
"
);
stat
.
setObject
(
1
,
"1
649328412545421313
"
);
stat
.
setObject
(
2
,
"vname"
);
stat
.
setObject
(
3
,
1
);
stat
.
setObject
(
4
,
2
);
...
...
src/main/java/com/beagle/informix/service/impl/InformixMybatisServiceImpl.java
View file @
0e421f5e
...
...
@@ -35,28 +35,28 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin
@Override
@Transactional
public
void
doConnectJob
()
throws
Exception
{
insertMethod
();
//
insertMethod();
// updateMethod();
//
queryMethod();
queryMethod
();
// delete();
}
private
void
insertMethod
()
throws
Exception
{
Vccinfo
vccinfo
=
new
Vccinfo
();
vccinfo
.
setVId
(
3
);
vccinfo
.
setEffective
(
1
);
vccinfo
.
setVName
(
"mybatis"
);
vccinfo
.
setIvrMax
(
1
);
vccinfo
.
setAgentMax
(
1
);
vccinfo
.
setUpdateKey
(
"mybatis key"
);
// 组装clob
vccinfo
.
setTClob
(
"测试clob数据!@#@Ddsfsdferewr"
);
// 组装blob数据
// 处理blob字段
org
.
springframework
.
core
.
io
.
Resource
resource
=
resourceLoader
.
getResource
(
"classpath:EnableLoopback.exe"
);
File
inputStream
=
resource
.
getFile
();
try
(
FileInputStream
fis
=
new
FileInputStream
(
inputStream
)){
vccinfo
.
setTBlob
(
fis
.
readAllBytes
());
}
vccinfo
.
setVId
(
"1649323312545421313"
);
//
vccinfo.setEffective(1);
//
vccinfo.setVName("mybatis");
//
vccinfo.setIvrMax(1);
//
vccinfo.setAgentMax(1);
//
vccinfo.setUpdateKey("mybatis key");
//
// 组装clob
//
vccinfo.setTClob("测试clob数据!@#@Ddsfsdferewr");
//
// 组装blob数据
//
// 处理blob字段
//
org.springframework.core.io.Resource resource = resourceLoader.getResource("classpath:EnableLoopback.exe");
//
File inputStream = resource.getFile();
//
try (FileInputStream fis = new FileInputStream(inputStream)){
//
vccinfo.setTBlob(fis.readAllBytes());
//
}
// insert
// 如果使用实体保存,则需要在blob字段上新增BlobTypeHandler转换
// 如果使用xml的insert保存,也需要在属性上设置BlobTypeHandler转换
...
...
@@ -67,12 +67,12 @@ public class InformixMybatisServiceImpl extends ServiceImpl<VccinfoMapper, Vccin
LambdaQueryWrapper
<
Vccinfo
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
Vccinfo:
:
getVId
,
"ibatis"
);
Vccinfo
vccinfo
=
new
Vccinfo
();
vccinfo
.
setVName
(
"mybatis-update"
);
//
vccinfo.setVName("mybatis-update");
baseMapper
.
update
(
vccinfo
,
queryWrapper
);
}
private
void
queryMethod
()
{
List
<
Vccinfo
>
vccinfoList
=
vccinfoMapper
.
queryList
(
1
);
List
<
Vccinfo
>
vccinfoList
=
vccinfoMapper
.
queryList
(
"x'31363439333238343132353435343231333133'"
);
log
.
info
(
"queryAll:{}"
,
JSONUtil
.
toJsonStr
(
vccinfoList
));
}
private
void
delete
()
{
...
...
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