Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql中的 #{key}获取不到 #66

Open
catman002 opened this issue Aug 19, 2021 · 0 comments
Open

sql中的 #{key}获取不到 #66

catman002 opened this issue Aug 19, 2021 · 0 comments

Comments

@catman002
Copy link

catman002 commented Aug 19, 2021

package mapper
var XmlBytes = []byte(`
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"https://raw.githubusercontent.com/zhuxiujia/GoMybatis/master/mybatis-3-mapper.dtd">
<mapper>
    <select id="SelectCountByKey">
        select count(*) as num from ek8keys where ek8key=#{key}
    </select>
</mapper>
`)
type IdentityMapperr struct {
	SelectCountByKey  func(key string) (int, error)
}
调用:
	engine:= config.MysqlServer.Connection()
	engine.WriteMapperPtr(&identityMapper,mapper.XmlBytes)
	result,err1:=identityMapper.SelectCountByKey(key) //key=123456

调用 SelectCountByKey(“123456”)查询,sql中的#{key}获取不到,查出的结果为0,哪配错了啊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant