<?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.IgtOnHookPlanOrderItemDao">
|
|
<select id="selectByOrderIdAndMemberIdAndState" resultType="cc.mrbird.febs.dapp.entity.IgtOnHookPlanOrderItem">
|
SELECT
|
a.*
|
FROM igt_on_hook_plan_order_item a
|
where a.order_id = #{orderId}
|
and a.member_id = #{memberId}
|
and a.state = #{state}
|
order by order_num asc
|
limit 1
|
</select>
|
|
<select id="selectTotalProfitByByOrderIdAndMemberIdAndState" resultType="java.math.BigDecimal">
|
SELECT
|
ifnull(sum(a.profit),0)
|
FROM igt_on_hook_plan_order_item a
|
where a.order_id = #{orderId}
|
and a.member_id = #{memberId}
|
and a.is_goal = #{isGoal}
|
and a.state = #{state}
|
</select>
|
|
<select id="selectTotalAmountByByOrderIdAndMemberIdAndState" resultType="java.math.BigDecimal">
|
SELECT
|
ifnull(sum(a.amount),0)
|
FROM igt_on_hook_plan_order_item a
|
where a.order_id = #{orderId}
|
and a.member_id = #{memberId}
|
and a.is_goal = #{isGoal}
|
and a.state = #{state}
|
</select>
|
|
<select id="selectByMemberIdAndBelongNum" resultType="cc.mrbird.febs.dapp.entity.IgtOnHookPlanOrderItem">
|
SELECT
|
a.*
|
FROM igt_on_hook_plan_order_item a
|
where
|
a.member_id = #{memberId}
|
and a.belong_num = #{recordNum}
|
limit 1
|
</select>
|
|
<select id="selectTotalProfitByMemberIdAndStateAndIsgoal" resultType="java.math.BigDecimal">
|
SELECT
|
ifnull(sum(a.profit),0)
|
FROM igt_on_hook_plan_order_item a
|
where a.member_id = #{memberId}
|
and a.is_goal = #{isGoal}
|
and a.state = #{state}
|
</select>
|
|
<select id="selectByIgtIdAndMemberId" resultType="cc.mrbird.febs.dapp.entity.IgtOnHookPlanOrderItem">
|
SELECT
|
a.*
|
FROM igt_on_hook_plan_order_item a
|
where a.order_id = #{orderId}
|
and a.member_id = #{memberId}
|
order by create_time desc
|
</select>
|
|
<select id="selectTotalAmountByCreateTimeAndOrderId" resultType="java.math.BigDecimal">
|
SELECT
|
ifnull(sum(a.amount),0)
|
FROM igt_on_hook_plan_order_item a
|
<where>
|
a.order_id = #{orderId}
|
and a.create_time < #{endTime}
|
<if test="startTime != null">
|
and a.create_time > #{startTime}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectByIsgoalAndOrderId" resultType="java.lang.Long">
|
SELECT
|
a.id
|
FROM igt_on_hook_plan_order_item a
|
where a.order_id = #{orderId}
|
and a.is_goal = #{isGoal}
|
order by create_time desc
|
</select>
|
|
<select id="selectByCreateTimeAndIsgoaAndOrderId" resultType="cc.mrbird.febs.dapp.entity.IgtOnHookPlanOrderItem">
|
SELECT
|
a.*
|
FROM igt_on_hook_plan_order_item a
|
where a.order_id = #{orderId}
|
and a.is_goal = #{isGoal}
|
and a.id < #{id}
|
order by a.id desc
|
limit 1
|
</select>
|
|
<select id="selectOneByIgtIdAndMemberId" resultType="cc.mrbird.febs.dapp.entity.IgtOnHookPlanOrderItem">
|
SELECT
|
a.*
|
FROM igt_on_hook_plan_order_item a
|
where a.order_id = #{orderId}
|
and a.member_id = #{memberId}
|
order by a.id desc
|
limit 1
|
</select>
|
|
<select id="selectTotalAmountByIDAndOrderId" resultType="java.math.BigDecimal">
|
SELECT
|
ifnull(sum(a.amount),0)
|
FROM igt_on_hook_plan_order_item a
|
<where>
|
a.order_id = #{orderId}
|
and a.id < #{end}
|
<if test="start != null">
|
and a.id > #{start}
|
</if>
|
</where>
|
</select>
|
|
|
</mapper>
|