ride-lease/ridelease-system/src/main/resources/mapper/system/RlChannelWithdrawMapper.xml
2024-10-21 16:04:16 +08:00

103 lines
5.1 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.RlChannelWithdrawMapper">
<resultMap type="ChannelWithdrawVO" id="ChannelWithdrawResult" autoMapping="true">
<result property="withdrawHandlingCharge" column="withdraw_handling_charge" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
<result property="costRate" column="cost_rate" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
</resultMap>
<sql id="selectChannelWithdrawVo">
select
scw.channel_id,
scw.name,
scw.handling_charge_type,
scw.withdraw_handling_charge,
scw.enabled,
scw.cost_rate,
scw.picture,
scw.min_amount,
scw.max_amount,
scw.is_need_code
from rl_channel_withdraw scw
</sql>
<sql id="searchCondition">
<if test="query.channelId != null "> and scw.channel_id = #{query.channelId}</if>
<if test="query.name != null and query.name != ''"> and scw.name like concat('%', #{query.name}, '%')</if>
<if test="query.handlingChargeType != null and query.handlingChargeType != ''"> and scw.handling_charge_type = #{query.handlingChargeType}</if>
<if test="query.enabled != null "> and scw.enabled = #{query.enabled}</if>
</sql>
<select id="selectChannelWithdrawList" parameterType="ChannelWithdrawQuery" resultMap="ChannelWithdrawResult">
<include refid="selectChannelWithdrawVo"/>
<where>
<include refid="searchCondition"/>
</where>
</select>
<select id="selectChannelWithdrawByChannelId" parameterType="Long" resultMap="ChannelWithdrawResult">
<include refid="selectChannelWithdrawVo"/>
where channel_id = #{channelId}
</select>
<select id="selectAllChannelWithdrawList" resultMap="ChannelWithdrawResult">
<include refid="selectChannelWithdrawVo"/> where scw.enabled != 0
</select>
<insert id="insertChannelWithdraw" parameterType="ChannelWithdraw" useGeneratedKeys="true" keyProperty="channelId">
insert into rl_channel_withdraw
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="handlingChargeType != null and handlingChargeType != ''">handling_charge_type,</if>
<if test="withdrawHandlingCharge != null">withdraw_handling_charge,</if>
<if test="enabled != null">enabled,</if>
<if test="costRate != null">cost_rate,</if>
<if test="picture != null">picture,</if>
<if test="minAmount != null">min_amount,</if>
<if test="maxAmount != null">max_amount,</if>
<if test="isNeedCode != null">is_need_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="handlingChargeType != null and handlingChargeType != ''">#{handlingChargeType},</if>
<if test="withdrawHandlingCharge != null">#{withdrawHandlingCharge},</if>
<if test="enabled != null">#{enabled},</if>
<if test="costRate != null">#{costRate},</if>
<if test="picture != null">#{picture},</if>
<if test="minAmount != null">#{minAmount},</if>
<if test="maxAmount != null">#{maxAmount},</if>
<if test="isNeedCode != null">#{isNeedCode},</if>
</trim>
</insert>
<update id="updateChannelWithdraw" parameterType="ChannelWithdraw">
update rl_channel_withdraw
<trim prefix="SET" suffixOverrides=",">
<if test="data.name != null and data.name != ''">name = #{data.name},</if>
<if test="data.handlingChargeType != null and data.handlingChargeType != ''">handling_charge_type = #{data.handlingChargeType},</if>
<if test="data.withdrawHandlingCharge != null">withdraw_handling_charge = #{data.withdrawHandlingCharge},</if>
<if test="data.enabled != null">enabled = #{data.enabled},</if>
<if test="data.costRate != null">cost_rate = #{data.costRate},</if>
<if test="data.picture != null">picture = #{data.picture},</if>
<if test="data.minAmount != null">min_amount = #{data.minAmount},</if>
<if test="data.maxAmount != null">max_amount = #{data.maxAmount},</if>
<if test="data.isNeedCode != null">is_need_code = #{data.isNeedCode},</if>
</trim>
where channel_id = #{data.channelId}
</update>
<delete id="deleteChannelWithdrawByChannelId" parameterType="Long">
delete from rl_channel_withdraw where channel_id = #{channelId}
</delete>
<delete id="deleteChannelWithdrawByChannelIds" parameterType="String">
delete from rl_channel_withdraw where channel_id in
<foreach item="channelId" collection="array" open="(" separator="," close=")">
#{channelId}
</foreach>
</delete>
</mapper>