From ec44a32ae9698d48f600170aeed7ceaacb2f2857 Mon Sep 17 00:00:00 2001 From: zhuxiujia Date: Sun, 7 Jun 2020 02:02:03 +0800 Subject: [PATCH] add json decode. --- GoMybatis.go | 1 - GoMybatisSqlResultDecoder_test.go | 4 ---- README-ch.md | 16 ++++++++-------- README.md | 16 ++++++++-------- ResultMap.go | 1 - example/Example_ActivityMapper.xml | 26 +++++++++++++------------- example/Example_test.go | 2 +- 7 files changed, 30 insertions(+), 36 deletions(-) diff --git a/GoMybatis.go b/GoMybatis.go index 4527db7..aa6109b 100644 --- a/GoMybatis.go +++ b/GoMybatis.go @@ -231,7 +231,6 @@ func makeResultMaps(xmls map[string]etree.Token) map[string]map[string]*ResultPr var property = ResultProperty{ XMLName: elementItem.Tag, Column: elementItem.SelectAttrValue("column", ""), - Property: elementItem.SelectAttrValue("property", ""), LangType: elementItem.SelectAttrValue("langType", ""), } resultPropertyMap[property.Column] = &property diff --git a/GoMybatisSqlResultDecoder_test.go b/GoMybatisSqlResultDecoder_test.go index c67b00c..7df2cd0 100644 --- a/GoMybatisSqlResultDecoder_test.go +++ b/GoMybatisSqlResultDecoder_test.go @@ -225,25 +225,21 @@ func Test_Decode_Interface(t *testing.T) { resultMap["id"] = &ResultProperty{ XMLName: "id", Column: "id", - Property: "id", LangType: "string", } resultMap["name"] = &ResultProperty{ XMLName: "result", Column: "name", - Property: "Name", LangType: "string", } resultMap["Amount_1"] = &ResultProperty{ XMLName: "result", Column: "Amount_1", - Property: "amount_1", LangType: "string", } resultMap["amount_2"] = &ResultProperty{ XMLName: "result", Column: "Amount_2", - Property: "amount_2", LangType: "string", } var result map[string]string diff --git a/README-ch.md b/README-ch.md index 4070017..a36cf77 100644 --- a/README-ch.md +++ b/README-ch.md @@ -126,15 +126,15 @@ func main() { - - - - - - + + + + + - - + diff --git a/README.md b/README.md index 369ecdc..288a679 100644 --- a/README.md +++ b/README.md @@ -112,15 +112,15 @@ func main() { - - - - - - + + + + + - - + diff --git a/ResultMap.go b/ResultMap.go index 9f8793d..15f28bb 100644 --- a/ResultMap.go +++ b/ResultMap.go @@ -3,6 +3,5 @@ package GoMybatis type ResultProperty struct { XMLName string //`xml:"result/id"` Column string - Property string LangType string } diff --git a/example/Example_ActivityMapper.xml b/example/Example_ActivityMapper.xml index a4e6745..6afdd42 100644 --- a/example/Example_ActivityMapper.xml +++ b/example/Example_ActivityMapper.xml @@ -7,7 +7,7 @@ - + @@ -105,11 +105,11 @@ update biz_activity name = #{name}, - pc_link = #{pcLink}, - h5_link = #{h5Link}, + pc_link = #{pc_link}, + h5_link = #{h5_link}, remark = #{remark}, - create_time = #{createTime}, - delete_flag = #{deleteFlag}, + create_time = #{create_time}, + delete_flag = #{delete_flag}, where id = #{id} and delete_flag = 1 @@ -118,21 +118,21 @@ id, name, - pc_link, - h5_link, + pc_link, + h5_link, remark, - create_time, - delete_flag, + create_time, + delete_flag, #{id}, #{name}, - #{pcLink}, - #{h5Link}, + #{pc_link}, + #{h5_link}, #{remark}, - #{createTime}, - #{deleteFlag}, + #{create_time}, + #{delete_flag}, diff --git a/example/Example_test.go b/example/Example_test.go index d78dd9f..e13218e 100644 --- a/example/Example_test.go +++ b/example/Example_test.go @@ -116,7 +116,7 @@ func Test_inset(t *testing.T) { //推荐使用snowflake雪花算法 代替uuid防止ID碰撞,id最好用string类型. 否则客户端有可能不支持long类型例如JavaScript var id = SnowflakeNode.Generate().String() //使用mapper - var result, err = exampleActivityMapper.Insert(Activity{Id: id, Name: "test_insert", CreateTime: time.Now(), DeleteFlag: 1}) + var result, err = exampleActivityMapper.Insert(Activity{Id: id, Name: "test_insert", PcLink: "ssss", CreateTime: time.Now(), DeleteFlag: 1}) if err != nil { panic(err) }