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

97 lines
4.5 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">
<resultMap type="RlAgent" id="RlAgentResult">
<result property="agentId" column="agent_id" />
<result property="name" column="name" />
<result property="servicePhone" column="service_phone" />
<result property="dispatchFee" column="dispatch_fee" />
<result property="deliveryFee" column="delivery_fee" />
<result property="cityId" column="city_id" />
<result property="contact" column="contact" />
<result property="phone" column="phone" />
<result property="sysUserid" column="sys_userid" />
</resultMap>
<sql id="selectRlAgentVo">
select agent_id, name, service_phone, dispatch_fee, delivery_fee, city_id, contact, phone, sys_userid from rl_agent
</sql>
<select id="selectRlAgentList" parameterType="RlAgent" resultMap="RlAgentResult">
<include refid="selectRlAgentVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="servicePhone != null and servicePhone != ''"> and service_phone = #{servicePhone}</if>
<if test="dispatchFee != null "> and dispatch_fee = #{dispatchFee}</if>
<if test="deliveryFee != null "> and delivery_fee = #{deliveryFee}</if>
<if test="cityId != null "> and city_id = #{cityId}</if>
<if test="contact != null and contact != ''"> and contact = #{contact}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="sysUserid != null "> and sys_userid = #{sysUserid}</if>
</where>
</select>
<select id="selectRlAgentByAgentId" parameterType="Long" resultMap="RlAgentResult">
<include refid="selectRlAgentVo"/>
where agent_id = #{agentId}
</select>
<select id="selectRlAgentByCityId" parameterType="Long" resultMap="RlAgentResult">
<include refid="selectRlAgentVo"/>
where city_id = #{cityId}
</select>
<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="sysUserid != null">sys_userid,</if>
</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="sysUserid != null">#{sysUserid},</if>
</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="sysUserid != null">sys_userid = #{sysUserid},</if>
</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>