xiaoyong931011
2022-10-21 e7ca8ba2b3c3b446e39d4c3a3ea5e238adb2fc7c
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?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="cc.mrbird.febs.dapp.mapper.IgtOnHookPlanOrderDao">
 
    <select id="selectByState" resultType="cc.mrbird.febs.dapp.entity.IgtOnHookPlanOrder">
        SELECT
            a.*
        FROM igt_on_hook_plan_order a
        where a.state = #{state}
    </select>
 
    <update id="updateAvaAmountById">
        update igt_on_hook_plan_order
        set
            ava_amount = ava_amount - #{amount},
        where
            id = #{id}
          and ava_amount - #{amount} <![CDATA[ >= ]]> 0
    </update>
 
    <select id="selectByMemberId" resultType="cc.mrbird.febs.dapp.entity.IgtOnHookPlanOrder">
        SELECT
            a.*
        FROM igt_on_hook_plan_order a
        where a.member_id = #{memberId}
        and a.state = 1
        order by id desc
            limit 1
    </select>
 
    <update id="AddProfitById">
        update igt_on_hook_plan_order
        set
            profit = profit + #{profit}
        where
            id = #{id}
    </update>
 
    <select id="selectSumProfitByMemberId" resultType="java.math.BigDecimal">
        SELECT
            ifnull(sum(a.profit),0)
        FROM igt_on_hook_plan_order a
        where a.member_id = #{memberId}
    </select>
 
</mapper>