Comments (1)
像下面这种驼峰式命名风格的字段要怎么映射回来呢?
type App struct{
AppId int64json:"appId"
AppName stringjson:"appName"
....
}下面这种配置貌似不起作用?最新的dtd中也没有property属性可设置
框架默认先从resutMap里面找属性,问题是你的驼峰命名首字母是小写,无法访问,然后框架按json tag找,结果是下划线没找到。
你的问题很简单,要么驼峰改成 首字母大写,要么 resutMap里面的值必须和json tag一样。
<resultMap id="BaseResultMap" tables="biz_activity">
<id column="id" langType="string"/>
<result column="name" langType="string"/>
<result column="pc_link" langType="string"/>
<result column="h5_link" langType="string"/>
<result column="remark" langType="string"/>
<result column="sort" langType="int"/>
<result column="status" langType="status"/>
<result column="version" langType="int"
version_enable="true"/>
<result column="create_time" langType="time.Time"/>
<result column="delete_flag" langType="int"
logic_enable="true"
logic_undelete="1"
logic_deleted="0"/>
</resultMap>
<select id="selectByCondition" resultMap="BaseResultMap">
<bind name="pattern" value="'%' + name + '%'"/>
select * from biz_activity
<where>
<if test="name != null">and name like #{pattern}</if>
<if test="startTime != null">and create_time >= #{startTime}</if>
<if test="endTime != null">and create_time <= #{endTime}</if>
</where>
order by create_time desc
<if test="page != null and size != null">limit #{page}, #{size}</if>
</select>
from gomybatis.
Related Issues (20)
- select sql resultMap 不起作用 HOT 2
- 在使用postgres数据时出现错 HOT 11
- Error 1390: Prepared stat ement contains too many placeholders HOT 4
- <where> bug HOT 15
- 对类似rollback这样的功能怎么通过框架实现呢? HOT 1
- 有一对多映射功能吗? HOT 20
- 多数据源如何使用 HOT 1
- 支持1对n映射了吗
- Insert方法是InsertTemplete还是InsertTemplate?
- Insert方法是InsertTemplete还是InsertTemplate?
- sql中的 #{key}获取不到
- 好久不更新了,有点不敢用啊 HOT 4
- bug
- 作者你好,打扰了 HOT 3
- 你好,数据库中null值如何解决?
- 分页插件 HOT 2
- 请问大神,使用struct传参,xml中的动态表达式能获取匿名继承的属性吗?好像不能取到 HOT 2
- 作者你好,有没有计划加入泛型的使用,mapper 和 service ,就和java的 mybatisplus 通过继承的方式一样 HOT 1
- xml与struct绑定优化建议
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gomybatis.