| | |
| | | |
| | | <!-- <association property="userInfo" column="hb_uid" resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap"/> --> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | <resultMap id="BaseDTOResultMap" type="com.yeshi.fanli.dto.HongBaoDTO"> |
| | | <id column="hb_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="hb_urank" property="urank" jdbcType="INTEGER" /> |
| | | <result column="hb_money" property="money" jdbcType="DECIMAL" /> |
| | | <result column="hb_type" property="type" jdbcType="INTEGER" /> |
| | | <result column="hb_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="hb_version" property="version" jdbcType="INTEGER" /> |
| | | <result column="hb_beizhu" property="beizhu" jdbcType="VARCHAR" /> |
| | | <result column="hb_pre_get_time" property="preGetTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="hb_get_time" property="getTime" jdbcType="TIMESTAMP" /> |
| | | <result column="hb_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="hb_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | |
| | | <result column="orderId" property="orderId" jdbcType="VARCHAR" /> |
| | | |
| | | <result column="payMoney" property="payMoney" jdbcType="DECIMAL" /> |
| | | |
| | | <result column="settlement" property="settlement" jdbcType="DECIMAL" /> |
| | | |
| | | <association property="userInfo" column="hb_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="hb_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="parent" column="hb_pid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2"> |
| | | <id column="hb_pid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <sql id="Base_Column_List">hb_id,hb_uid,hb_urank,hb_pid,hb_money,hb_type,hb_state,hb_version,hb_beizhu,hb_pre_get_time,hb_get_time,hb_create_time,hb_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT} for |
| | | update |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="listChildrenById" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_hongbao_v2 where hb_pid = #{0} |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <select id="listCanBalanceHongBaoByType" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | FROM yeshi_ec_hongbao_v2 h WHERE h.`hb_version`=2 AND |
| | | h.`hb_type`=#{type} AND (h.`hb_state`=2) AND |
| | | h.`hb_pre_get_time` IS NOT |
| | | NULL AND h.`hb_pre_get_time` |
| | | <![CDATA[ <]]> |
| | | NOW() limit #{count} |
| | | </select> |
| | | |
| | | <!-- 获取用户奖金列表 --> |
| | | <select id="listJiangJinByUid" resultMap="BaseDTOResultMap"> |
| | | SELECT |
| | | hhh.*,co.`co_order_no` AS orderId,co.`co_payment` AS |
| | | payMoney,co.`co_settlement` AS settlement FROM |
| | | ( |
| | | SELECT |
| | | hh.*,IF(h.`hb_id` IS NOT NULL,h.`hb_id`,hh.hb_id) AS hid FROM |
| | | ( |
| | | SELECT |
| | | h.* FROM yeshi_ec_hongbao_v2 h WHERE h.hb_uid=#{uid} and |
| | | (h.`hb_type`=6 OR h.`hb_type`=7 |
| | | OR h.`hb_type`=20 OR h.`hb_type`=21 OR |
| | | h.`hb_type`=22) AND |
| | | h.`hb_version`=2 ORDER BY h.`hb_create_time` DESC |
| | | limit #{start},#{count} |
| | | ) hh |
| | | LEFT JOIN yeshi_ec_hongbao_v2 h ON |
| | | hh.hb_pid IS NOT NULL AND |
| | | h.`hb_id`=hh.hb_pid |
| | | ) hhh LEFT JOIN |
| | | yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id`=hhh.hid |
| | | LEFT JOIN |
| | | yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | </select> |
| | | |
| | | |
| | | <!-- 获取用户奖金列表 --> |
| | | <select id="countJiangJinByUid" resultType="java.lang.Long"> |
| | | SELECT count(h.hb_id) |
| | | FROM yeshi_ec_hongbao_v2 h WHERE h.hb_uid=#{0} and (h.`hb_type`=6 OR |
| | | h.`hb_type`=7 |
| | | OR h.`hb_type`=20 OR h.`hb_type`=21 OR h.`hb_type`=22) |
| | | AND |
| | | h.`hb_version`=2 |
| | | </select> |
| | | |
| | | <!-- 获取总的提成金额 --> |
| | | <select id="getTotalTiChengMoney" resultType="java.math.BigDecimal" |
| | | parameterType="java.lang.Long"> |
| | | SELECT IF(a.money IS NULL,0,a.money ) FROM (SELECT |
| | | SUM(h.`hb_money`) AS money FROM `yeshi_ec_hongbao_v2` h WHERE |
| | | h.`hb_uid`=#{0} |
| | | AND h.`hb_state`=3 AND (h.`hb_type`=20 OR |
| | | h.`hb_type`=21 OR h.`hb_type`=22 OR |
| | | h.`hb_type`=6 OR h.`hb_type`=7)) a |
| | | </select> |
| | | |
| | | <!-- 获取总的提成笔数 --> |
| | | <select id="getTotalTiChengCount" resultType="java.lang.Integer" |
| | | parameterType="java.lang.Long"> |
| | | SELECT |
| | | count(*) FROM `yeshi_ec_hongbao_v2` h |
| | | WHERE |
| | | h.`hb_uid`=#{0} AND (h.`hb_type`=20 OR h.`hb_type`=21 OR |
| | | h.`hb_type`=22 OR |
| | | h.`hb_type`=6 OR h.`hb_type`=7) |
| | | </select> |
| | | |
| | | <!-- 获取还未到账的提成金额 --> |
| | | <select id="getUnGetTiChengMoney" resultType="java.math.BigDecimal" |
| | | parameterType="java.lang.Long"> |
| | | SELECT IF(a.money IS NULL,0,a.money ) FROM (SELECT |
| | | SUM(h.`hb_money`) AS money FROM `yeshi_ec_hongbao_v2` h WHERE |
| | | h.`hb_uid`=#{0} |
| | | AND (h.`hb_state`=1 OR h.hb_state=2 )AND |
| | | (h.`hb_type`=20 OR h.`hb_type`=21 OR |
| | | h.`hb_type`=22 OR h.`hb_type`=6 OR |
| | | h.`hb_type`=7)) a |
| | | </select> |
| | | |
| | | |
| | | <select id="getTotalFanLiMoney" resultType="java.math.BigDecimal" |
| | | parameterType="java.lang.Long"> |
| | | SELECT SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h |
| | | WHERE h.`hb_uid`=#{uid} AND h.`hb_type`=1 AND h.`hb_state`=3 |
| | | </select> |
| | | |
| | | <select id="getUnRecievedFanLiMoney" resultType="java.math.BigDecimal" |
| | | parameterType="java.lang.Long"> |
| | | SELECT SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h |
| | | WHERE h.`hb_uid`=#{uid} AND h.`hb_type`=1 AND (h.`hb_state`=1 OR |
| | | h.`hb_state`=2) |
| | | </select> |
| | | |
| | | |
| | | <select id="listUidCanBanlanceShareAndInvite" resultType="java.lang.Long" |
| | | parameterType="java.lang.Integer"> |
| | | |
| | | SELECT DISTINCT( h.`hb_uid`) FROM yeshi_ec_hongbao_v2 h |
| | | WHERE |
| | | (`hb_type`=6 OR |
| | | `hb_type`=7 OR `hb_type`=20 OR `hb_type`=21 OR |
| | | `hb_type`=22 ) AND |
| | | `hb_version`=2 AND (hb_state=1 OR hb_state=2) AND |
| | | hb_pre_get_time IS |
| | | NOT NULL AND hb_pre_get_time>0 AND |
| | | NOW()>=hb_pre_get_time limit #{0} |
| | | |
| | | </select> |
| | | |
| | | |
| | | <select id="listCanBalanceHongBaoByTypeAndUid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_hongbao_v2 where hb_uid=#{uid} and `version`=2 |
| | | |
| | | <foreach collection="types" item="type" open=" and (" |
| | | separator=" or " close=")"> |
| | | hb_type = |
| | | #{type} |
| | | </foreach> |
| | | |
| | | and |
| | | (hb_state=1 or hb_state=2) and |
| | | hb_pre_get_time IS NOT NULL AND |
| | | hb_pre_get_time>0 AND |
| | | NOW()>=hb_pre_get_time limit |
| | | #{count} |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT}</delete> |
| | | yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_hongbao_v2 |
| | | (hb_id,hb_uid,hb_urank,hb_pid,hb_money,hb_type,hb_state,hb_version,hb_beizhu,hb_pre_get_time,hb_get_time,hb_create_time,hb_update_time) |