ride-lease/ridelease-system/src/main/resources/mapper/system/RlAgentMapper.xml

100 lines
4.6 KiB
XML
Raw Normal View History

2024-09-19 11:25:42 +08:00
<?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.RlAgentMapper">
2024-09-26 09:24:11 +08:00
<resultMap type="RlAgentVO" id="RlAgentResult" autoMapping="true" />
2024-09-19 11:25:42 +08:00
<sql id="selectRlAgentVo">
2024-10-14 20:57:08 +08:00
select a.agent_id, a.name, a.service_phone, a.dispatch_fee, a.delivery_fee, a.city_id, a.contact, a.phone, a.userid, a.pay_channel, a.is_free_car,c.name cityName
from rl_agent a
left join rl_city c on c.city_id = a.city_id
2024-09-19 11:25:42 +08:00
</sql>
<select id="selectRlAgentList" parameterType="RlAgent" resultMap="RlAgentResult">
<include refid="selectRlAgentVo"/>
<where>
2024-10-14 20:57:08 +08:00
<if test="name != null and name != ''"> and a.name like concat('%', #{name}, '%')</if>
<if test="servicePhone != null and servicePhone != ''"> and a.service_phone = #{servicePhone}</if>
<if test="dispatchFee != null "> and a.dispatch_fee = #{dispatchFee}</if>
<if test="deliveryFee != null "> and a.delivery_fee = #{deliveryFee}</if>
<if test="cityId != null "> and a.city_id = #{cityId}</if>
<if test="contact != null and contact != ''"> and a.contact = #{contact}</if>
<if test="phone != null and phone != ''"> and a.phone = #{phone}</if>
<if test="userid != null "> and a.userid = #{userid}</if>
2024-09-19 11:25:42 +08:00
</where>
</select>
<select id="selectRlAgentByAgentId" parameterType="Long" resultMap="RlAgentResult">
<include refid="selectRlAgentVo"/>
2024-10-14 20:57:08 +08:00
where a.agent_id = #{agentId}
2024-09-19 11:25:42 +08:00
</select>
<select id="selectRlAgentByCityId" parameterType="Long" resultMap="RlAgentResult">
<include refid="selectRlAgentVo"/>
2024-10-14 20:57:08 +08:00
where a.city_id = #{cityId}
2024-09-19 11:25:42 +08:00
</select>
2024-10-16 16:13:46 +08:00
<select id="selectRlAgentByUserId" parameterType="Long" resultMap="RlAgentResult">
<include refid="selectRlAgentVo"/>
where a.userid = #{userid}
</select>
2024-09-19 11:25:42 +08:00
<insert id="insertRlAgent" parameterType="RlAgent" useGeneratedKeys="true" keyProperty="agentId">
insert into rl_agent
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="servicePhone != null">service_phone,</if>
<if test="dispatchFee != null">dispatch_fee,</if>
<if test="deliveryFee != null">delivery_fee,</if>
<if test="cityId != null">city_id,</if>
<if test="contact != null">contact,</if>
<if test="phone != null">phone,</if>
<if test="userid != null">userid,</if>
2024-09-23 20:09:45 +08:00
<if test="payChannel != null">pay_channel,</if>
<if test="isFreeCar != null">is_free_car,</if>
2024-09-19 11:25:42 +08:00
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="servicePhone != null">#{servicePhone},</if>
<if test="dispatchFee != null">#{dispatchFee},</if>
<if test="deliveryFee != null">#{deliveryFee},</if>
<if test="cityId != null">#{cityId},</if>
<if test="contact != null">#{contact},</if>
<if test="phone != null">#{phone},</if>
<if test="userid != null">#{userid},</if>
2024-09-23 20:09:45 +08:00
<if test="payChannel != null">#{payChannel},</if>
<if test="isFreeCar != null">#{isFreeCar},</if>
2024-09-19 11:25:42 +08:00
</trim>
</insert>
<update id="updateRlAgent" parameterType="RlAgent">
update rl_agent
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="servicePhone != null">service_phone = #{servicePhone},</if>
<if test="dispatchFee != null">dispatch_fee = #{dispatchFee},</if>
<if test="deliveryFee != null">delivery_fee = #{deliveryFee},</if>
<if test="cityId != null">city_id = #{cityId},</if>
<if test="contact != null">contact = #{contact},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="userid != null">userid = #{userid},</if>
2024-09-23 20:09:45 +08:00
<if test="payChannel != null">pay_channel = #{payChannel},</if>
<if test="isFreeCar != null">is_free_car = #{isFreeCar},</if>
2024-09-19 11:25:42 +08:00
</trim>
where agent_id = #{agentId}
</update>
<delete id="deleteRlAgentByAgentId" parameterType="Long">
delete from rl_agent where agent_id = #{agentId}
</delete>
<delete id="deleteRlAgentByAgentIds" parameterType="String">
delete from rl_agent where agent_id in
<foreach item="agentId" collection="array" open="(" separator="," close=")">
#{agentId}
</foreach>
</delete>
</mapper>