mysql - 表列有值,但执行 SELECT * FROM t_order 后,一些返回结果为空
问题描述
表中部分列有值,但在mybatis中使用select sql语句时,大部分列返回值为null。
在 mysql(Navicat) 中尝试了类似的 sql 语句,它正确显示了所有值。
映射器文件如下:
<select id="queryPageInDao" resultType="TOrder">
SELECT * FROM t_order
<trim prefix="WHERE " prefixOverrides="AND |OR ">
AND del = 0
<if test="param1.userId != null" >
AND user_id = #{param1.userId,jdbcType=INTEGER}
</if>
<if test="param1.courseId != null" >
AND course_id = #{param1.courseId,jdbcType=INTEGER}
</if>
<if test="param1.paystatus != null" >
AND paystatus = #{param1.paystatus,jdbcType=INTEGER}
</if>
<if test="param1.userEmail != null">
AND user_email like CONCAT('%',#{param1.userEmail},'%' )
</if>
</trim>
<if test="param2.sortField != null and param2.sortField != ''">
ORDER BY ${param2.sortField} ${param2.sortDirection}
</if>
LIMIT #{param2.startIndex, jdbcType=INTEGER} , #{param2.pageSize, jdbcType=INTEGER}
</select>
返回结果如下:
[TOrder [id=38, userId=null, courseId=null, price=10.01, paystatus=0, ... del=0],
表中数据如下:
id userId courseId price del
38 45 44 10.01 0
期待这样的事情
[TOrder [id=38, userId=45, courseId=44, price=10.01, .......
解决方案
推荐阅读
- javascript - 为什么我写导出函数时导入函数不起作用
- ios - 带有选择日期和日期的自定义周历
- webpack - 在汇总应用程序中加载带有动态导入的音频文件?
- reactjs - 尝试从已部署的 create-react-app 中的公用文件夹中获取 json 文件时出现 404 错误
- python - Python。多处理
- laravel - Laravel 设置单元格边框样式
- r - 在 R 中查找多个模式的列表中元素的位置
- python - 在 OpenMaya 中获取顶点法线?
- android - 我怎样才能获得像 ColorOs、Flyme、LineageOS 等 Android 类型?
- react-native - 反应原生 | 钩子组件