Helius
2022-05-27 4351e71d782741143a98f86f6648acd16689165f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?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.matrix.system.score.dao.ScoreVipDetailDao">
 
    <select id="selectUserTotalScore" resultType="java.lang.Integer">
        select IFNULL(sum(IFNULL(remain_score, 0 )),0) from score_vip_detail
        where  state=1 and vip_id=#{vipId}
 
 
    </select>
 
    <select id="selectEffectiveScore" resultType="com.matrix.system.score.entity.ScoreVipDetail">
        select *
        from score_vip_detail
        where state = 1  and vip_id = #{vipId}
         order by create_time
 
    </select>
 
 
    <select id="selectInvalidaVipScore" resultType="com.matrix.system.score.entity.ScoreVipDetail">
        select * from score_vip_detail where  state=1 and remain_score>0 and validite_time <![CDATA[ < now()]]>
    </select>
 
    <update id="invalidVipScore">
        update score_vip_detail set state = 2 , remain_score=0  where state=1 and validite_time <![CDATA[ < now()]]>
    </update>
 
</mapper>