<?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.yami.shop.user.comment.dao.UserScoreDetailMapper">

  <resultMap id="scoreDetailMap" type="com.yami.shop.user.comment.model.UserScoreDetail">
    <id column="user_score_detail_id" property="userScoreDetailId" />
    <result column="usable_score" property="usableScore"/>
    <result column="biz_id" property="bizId"/>
    <result column="create_time" property="createTime"/>
    <result column="expire_time" property="expireTime"/>
    <result column="status" property="status"/>
  </resultMap>

  <select id="listExpireScoreDetail" resultType="com.yami.shop.user.comment.model.UserScoreDetail">
      SELECT * FROM tz_user_score_detail WHERE
      create_time <![CDATA[<]]> #{expireTime} AND STATUS = 1  and usable_score > 0
  </select>

  <!-- 批量更新状态 -->
  <update id="updateExpireScoreDetail">
    update tz_user_score_detail set status = -1 WHERE
      create_time <![CDATA[<]]> #{expireTime} AND STATUS = 0
  </update>

</mapper>
