<?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.xcong.excoin.common.system.dao.WalletDetailDao">
|
<!-- 定义WtWalletDetail 的复杂关联map -->
|
<resultMap type="com.xcong.excoin.common.system.entity.WtWalletDetail" id="WtWalletDetailMap">
|
<id property="id" column="id"/>
|
<result property="address" column="address"/>
|
<result property="symbol" column="symbol"/>
|
<result property="balance" column="balance"/>
|
<result property="show" column="show"/>
|
</resultMap>
|
|
|
<!-- 字段sql -->
|
<sql id="columns">
|
id,
|
address,
|
symbol,
|
balance,
|
main,
|
is_show
|
</sql>
|
|
<!-- 属性sql -->
|
<sql id="propertys">
|
#{item.id},
|
#{item.address},
|
#{item.symbol},
|
#{item.balance},
|
#{item.main},
|
#{item.isShow}
|
</sql>
|
|
|
<!-- 插入方法 -->
|
<insert id="insert" parameterType="com.xcong.excoin.common.system.entity.WtWalletDetail"
|
useGeneratedKeys="true" keyProperty="item.id">
|
INSERT INTO wt_wallet_detail (
|
<include refid="columns"></include>
|
)
|
VALUES (
|
<include refid="propertys"></include>
|
)
|
</insert>
|
|
|
<!-- 批量插入 -->
|
<insert id="batchInsert" parameterType="java.util.List">
|
INSERT INTO wt_wallet_detail (
|
<include refid="columns"></include>
|
)
|
VALUES
|
<foreach collection="list" item="item" index="index" separator=",">(
|
<include refid="propertys"></include>
|
)
|
</foreach>
|
</insert>
|
|
<!-- 根据对象更新 部分更新 -->
|
<update id="updateByModel" parameterType="String">
|
UPDATE wt_wallet_detail
|
<set>
|
<if test="record.address != null and record.address != '' ">
|
address = #{record.address},
|
</if>
|
<if test="record.symbol != null and record.symbol != '' ">
|
symbol = #{record.symbol},
|
</if>
|
<if test="record.balance != null ">
|
balance = #{record.balance},
|
</if>
|
<if test="record.isShow != null ">
|
is_show = #{record.isShow},
|
</if>
|
</set>
|
WHERE id=#{record.id}
|
</update>
|
|
<!-- 批量删除 -->
|
<delete id="deleteByIds" parameterType="java.util.List">
|
delete from wt_wallet_detail where id in
|
<foreach collection="list" index="index" item="item" open="("
|
separator="," close=")">
|
#{item}
|
</foreach>
|
</delete>
|
|
<!-- 根据id删除-->
|
<delete id="deleteById" parameterType="String">
|
DELETE FROM wt_wallet_detail
|
where id=#{id}
|
</delete>
|
|
|
|
|
|
<!-- 根据id查询-->
|
<select id="selectById" resultMap="WtWalletDetailMap">
|
select
|
<include refid="columns"></include>
|
from wt_wallet_detail
|
where id=#{id}
|
</select>
|
|
<select id="selectByAddressAndSymbol" resultMap="WtWalletDetailMap">
|
select
|
<include refid="columns"></include>
|
from wt_wallet_detail
|
where address=#{address} and symbol = #{symbol}
|
</select>
|
|
|
<!-- 根据对象查询-->
|
<select id="selectByModel" resultMap="WtWalletDetailMap">
|
select
|
<include refid="columns"></include>
|
from wt_wallet_detail
|
<where>
|
<if test="address !=null and address != ''">
|
and address = #{address}
|
</if>
|
<if test="symbol !=null and symbol != ''">
|
and symbol = #{symbol}
|
</if>
|
</where>
|
order by main desc
|
</select>
|
|
<update id="updateWalletBalance" parameterType="map">
|
update wt_wallet_detail set balance = balance + #{balance} where id = #{id}
|
</update>
|
</mapper>
|