<?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.nq.dao.UserLeverApplyMapper">
|
|
<resultMap type="com.nq.pojo.UserLeverApply" id="UserLeverApplyResult">
|
<result property="id" column="id" />
|
<result property="userId" column="user_id" />
|
<result property="leverageRatio" column="leverage_ratio" />
|
<result property="applyStatus" column="apply_status" />
|
<result property="applyTime" column="apply_time" />
|
</resultMap>
|
|
<resultMap type="com.nq.vo.user.UserApplyLeverRes" id="UserLeverApplyVoResult">
|
<result property="userLeverApply.id" column="id" />
|
<result property="userLeverApply.userId" column="user_id" />
|
<result property="userLeverApply.leverageRatio" column="leverage_ratio" />
|
<result property="userLeverApply.applyStatus" column="apply_status" />
|
<result property="userLeverApply.applyTime" column="apply_time" />
|
<result property="user.agentName" column="agent_name" />
|
<result property="user.phone" column="phone" />
|
<result property="user.realName" column="real_name" />
|
<result property="user.leverageRatio" column="user_leverage" />
|
</resultMap>
|
|
<sql id="selectUserLeverApplyVo">
|
select id, user_id, leverage_ratio, apply_status, apply_time from user_lever_apply
|
</sql>
|
|
<select id="selectUserLeverApplyList" parameterType="com.nq.pojo.UserLeverApply" resultMap="UserLeverApplyResult">
|
<include refid="selectUserLeverApplyVo"/>
|
<where>
|
1=1
|
<if test="userId != null "> and user_id = #{userId}</if>
|
<if test="leverageRatio != null "> and leverage_ratio = #{leverageRatio}</if>
|
<if test="applyStatus != null "> and apply_status = #{applyStatus}</if>
|
<if test="applyTime != null "> and apply_time = #{applyTime}</if>
|
</where>
|
</select>
|
|
<select id="selectUserLeverApplyVoList" parameterType="com.nq.pojo.UserLeverApply" resultMap="UserLeverApplyVoResult">
|
select ula.*,u.agent_name,u.phone,u.real_name,u.leverage_ratio as 'user_leverage'
|
from user_lever_apply ula
|
left join user u on ula.user_id = u.id
|
<where>
|
<if test="userId != null "> and user_id = #{userId}</if>
|
<if test="leverageRatio != null "> and leverage_ratio = #{leverageRatio}</if>
|
<if test="applyStatus != null "> and apply_status = #{applyStatus}</if>
|
<if test="applyTime != null "> and apply_time = #{applyTime}</if>
|
</where>
|
ORDER BY id DESC
|
</select>
|
|
|
<select id="selectUserLeverApplyById" parameterType="Long" resultMap="UserLeverApplyResult">
|
<include refid="selectUserLeverApplyVo"/>
|
where id = #{id}
|
</select>
|
|
<insert id="insertUserLeverApply" parameterType="com.nq.pojo.UserLeverApply">
|
insert into user_lever_apply
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">id,</if>
|
<if test="userId != null">user_id,</if>
|
<if test="leverageRatio != null">leverage_ratio,</if>
|
<if test="applyStatus != null">apply_status,</if>
|
<if test="applyTime != null">apply_time,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id},</if>
|
<if test="userId != null">#{userId},</if>
|
<if test="leverageRatio != null">#{leverageRatio},</if>
|
<if test="applyStatus != null">#{applyStatus},</if>
|
<if test="applyTime != null">#{applyTime},</if>
|
</trim>
|
</insert>
|
|
<update id="updateUserLeverApply" parameterType="com.nq.pojo.UserLeverApply">
|
update user_lever_apply
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="userId != null">user_id = #{userId},</if>
|
<if test="leverageRatio != null">leverage_ratio = #{leverageRatio},</if>
|
<if test="applyStatus != null">apply_status = #{applyStatus},</if>
|
<if test="applyTime != null">apply_time = #{applyTime},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteUserLeverApplyById" parameterType="Long">
|
delete from user_lever_apply where id = #{id}
|
</delete>
|
|
<delete id="deleteUserLeverApplyByIds" parameterType="String">
|
delete from user_lever_apply where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
</mapper>
|