alive-admin/alive-server/target/classes/mapper/system/NodeBuyLogMapper.xml

180 lines
9.8 KiB
XML
Raw Normal View History

2024-05-27 16:26:14 +08:00
<?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.ruoyi.system.mapper.NodeBuyLogMapper">
<resultMap type="com.ruoyi.system.domain.NodeBuyLog" id="NodeBuyLogResult">
<result property="id" column="id" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="walletAddress" column="wallet_address" />
<result property="recommendId" column="recommend_id" />
<result property="indirectUserId" column="indirect_user_id" />
<result property="buyCount" column="buy_count" />
<result property="payCoin" column="pay_coin" />
<result property="buyAmount" column="buy_amount" />
<result property="nodeSettingId" column="node_setting_id" />
<result property="status" column="status" />
<result property="userId" column="user_id" />
<result property="hash" column="hash" />
<result property="orderNumber" column="order_number" />
<result property="inputAddress" column="input_address" />
<result property="outAddress" column="out_address" />
<result property="rebate" column="rebate" />
<result property="rbitAmount" column="rbit_amount" />
<result property="rbitOne" column="rbit_one" />
<result property="rbitTwo" column="rbit_two" />
<result property="nftAmount" column="nft_amount" />
<result property="nftOne" column="nft_one" />
<result property="nftTwo" column="nft_two" />
<result property="illustrate" column="illustrate" />
<result property="topSettlement" column="top_settlement" />
</resultMap>
<sql id="selectNodeBuyLogVo">
select id, create_time, create_by, update_time,top_settlement, update_by, wallet_address, recommend_id, indirect_user_id, buy_count, pay_coin, buy_amount, node_setting_id, status, user_id, hash, order_number, input_address, out_address, rebate, rbit_amount, rbit_one, rbit_two, nft_amount, nft_one, nft_two, illustrate from node_buy_log
</sql>
<select id="countLogTop" resultType="java.lang.Integer">
select COUNT(*) from node_buy_log WHERE top_settlement=0 and status=3 and id IN
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="selectNodeSubscribeList" parameterType="com.ruoyi.system.domain.NodeBuyLog" resultMap="NodeBuyLogResult">
select nbl.*,ns.node_name as nodeName,tm.account as address from node_buy_log
nbl LEFT JOIN node_setting ns ON nbl.node_setting_id=ns.id
LEFT JOIN t_member tm ON nbl.recommend_id=tm.id
<where>
<if test="id != null "> and nbl.id = #{id}</if>
<if test="walletAddress != null and walletAddress != ''"> and nbl.wallet_address = #{walletAddress}</if>
<if test="orderNumber != null and orderNumber != ''"> and nbl.order_number = #{orderNumber}</if>
<if test="hash != null and hash != ''"> and nbl.hash = #{hash}</if>
<if test="status != null"> and nbl.status = #{status}</if>
<if test="topUserId != null">
and nbl.user_id in(SELECT id FROM t_member WHERE id != #{topUserId} and all_pid like concat('%,', #{topUserId}, ',%'))
</if>
<if test="address != null and address != ''"> and tm.account = #{address}</if>
<if test="nodeName != null and nodeName != ''"> and ns.node_name = #{nodeName}</if>
<if test="recommendId != null "> and nbl.recommend_id = #{recommendId}</if>
<if test="buyCount != null "> and nbl.buy_count = #{buyCount}</if>
<if test="payCoin != null and payCoin != ''"> and nbl.pay_coin = #{payCoin}</if>
<if test="buyAmount != null "> and nbl.buy_amount = #{buyAmount}</if>
<if test="topSettlement != null "> and nbl.top_settlement = #{topSettlement}</if>
</where>
order by nbl.id desc
</select>
<select id="findNodeSubscribe" parameterType="com.ruoyi.system.domain.NodeBuyLog" resultMap="NodeBuyLogResult">
<include refid="selectNodeBuyLogVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="walletAddress != null and walletAddress != ''"> and wallet_address = #{walletAddress}</if>
<if test="recommendId != null "> and recommend_id = #{recommendId}</if>
<if test="buyCount != null "> and buy_count = #{buyCount}</if>
<if test="payCoin != null and payCoin != ''"> and pay_coin = #{payCoin}</if>
<if test="hash != null and hash != ''"> and hash = #{hash}</if>
<if test="buyAmount != null "> and buy_amount = #{buyAmount}</if>
<if test="topSettlement != null "> and top_settlement = #{topSettlement}</if>
</where>
limit 1
</select>
<select id="selectNodeSubscribeById" parameterType="Integer" resultMap="NodeBuyLogResult">
<include refid="selectNodeBuyLogVo"/>
where id = #{id}
</select>
<insert id="insertNodeSubscribe" parameterType="com.ruoyi.system.domain.NodeBuyLog" useGeneratedKeys="true" keyProperty="id">
insert into node_buy_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="walletAddress != null and walletAddress != ''">wallet_address,</if>
<if test="recommendId != null">recommend_id,</if>
<if test="indirectUserId != null">indirect_user_id,</if>
<if test="buyCount != null">buy_count,</if>
<if test="payCoin != null and payCoin != ''">pay_coin,</if>
<if test="buyAmount != null">buy_amount,</if>
<if test="nodeSettingId != null">node_setting_id,</if>
<if test="status != null">status,</if>
<if test="userId != null">user_id,</if>
<if test="hash != null">hash,</if>
<if test="orderNumber != null and orderNumber != ''">order_number,</if>
<if test="inputAddress != null">input_address,</if>
<if test="outAddress != null">out_address,</if>
<if test="rebate != null">rebate,</if>
<if test="rbitAmount != null">rbit_amount,</if>
<if test="rbitOne != null">rbit_one,</if>
<if test="rbitTwo != null">rbit_two,</if>
<if test="nftAmount != null">nft_amount,</if>
<if test="nftOne != null">nft_one,</if>
<if test="nftTwo != null">nft_two,</if>
<if test="illustrate != null">illustrate,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="walletAddress != null and walletAddress != ''">#{walletAddress},</if>
<if test="recommendId != null">#{recommendId},</if>
<if test="indirectUserId != null">#{indirectUserId},</if>
<if test="buyCount != null">#{buyCount},</if>
<if test="payCoin != null and payCoin != ''">#{payCoin},</if>
<if test="buyAmount != null">#{buyAmount},</if>
<if test="nodeSettingId != null">#{nodeSettingId},</if>
<if test="status != null">#{status},</if>
<if test="userId != null">#{userId},</if>
<if test="hash != null">#{hash},</if>
<if test="orderNumber != null and orderNumber != ''">#{orderNumber},</if>
<if test="inputAddress != null">#{inputAddress},</if>
<if test="outAddress != null">#{outAddress},</if>
<if test="rebate != null">#{rebate},</if>
<if test="rbitAmount != null">#{rbitAmount},</if>
<if test="rbitOne != null">#{rbitOne},</if>
<if test="rbitTwo != null">#{rbitTwo},</if>
<if test="nftAmount != null">#{nftAmount},</if>
<if test="nftOne != null">#{nftOne},</if>
<if test="nftTwo != null">#{nftTwo},</if>
<if test="illustrate != null">#{illustrate},</if>
</trim>
</insert>
<update id="updateNodeSubscribe" parameterType="com.ruoyi.system.domain.NodeBuyLog">
update node_buy_log
<trim prefix="SET" suffixOverrides=",">
<if test="topSettlement != null">top_settlement = #{topSettlement},</if>
<if test="status != null">status = #{status},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="hash != null">hash = #{hash},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteNodeSubscribeByIds" parameterType="String">
delete from node_buy_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="updateBuyLogTop">
update node_buy_log
<trim prefix="SET" suffixOverrides=",">
top_settlement = 1
</trim>
where id in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>