mybatis 多层select示例
2016-05-14 00:00
232 查看
摘要: mybatis 多层select示例
实体类
Xml
直接用括号扩起 加上别名就可以了
实体类
package com.yonyou.iuap.entity.quotation; import java.io.Serializable; import java.util.Date; import java.util.List; public class IpuQuotation implements Serializable { private static final long serialVersionUID = -9169987729255268660L; private String ipuquotaionid; private Date buyoffertime; private String contact; private Date createtime; private String description; private String phone; private Date processtime; private String processor; private Date qtexpiredate; private String subject; private Date ts; private Short dr; private List<IpuQuotationDetail> datailentitylist; public String getIpuquotaionid() { return ipuquotaionid; } public void setIpuquotaionid(String ipuquotaionid) { this.ipuquotaionid = ipuquotaionid == null ? null : ipuquotaionid.trim(); } public Date getBuyoffertime() { return buyoffertime; } public void setBuyoffertime(Date buyoffertime) { this.buyoffertime = buyoffertime; } public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact == null ? null : contact.trim(); } public Date getCreatetime() { return createtime; } public void setCreatetime(Date createtime) { this.createtime = createtime; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description == null ? null : description.trim(); } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone == null ? null : phone.trim(); } public Date getProcesstime() { return processtime; } public void setProcesstime(Date processtime) { this.processtime = processtime; } public String getProcessor() { return processor; } public void setProcessor(String processor) { this.processor = processor == null ? null : processor.trim(); } public Date getQtexpiredate() { return qtexpiredate; } public void setQtexpiredate(Date qtexpiredate) { this.qtexpiredate = qtexpiredate; } public String getSubject() { return subject; } public void setSubject(String subject) { this.subject = subject == null ? null : subject.trim(); } public Date getTs() { return ts; } public void setTs(Date ts) { this.ts = ts; } public Short getDr() { return dr; } public void setDr(Short dr) { this.dr = dr; } public List<IpuQuotationDetail> getDatailentitylist() { return datailentitylist; } public void setDatailentitylist(List<IpuQuotationDetail> datailentitylist) { this.datailentitylist = datailentitylist; } }
Xml
<?xml 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.yonyou.iuap.repository.quotation.IpuQuotationMapper"> <resultMap id="BaseResultMap" type="com.yonyou.iuap.entity.quotation.IpuQuotation"> <id column="ipuquotaionid" property="ipuquotaionid" jdbcType="CHAR"/> <result column="buyoffertime" property="buyoffertime" jdbcType="TIMESTAMP"/> <result column="contact" property="contact" jdbcType="VARCHAR"/> <result column="createtime" property="createtime" jdbcType="TIMESTAMP"/> <result column="description" property="description" jdbcType="VARCHAR"/> <result column="phone" property="phone" jdbcType="VARCHAR"/> <result column="processtime" property="processtime" jdbcType="TIMESTAMP"/> <result column="processor" property="processor" jdbcType="VARCHAR"/> <result column="qtexpiredate" property="qtexpiredate" jdbcType="TIMESTAMP"/> <result column="subject" property="subject" jdbcType="VARCHAR"/> <result column="ts" property="ts" jdbcType="TIMESTAMP"/> <result column="dr" property="dr" jdbcType="SMALLINT"/> </resultMap> <sql id="Base_Column_List"> ipuquotaionid, buyoffertime, contact, createtime, description, phone, processtime, processor, qtexpiredate, subject, ts, dr </sql> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> select test.ipuquotaionid from (select <include refid="Base_Column_List"/> from ipuquotation where ipuquotaionid = #{ipuquotaionid}) as test </select> </mapper>
直接用括号扩起 加上别名就可以了
相关文章推荐
- The operation couldn’t be completed. (LaunchServicesError error 0.)
- 三级联动数据
- phonegap cordova 环境搭建及安装
- 编程上的那点事情儿
- 读书笔记---《如何高效学习》
- MappedByteBuffer 替代unmap方案
- visual C++ & Makefile
- 语法分析器自动生成工具一览
- POI
- JAVA读文件和写文件的的代码模版
- bat命令遍历文件和bat参数说明
- 线程池 API (转)
- window linux IPC ftok BY_HANDLE_FILE_INFORMATION
- 共享内存
- POI Excel 冷冻线
- Android 项目框架 使用MVP开发
- 托管程序调用非托管dll问题总结
- ini文件
- VBA 字符串操作
- SERVICE_STATUS结构各成员解析