<?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.dongao.phoenix.ec.coupon.manage.mapper.ext.CouponBookUserPoExtMapper" >
<resultMap id="BaseResultMap" type="map" >
<id column="id" jdbcType="BIGINT" property="id" />
<result column="coupon_id" jdbcType="BIGINT" property="couponId" />
<result column="coupon_no" jdbcType="VARCHAR" property="couponNo" />
<result column="binddate" jdbcType="DATE" property="binddate" />
<result column="member_id" jdbcType="BIGINT" property="memberId" />
<result column="member_name" jdbcType="VARCHAR" property="memberName" />
<result column="order_id" jdbcType="BIGINT" property="orderId" />
<result column="order_no" jdbcType="VARCHAR" property="orderNo" />
<result column="rule_type" jdbcType="VARCHAR" property="ruleType" />
<!-- 以下为冗余字段 -->
<result column="goods_name" property="goodsName" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
u.id,u.coupon_no,u.order_no,u.order_id,u.member_id,u.member_name,u.coupon_id,u.binddate,r.goods_name,r.rule_type
</sql>
<select id="findCouponPreBookUser" resultMap="BaseResultMap" parameterType="com.dongao.phoenix.ec.coupon.manage.po.ext.CouponBookUserPoExt" >
select
<include refid="Base_Column_List" />
from ec_coupon_book_user u left join ec_coupon_book b on u.coupon_id=b.id left join ec_coupon_book_rule r on b.rule_id=r.id
<where>
<if test="memberId !=null and memberId != ''">
u.member_id=${memberId}
</if>
<if test="ruleType !=null and ruleType!= ''">
and r.rule_type=${ruleType}
</if>
</where>
</select>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.dongao.phoenix.ec.coupon.manage.mapper.ext.CouponBookUserPoExtMapper" >
<resultMap id="BaseResultMap" type="map" >
<id column="id" jdbcType="BIGINT" property="id" />
<result column="coupon_id" jdbcType="BIGINT" property="couponId" />
<result column="coupon_no" jdbcType="VARCHAR" property="couponNo" />
<result column="binddate" jdbcType="DATE" property="binddate" />
<result column="member_id" jdbcType="BIGINT" property="memberId" />
<result column="member_name" jdbcType="VARCHAR" property="memberName" />
<result column="order_id" jdbcType="BIGINT" property="orderId" />
<result column="order_no" jdbcType="VARCHAR" property="orderNo" />
<result column="rule_type" jdbcType="VARCHAR" property="ruleType" />
<!-- 以下为冗余字段 -->
<result column="goods_name" property="goodsName" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
u.id,u.coupon_no,u.order_no,u.order_id,u.member_id,u.member_name,u.coupon_id,u.binddate,r.goods_name,r.rule_type
</sql>
<select id="findCouponPreBookUser" resultMap="BaseResultMap" parameterType="com.dongao.phoenix.ec.coupon.manage.po.ext.CouponBookUserPoExt" >
select
<include refid="Base_Column_List" />
from ec_coupon_book_user u left join ec_coupon_book b on u.coupon_id=b.id left join ec_coupon_book_rule r on b.rule_id=r.id
<where>
<if test="memberId !=null and memberId != ''">
u.member_id=${memberId}
</if>
<if test="ruleType !=null and ruleType!= ''">
and r.rule_type=${ruleType}
</if>
</where>
</select>
</mapper>
其中ruleType已经传入了0,当and r.rule_type=${ruleType}一直不执行,因为ruleType为Integer类型