MyBatis中,两表查询,使用
<resultMap id=\"ResultMap3\" type=\"java.util.Map\">
查询的表的字段映射,例:
<id column=\"id\" property=\"id\" jdbcType=\"VARCHAR\"/>
<result column=\"path\" property=\"path\" jdbcType=\"VARCHAR\"/>
<result column=\"file_size\" property=\"fileSize\" jdbcType=\"INTEGER\"/>
</resultMap>
范文:
<? version=\"1.0\" encoding=\"UTF-8\" ?>
<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\" >
<mapper namespace=\"com.njzykj.ms.dao.companyInfo.ZykjUnitInformationDao\">
<resultMap id=\" ResultMap\" type=\"com.njzykj.ms.entity.companyInfo.ZykjUnitInformation\">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Wed May 30 16:42:45 CST 2018.
-->
<id column=\"ID\" property=\"id\" jdbcType=\"INTEGER\"/>
<result column=\"company_id\" property=\"companyId\" jdbcType=\"INTEGER\"/>
<result column=\"information_name\" property=\"informationName\" jdbcType=\"VARCHAR\"/>
<result column=\"information_content\" property=\"informationContent\" jdbcType=\"VARCHAR\"/>
<result column=\"company_floor\" property=\"companyFloor\" jdbcType=\"INTEGER\"/>
<result column=\"classfiy\" property=\"classfiy\" jdbcType=\"CHAR\"/>
<result column=\"parent_id\" property=\"parentId\" jdbcType=\"VARCHAR\"/>
<result column=\"status\" property=\"status\" jdbcType=\"VARCHAR\"/>
<result column=\"create_time\" property=\"createTime\" jdbcType=\"TIMESTAMP\"/>
<result column=\"update_time\" property=\"updateTime\" jdbcType=\"TIMESTAMP\"/>
<result column=\"left_lng_lat\" property=\"leftLngLat\" jdbcType=\"VARCHAR\"/>
<result column=\"right_lng_lat\" property=\"rightLngLat\" jdbcType=\"VARCHAR\"/>
<result column=\"information_message\" property=\"informationMessage\" jdbcType=\"VARCHAR\"/>
<result column=\"effect_status\" property=\"effectStatus\" jdbcType=\"VARCHAR\"/>
</resultMap>
<resultMap id=\"ResultMap3\" type=\"java.util.Map\">
<id column=\"id\" property=\"id\" jdbcType=\"VARCHAR\"/>
<result column=\"path\" property=\"path\" jdbcType=\"VARCHAR\"/>
<result column=\"file_size\" property=\"fileSize\" jdbcType=\"INTEGER\"/>
<result column=\"file_desc\" property=\"fileDesc\" jdbcType=\"VARCHAR\"/>
<result column=\"parent_id\" property=\"parentId\" jdbcType=\"VARCHAR\"/>
<result column=\"create_at\" property=\"createAt\" jdbcType=\"TIMESTAMP\"/>
<result column=\"file_name\" property=\"fileName\" jdbcType=\"VARCHAR\"/>
</resultMap>
<select id=\"selectByCompanyId\" resultMap=\"ResultMap3\">
select * from zykj_unit_information as a , file_store as b
where a.company_id = #{companyId}
AND a.parent_id = b.parent_id
AND b.file_desc !=2
</select>
</mapper>
继续阅读与本文标签相同的文章
洋码头跨境物流服务持续提速 海淘品质再强化
-
特斯拉明年将在日本安装家用蓄电池 首次在亚洲亮相
2026-05-19栏目: 教程
-
原创教程:创建邮箱群组,同时发给诸多收件人
2026-05-19栏目: 教程
-
揭秘!大数据知识工程到底是什么
2026-05-19栏目: 教程
-
微软:所有Windows 10用户默认启用Defender篡改保护功能
2026-05-19栏目: 教程
-
国际机器人联合会:全球工业机器人2019报告
2026-05-19栏目: 教程
