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

102 lines
5.0 KiB
XML

<?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.NodeMapper">
<resultMap type="com.ruoyi.system.domain.Node" id="NodeResult">
<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="buyCoin" column="buy_coin" />
<result property="buyAmount" column="buy_amount" />
<result property="buyNumber" column="buy_number" />
<result property="confirmTime" column="confirm_time" />
</resultMap>
<sql id="selectNodeVo">
select id, create_time, create_by, update_time, update_by, buy_coin, buy_amount, buy_number, confirm_time from node
</sql>
<select id="selectNodeList" parameterType="com.ruoyi.system.domain.Node" resultMap="NodeResult">
select n.*,tm.account as address from node
n LEFT JOIN t_member tm ON
n.user_id=tm.id
<where>
<if test="address != null and address != ''"> and tm.account = #{address}</if>
<if test="id != null "> and n.id = #{id}</if>
<if test="buyCoin != null and buyCoin != ''"> and n.buy_coin = #{buyCoin}</if>
<if test="buyAmount != null "> and n.buy_amount = #{buyAmount}</if>
<if test="buyNumber != null "> and n.buy_number = #{buyNumber}</if>
<if test="confirmTime != null "> and n.confirm_time = #{confirmTime}</if>
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and n.create_time between #{params.beginTime} and #{params.endTime}</if>
</where>
order by n.id desc
</select>
<select id="findNode" parameterType="com.ruoyi.system.domain.Node" resultMap="NodeResult">
<include refid="selectNodeVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="buyCoin != null and buyCoin != ''"> and buy_coin = #{buyCoin}</if>
<if test="buyAmount != null "> and buy_amount = #{buyAmount}</if>
<if test="buyNumber != null "> and buy_number = #{buyNumber}</if>
<if test="confirmTime != null "> and confirm_time = #{confirmTime}</if>
</where>
limit 1
</select>
<select id="selectNodeById" parameterType="Integer" resultMap="NodeResult">
<include refid="selectNodeVo"/>
where id = #{id}
</select>
<insert id="insertNode" parameterType="com.ruoyi.system.domain.Node" useGeneratedKeys="true" keyProperty="id">
insert into node
<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="buyCoin != null and buyCoin != ''">buy_coin,</if>
<if test="buyAmount != null">buy_amount,</if>
<if test="buyNumber != null">buy_number,</if>
<if test="confirmTime != null">confirm_time,</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="buyCoin != null and buyCoin != ''">#{buyCoin},</if>
<if test="buyAmount != null">#{buyAmount},</if>
<if test="buyNumber != null">#{buyNumber},</if>
<if test="confirmTime != null">#{confirmTime},</if>
</trim>
</insert>
<update id="updateNode" parameterType="com.ruoyi.system.domain.Node">
update node
<trim prefix="SET" suffixOverrides=",">
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="buyCoin != null and buyCoin != ''">buy_coin = #{buyCoin},</if>
<if test="buyAmount != null">buy_amount = #{buyAmount},</if>
<if test="buyNumber != null">buy_number = #{buyNumber},</if>
<if test="confirmTime != null">confirm_time = #{confirmTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteNodeByIds" parameterType="String">
delete from node where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>