<?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.bussiness.mapper.TSymbolManageMapper">
    
    <resultMap type="com.ruoyi.bussiness.domain.TSymbolManage" id="TSymbolManageResult">
        <result property="id"    column="id"    />
        <result property="symbol"    column="symbol"    />
        <result property="minChargeNum"    column="min_charge_num"    />
        <result property="maxChargeNum"    column="max_charge_num"    />
        <result property="commission"    column="commission"    />
        <result property="sort"    column="sort"    />
        <result property="enable"    column="enable"    />
        <result property="remark"    column="remark"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="logo"    column="logo"    />
        <result property="market"    column="market"    />
    </resultMap>

    <sql id="selectTSymbolManageVo">
        select id, symbol, min_charge_num, max_charge_num, commission, sort, enable, remark, create_by, create_time, update_by, update_time, del_flag, logo, market from t_symbol_manage
    </sql>

    <select id="selectTSymbolManageList" parameterType="TSymbolManage" resultMap="TSymbolManageResult">
        <include refid="selectTSymbolManageVo"/>
        <where>
            and del_flag = '0'
            <if test="symbol != null  and symbol != ''"> and symbol = #{symbol}</if>
            <if test="minChargeNum != null "> and min_charge_num <![CDATA[ >= ]]> #{minChargeNum}</if>
            <if test="maxChargeNum != null "> and max_charge_num <![CDATA[ <= ]]> #{maxChargeNum}</if>
            <if test="sort != null "> and sort = #{sort}</if>
            <if test="enable != null  and enable != ''"> and enable = #{enable}</if>
            <if test="market != null  and market != ''"> and market = #{market}</if>
            <if test="params!=null and params!=''">
                <if test="params.commissionMin != null ">
                    and commission <![CDATA[ >= ]]> #{params.commissionMin}
                </if>
                <if test="params.commissionMax != null ">
                    and commission <![CDATA[ <= ]]> #{params.commissionMax}
                </if>
            </if>
        </where>
    </select>
    
    <select id="selectTSymbolManageById" parameterType="Long" resultMap="TSymbolManageResult">
        <include refid="selectTSymbolManageVo"/>
        where id = #{id}
    </select>
    <select id="selectSymbolList" resultType="java.lang.String"
            parameterType="com.ruoyi.bussiness.domain.TSymbolManage">
        select symbol from t_symbol_manage
        <where>
            and del_flag = '0'
            <if test="enable !=null and enable != ''">
                and enable = #{enable}
            </if>
        </where>
    </select>

    <insert id="insertTSymbolManage" parameterType="TSymbolManage" useGeneratedKeys="true" keyProperty="id">
        insert into t_symbol_manage
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="symbol != null">symbol,</if>
            <if test="minChargeNum != null">min_charge_num,</if>
            <if test="maxChargeNum != null">max_charge_num,</if>
            <if test="commission != null">commission,</if>
            <if test="sort != null">sort,</if>
            <if test="enable != null">enable,</if>
            <if test="remark != null">remark,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="logo != null">logo,</if>
            <if test="market != null">market,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="symbol != null">#{symbol},</if>
            <if test="minChargeNum != null">#{minChargeNum},</if>
            <if test="maxChargeNum != null">#{maxChargeNum},</if>
            <if test="commission != null">#{commission},</if>
            <if test="sort != null">#{sort},</if>
            <if test="enable != null">#{enable},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="logo != null">#{logo},</if>
            <if test="market != null">#{market},</if>
         </trim>
    </insert>

    <update id="updateTSymbolManage" parameterType="TSymbolManage">
        update t_symbol_manage
        <trim prefix="SET" suffixOverrides=",">
            <if test="symbol != null">symbol = #{symbol},</if>
            <if test="minChargeNum != null">min_charge_num = #{minChargeNum},</if>
            <if test="maxChargeNum != null">max_charge_num = #{maxChargeNum},</if>
            <if test="commission != null">commission = #{commission},</if>
            <if test="sort != null">sort = #{sort},</if>
            <if test="enable != null">enable = #{enable},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="logo != null">logo = #{logo},</if>
            <if test="market != null">market = #{market},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTSymbolManageById" parameterType="Long">
        delete from t_symbol_manage where id = #{id}
    </delete>

    <delete id="deleteTSymbolManageByIds" parameterType="String">
        update  t_symbol_manage set del_flag = '2' where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>