2021-12-26 22:15:49 +08:00

159 lines
7.6 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.carpool.mapper.PDriverMapper">
<resultMap type="PDriver" id="PDriverResult">
<result property="id" column="id" />
<result property="driverId" column="driver_id" />
<result property="name" column="name" />
<result property="sex" column="sex" />
<result property="idCard" column="id_card" />
<result property="age" column="age" />
<result property="state" column="state" />
<result property="phone" column="phone" />
<result property="numberPlate" column="number_plate" />
<result property="city" column="city" />
<result property="province" column="province" />
<result property="country" column="country" />
<result property="isBlacklist" column="is_blacklist" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="openId" column="open_id" />
</resultMap>
<sql id="selectPDriverVo">
select id, driver_id, name, sex, id_card, age, phone,number_plate,city,state,open_id,province, country, is_blacklist, create_time, update_time from p_driver
</sql>
<select id="selectPDriverList" parameterType="PDriver" resultMap="PDriverResult">
<include refid="selectPDriverVo"/>
<where>
<if test="driverId != null and driverId != ''"> and driver_id = #{driverId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="sex != null "> and sex = #{sex}</if>
<if test="numberPlate != null "> and number_plate = #{numberPlate}</if>
<if test="state != null "> and state = #{state}</if>
<if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
<if test="age != null "> and age = #{age}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="city != null and city != ''"> and city = #{city}</if>
<if test="province != null and province != ''"> and province = #{province}</if>
<if test="country != null and country != ''"> and country = #{country}</if>
<if test="isBlacklist != null "> and is_blacklist = #{isBlacklist}</if>
</where>
</select>
<select id="selectPDriverById" parameterType="Long" resultMap="PDriverResult">
<include refid="selectPDriverVo"/>
where id = #{id}
</select>
<insert id="insertPDriver" parameterType="PDriver">
insert into p_driver
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="driverId != null">driver_id,</if>
<if test="name != null">name,</if>
<if test="sex != null">sex,</if>
<if test="numberPlate != null">number_plate,</if>
<if test="idCard != null">id_card,</if>
<if test="age != null">age,</if>
<if test="state != null">state,</if>
<if test="phone != null">phone,</if>
<if test="city != null">city,</if>
<if test="province != null">province,</if>
<if test="country != null">country,</if>
<if test="isBlacklist != null">is_blacklist,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="openId != null and openId != '' ">open_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="driverId != null">#{driverId},</if>
<if test="name != null">#{name},</if>
<if test="sex != null">#{sex},</if>
<if test="numberPlate != null">#{numberPlate},</if>
<if test="state != null">#{state},</if>
<if test="idCard != null">#{idCard},</if>
<if test="age != null">#{age},</if>
<if test="phone != null">#{phone},</if>
<if test="city != null">#{city},</if>
<if test="province != null">#{province},</if>
<if test="country != null">#{country},</if>
<if test="isBlacklist != null">#{isBlacklist},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="openId != null and openId != '' ">#{openId},</if>
</trim>
</insert>
<update id="updatePDriver" parameterType="PDriver">
update p_driver
<trim prefix="SET" suffixOverrides=",">
<if test="driverId != null">driver_id = #{driverId},</if>
<if test="name != null">name = #{name},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="numberPlate != null">number_plate = #{numberPlate},</if>
<if test="state != null">state = #{state},</if>
<if test="idCard != null">id_card = #{idCard},</if>
<if test="age != null">age = #{age},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="city != null">city = #{city},</if>
<if test="province != null">province = #{province},</if>
<if test="country != null">country = #{country},</if>
<if test="isBlacklist != null">is_blacklist = #{isBlacklist},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePDriverById" parameterType="Long">
delete from p_driver where id = #{id}
</delete>
<delete id="deletePDriverByIds" parameterType="String">
delete from p_driver where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getDriverInfo" parameterType="PDriver" resultMap="PDriverResult">
<include refid="selectPDriverVo"/>
<where>
<if test="driverId != null and driverId != ''"> and driver_id = #{driverId}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="sex != null "> and sex = #{sex}</if>
<if test="numberPlate != null "> and number_plate = #{sex}</if>
<if test="state != null "> and state = #{state}</if>
<if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
<if test="age != null "> and age = #{age}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="city != null and city != ''"> and city = #{city}</if>
<if test="province != null and province != ''"> and province = #{province}</if>
<if test="country != null and country != ''"> and country = #{country}</if>
<if test="isBlacklist != null "> and is_blacklist = #{isBlacklist}</if>
<if test="openId != null and openId != '' "> and open_id = #{openId}</if>
</where>
</select>
<update id="agreePDriver" parameterType="PDriver">
update p_driver SET state = 1 where driver_id = #{driverId}
</update>
<select id="getDriverInfoByOpenId" parameterType="String" resultMap="PDriverResult">
<include refid="selectPDriverVo"/>
where open_id = #{openId}
</select>
</mapper>