I don't know what ibatishelper is. Please refer to here for details.
Http://www.cnblogs.com/suyuan/archive/2008/12/26/1362745.html
Since the release of ibatishelper, many of my friends have sent me emails.Source codeIn the past, I used to send emails to people who needed them. However, as the number of emails received increases, it is very troublesome to distribute them one by one!
Simply publish it here. Download it by yourself!
What you think is your ownCodeIt is very blunt. If any friend has the energy to improve this function, he will make persistent efforts. At present, this can meet our needs and will not be too easy to do. if you have improved it, please give me a piece of code.
If you don't talk nonsense, just provide it.
/Files/Suyuan/ibatishelper_src.rar
If it is helpful to you, please feel free to take advantage of your personal experience ~~~~~~~
Add a relatively complete sqlmap template. Currently, we use this template to generate the template. Modify the template for specific applications.
<? XML version = "1.0" encoding = "UTF-8" ?>
<!Doctype sqlmap
Public "-// ibatis.apache.org//dtd SQL map 2.0 // en"
Http://java.plugbase.org/dtd/sql-map-2.dtd">
< Sqlmap Namespace = "$ {Table }" >
< Typealias Alias = "$ {Table }" Type = "$ {Package}. $ {table }" />
< Typealias Alias = "Sqlpager" Type = "Org. plugbase. SQL. sqlpager" />
< Resultmap ID = "$ {Table} resultmap" Class = "$ {Table }" >
# Foreach ($ item in $ List)
< Result Property = "$ {Item. Name. tolower ()}" Column = "$ {Item. Name. tolower ()}" />
# End
</ Resultmap >
<SelectID= "Count $ {table }"Resultclass= "Int">
Select count (*) from $ {table}
</Select>
<SelectID= "Select $ {table} byid"Parameterclass= "Int"Resultmap= "$ {Table} resultmap">
Select * from $ {table} Where id = # value #
</Select>
< Insert ID = "Insert $ {table }" Parameterclass = "$ {Table }" >
Insert into $ {table}
(
# Foreach ($ item in $ List)
# If ($ {item. Name. tolower ()}! = "ID ")
# If ($ velocitycount = $ list. Count ())
$ {Item. Name. tolower ()}
# Else
$ {Item. Name. tolower ()},
# End
# End
# End
)
Values
(
# Foreach ($ item in $ List)
# If ($ {item. Name. tolower ()}! = "ID ")
# If ($ velocitycount = $ list. Count ())
# $ {Item. Name. tolower ()}#
# Else
#$ {Item. Name. tolower ()}#,
# End
# End
# End
)
</ Insert >
< Update ID = "Update $ {table }" Parameterclass = "$ {Table }" >
Update $ {table}
# Foreach ($ item in $ List)
# If ($ velocitycount = 1)
Set
# End
# If ($ {item. Name. tolower ()}! = "ID ")
# If ($ velocitycount = $ list. Count ())
$ {Item. Name. tolower () }=#{ {item. Name. tolower ()}#
# Else
$ {Item. Name. tolower () }=#$ {item. Name. tolower ()}#,
# End
# End
# End
Where id = # value #
</ Update >
<DeleteID= "Delete $ {table} byid"Parameterclass= "Int">
Delete from $ {table} Where id = # value #
</Delete>
</Sqlmap>