<?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.xxfc.platform.activity.mapper.IntegralUserStatusMapper" >
  <resultMap id="BaseResultMap" type="com.xxfc.platform.activity.entity.IntegralUserStatus" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="integral_rule_code" property="integralRuleCode" jdbcType="VARCHAR" />
    <result column="user_id" property="userId" jdbcType="INTEGER" />
    <result column="integral_status" property="integralStatus" jdbcType="BIT" />
  </resultMap>

    <select id="selectByUserAndCode" resultType="com.xxfc.platform.activity.entity.IntegralUserStatus" parameterType="com.xxfc.platform.activity.entity.IntegralUserStatus">
      select * from integral_user_status
      where integral_rule_code = #{integralRuleCode} and user_id = #{userId} and integral_status =1
        <if test="startTime != null">
          and crt_time between #{startTime} and #{endTime}
        </if>
      order by upd_time DESC
    </select>
</mapper>