mybatis中mapper类型的XML
来源:互联网 发布:双色球霸主软件怎么样 编辑:程序博客网 时间:2024/04/26 02:48
<typeAlias >标签用于定义类别名
如:<typeAliasalias="users" type="com.map.UserObj"/>
关联查询使用<association>标签:
两种方式:
一:<association property="husband" javaType="HusbandBean">
<result property="id" column="hid" javaType="java.lang.Integer"/>
<result property="husbandName" column="hhusband" javaType="java.lang.String"/>
</association>
二:<association property="husband" column="fk_husband_id" select="com.lovo.my.dao.IHusbandMapper.getHusbandBeanById" javaType="HusbandBean"/>
使用时:引用<resultMap>的id即可。
代码如下:
一:<select id="queryWifeAndHusband" resultMap="wifeAndHusbandMap">
select w.id as wid,w.wife as wwife,h.id as hid,h.husband as hhusband from t_wife as w,t_husband as h where h.id = w.fk_husband_id and w.id = #{id}
</select>
二:<select id="queryWifeAndHusband" resultMap="wifeAndHusbandMap">
select * from t_wife where id = #{id}
</select>
批量操作和foreach标签
<deleteid="delMore">
delete from t_user where u_id in(
<foreach collection="ids"item="id" separator=",">
#{id}
</foreach>
)
</delete>
<selectid="dynaFindUser" resultMap="user">
select * from t_user where 1=1
<iftest="id != 0">
and u_id > #{id}
</if>
<if test="userName != null and userName != ''">
and u_userName like '%${userName}%'
</if>
</select>
- mybatis中mapper类型的XML
- mybatis的mapper XML
- mybatis mapper.xml 中查询出的status 赋值给枚举类型要装换
- mybatis Mapper.xml中parameterType为object类型的处理方式
- MyBatis之Mapper.xml获取数据库类型
- mybatis的mapper.xml 小结
- MyBatis的mapper.xml文件中$和#的区别
- mybatis框架的mapper.xml文件中sql的使用方法:
- Mybatis 3.1中 Mapper XML 文件 的学习详解
- Mybatis 3.1中 Mapper XML 文件 的学习详解
- Mybatis 3.1中 Mapper XML 文件 的学习详解
- Mybatis 3.1中 Mapper XML 文件 的学习详解
- Mybatis 3.1中 Mapper XML 文件 的学习详解
- Mybatis 3.1中 Mapper XML 文件 的学习详解
- Mybatis 3.1中 Mapper XML 文件 的学习详解
- Mybatis 3.1中 Mapper XML 文件 的学习详解
- Mybatis 中 Mapper XML 文件 的学习详解(强烈推荐)
- Mybatis 3.1中 Mapper XML 文件 的学习详解
- FragmentTransaction的commit的异步操作
- win7win8 64位汇编开发环境合集安装与设置
- httpclient 4.5.1---状态管理
- iOS SDK与Xcode
- oracle_触发器监控修改字段的客户端IP、用户名、新旧值
- mybatis中mapper类型的XML
- Build.gradle详细配置说明
- Numpy库进阶教程(一)求解线性方程组
- 使用SOCKET实现TCP/IP协议的通讯
- HDU Let's go to play
- 会话跟踪
- httpclient 4.5.1---高级主题
- 第69课:Spark SQL通过Hive数据源JOIN实战 每天晚上20:00YY频道现场授课频道68917580
- shiro入门8:Shiro前几章复习