emis-service/emis-biz/src/main/resources/mapper/EmisTmsDriverMapper.xml
2024-06-14 06:16:48 +08:00

253 lines
17 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.xdadan.erp.emis.mapper.EmisTmsDriverMapper">
<resultMap type="EmisTmsDriver" id="EmisTmsDriverResult">
<result property="id" column="id" />
<result property="driverName" column="driver_name" />
<result property="country" column="country" />
<result property="maritalStatus" column="marital_status" />
<result property="birthDate" column="birth_date" />
<result property="healthStatus" column="health_status" />
<result property="eduBack" column="edu_back" />
<result property="height" column="height" />
<result property="weight" column="weight" />
<result property="politicsStatus" column="politics_status" />
<result property="ownerSiteCode" column="owner_site_code" />
<result property="driverOwnerType" column="driver_owner_type" />
<result property="idType" column="id_type" />
<result property="idNo" column="id_no" />
<result property="empNo" column="emp_no" />
<result property="drivingYears" column="driving_years" />
<result property="blStatus" column="bl_status" />
<result property="blMilitaryService" column="bl_military_service" />
<result property="driverPhone" column="driver_phone" />
<result property="driverCod" column="driver_cod" />
<result property="firstNum" column="first_num" />
<result property="secondNum" column="second_num" />
<result property="entryTime" column="entry_time" />
<result property="registerDate" column="register_date" />
<result property="orderNum" column="order_num" />
</resultMap>
<sql id="selectEmisTmsDriverVo">
select id, driver_name, country, marital_status, birth_date, health_status, edu_back, height, weight, politics_status, owner_site_code, driver_owner_type, id_type, id_no, emp_no, driving_years, bl_status, bl_military_service, driver_phone, driver_cod, first_num, second_num, entry_time, register_date, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_tms_driver
</sql>
<select id="selectEmisTmsDriverList" parameterType="EmisTmsDriver" resultMap="EmisTmsDriverResult">
<include refid="selectEmisTmsDriverVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="driverName != null and driverName != ''"> and driver_name like concat('%', #{driverName}, '%')</if>
<if test="country != null and country != ''"> and country like concat('%', #{country}, '%')</if>
<if test="maritalStatus != null and maritalStatus != ''"> and marital_status like concat('%', #{maritalStatus}, '%')</if>
<if test="birthDate != null "> and birth_date = #{birthDate}</if>
<if test="healthStatus != null and healthStatus != ''"> and health_status like concat('%', #{healthStatus}, '%')</if>
<if test="eduBack != null and eduBack != ''"> and edu_back like concat('%', #{eduBack}, '%')</if>
<if test="height != null and height != ''"> and height like concat('%', #{height}, '%')</if>
<if test="weight != null and weight != ''"> and weight like concat('%', #{weight}, '%')</if>
<if test="politicsStatus != null and politicsStatus != ''"> and politics_status like concat('%', #{politicsStatus}, '%')</if>
<if test="ownerSiteCode != null and ownerSiteCode != ''"> and owner_site_code like concat('%', #{ownerSiteCode}, '%')</if>
<if test="driverOwnerType != null and driverOwnerType != ''"> and driver_owner_type like concat('%', #{driverOwnerType}, '%')</if>
<if test="idType != null and idType != ''"> and id_type like concat('%', #{idType}, '%')</if>
<if test="idNo != null and idNo != ''"> and id_no like concat('%', #{idNo}, '%')</if>
<if test="empNo != null and empNo != ''"> and emp_no like concat('%', #{empNo}, '%')</if>
<if test="drivingYears != null and drivingYears != ''"> and driving_years like concat('%', #{drivingYears}, '%')</if>
<if test="blStatus != null and blStatus != ''"> and bl_status like concat('%', #{blStatus}, '%')</if>
<if test="blMilitaryService != null and blMilitaryService != ''"> and bl_military_service like concat('%', #{blMilitaryService}, '%')</if>
<if test="driverPhone != null and driverPhone != ''"> and driver_phone like concat('%', #{driverPhone}, '%')</if>
<if test="driverCod != null and driverCod != ''"> and driver_cod like concat('%', #{driverCod}, '%')</if>
<if test="firstNum != null and firstNum != ''"> and first_num like concat('%', #{firstNum}, '%')</if>
<if test="secondNum != null and secondNum != ''"> and second_num like concat('%', #{secondNum}, '%')</if>
<if test="entryTime != null "> and entry_time = #{entryTime}</if>
<if test="registerDate != null "> and register_date = #{registerDate}</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisTmsDriver" resultType="int">
select count(1) from emis_tms_driver
where del_flag='0'
and id = #{id}
and driver_name = #{driverName}
and country = #{country}
and marital_status = #{maritalStatus}
and birth_date = #{birthDate}
and health_status = #{healthStatus}
and edu_back = #{eduBack}
and height = #{height}
and weight = #{weight}
and politics_status = #{politicsStatus}
and owner_site_code = #{ownerSiteCode}
and driver_owner_type = #{driverOwnerType}
and id_type = #{idType}
and id_no = #{idNo}
and emp_no = #{empNo}
and driving_years = #{drivingYears}
and bl_status = #{blStatus}
and bl_military_service = #{blMilitaryService}
and driver_phone = #{driverPhone}
and driver_cod = #{driverCod}
and first_num = #{firstNum}
and second_num = #{secondNum}
and entry_time = #{entryTime}
and register_date = #{registerDate}
and order_num = #{orderNum}
and remark = #{remark}
and tenant_id = #{tenantId}
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
and create_site = #{createSite}
and update_site = #{updateSite}
limit 1
</select>
<select id="selectEmisTmsDriverById" parameterType="Long" resultMap="EmisTmsDriverResult">
select id, driver_name, country, marital_status, birth_date, health_status, edu_back, height, weight, politics_status, owner_site_code, driver_owner_type, id_type, id_no, emp_no, driving_years, bl_status, bl_military_service, driver_phone, driver_cod, first_num, second_num, entry_time, register_date, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_tms_driver a
where a.id = #{id}
</select>
<insert id="insertEmisTmsDriver" parameterType="EmisTmsDriver" useGeneratedKeys="true" keyProperty="id">
insert into emis_tms_driver
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="driverName != null and driverName != ''">driver_name,</if>
<if test="country != null and country != ''">country,</if>
<if test="maritalStatus != null and maritalStatus != ''">marital_status,</if>
<if test="birthDate != null">birth_date,</if>
<if test="healthStatus != null and healthStatus != ''">health_status,</if>
<if test="eduBack != null and eduBack != ''">edu_back,</if>
<if test="height != null and height != ''">height,</if>
<if test="weight != null and weight != ''">weight,</if>
<if test="politicsStatus != null and politicsStatus != ''">politics_status,</if>
<if test="ownerSiteCode != null and ownerSiteCode != ''">owner_site_code,</if>
<if test="driverOwnerType != null and driverOwnerType != ''">driver_owner_type,</if>
<if test="idType != null and idType != ''">id_type,</if>
<if test="idNo != null and idNo != ''">id_no,</if>
<if test="empNo != null and empNo != ''">emp_no,</if>
<if test="drivingYears != null and drivingYears != ''">driving_years,</if>
<if test="blStatus != null and blStatus != ''">bl_status,</if>
<if test="blMilitaryService != null and blMilitaryService != ''">bl_military_service,</if>
<if test="driverPhone != null and driverPhone != ''">driver_phone,</if>
<if test="driverCod != null and driverCod != ''">driver_cod,</if>
<if test="firstNum != null and firstNum != ''">first_num,</if>
<if test="secondNum != null and secondNum != ''">second_num,</if>
<if test="entryTime != null">entry_time,</if>
<if test="registerDate != null">register_date,</if>
<if test="orderNum != null">order_num,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="driverName != null and driverName != ''">#{driverName},</if>
<if test="country != null and country != ''">#{country},</if>
<if test="maritalStatus != null and maritalStatus != ''">#{maritalStatus},</if>
<if test="birthDate != null">#{birthDate},</if>
<if test="healthStatus != null and healthStatus != ''">#{healthStatus},</if>
<if test="eduBack != null and eduBack != ''">#{eduBack},</if>
<if test="height != null and height != ''">#{height},</if>
<if test="weight != null and weight != ''">#{weight},</if>
<if test="politicsStatus != null and politicsStatus != ''">#{politicsStatus},</if>
<if test="ownerSiteCode != null and ownerSiteCode != ''">#{ownerSiteCode},</if>
<if test="driverOwnerType != null and driverOwnerType != ''">#{driverOwnerType},</if>
<if test="idType != null and idType != ''">#{idType},</if>
<if test="idNo != null and idNo != ''">#{idNo},</if>
<if test="empNo != null and empNo != ''">#{empNo},</if>
<if test="drivingYears != null and drivingYears != ''">#{drivingYears},</if>
<if test="blStatus != null and blStatus != ''">#{blStatus},</if>
<if test="blMilitaryService != null and blMilitaryService != ''">#{blMilitaryService},</if>
<if test="driverPhone != null and driverPhone != ''">#{driverPhone},</if>
<if test="driverCod != null and driverCod != ''">#{driverCod},</if>
<if test="firstNum != null and firstNum != ''">#{firstNum},</if>
<if test="secondNum != null and secondNum != ''">#{secondNum},</if>
<if test="entryTime != null">#{entryTime},</if>
<if test="registerDate != null">#{registerDate},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
</trim>
</insert>
<update id="updateEmisTmsDriver" parameterType="EmisTmsDriver">
update emis_tms_driver
<trim prefix="SET" suffixOverrides=",">
<if test="driverName != null and driverName != ''">driver_name = #{driverName},</if>
<if test="country != null and country != ''">country = #{country},</if>
<if test="maritalStatus != null and maritalStatus != ''">marital_status = #{maritalStatus},</if>
<if test="birthDate != null">birth_date = #{birthDate},</if>
<if test="healthStatus != null and healthStatus != ''">health_status = #{healthStatus},</if>
<if test="eduBack != null and eduBack != ''">edu_back = #{eduBack},</if>
<if test="height != null and height != ''">height = #{height},</if>
<if test="weight != null and weight != ''">weight = #{weight},</if>
<if test="politicsStatus != null and politicsStatus != ''">politics_status = #{politicsStatus},</if>
<if test="ownerSiteCode != null and ownerSiteCode != ''">owner_site_code = #{ownerSiteCode},</if>
<if test="driverOwnerType != null and driverOwnerType != ''">driver_owner_type = #{driverOwnerType},</if>
<if test="idType != null and idType != ''">id_type = #{idType},</if>
<if test="idNo != null and idNo != ''">id_no = #{idNo},</if>
<if test="empNo != null and empNo != ''">emp_no = #{empNo},</if>
<if test="drivingYears != null and drivingYears != ''">driving_years = #{drivingYears},</if>
<if test="blStatus != null and blStatus != ''">bl_status = #{blStatus},</if>
<if test="blMilitaryService != null and blMilitaryService != ''">bl_military_service = #{blMilitaryService},</if>
<if test="driverPhone != null and driverPhone != ''">driver_phone = #{driverPhone},</if>
<if test="driverCod != null and driverCod != ''">driver_cod = #{driverCod},</if>
<if test="firstNum != null and firstNum != ''">first_num = #{firstNum},</if>
<if test="secondNum != null and secondNum != ''">second_num = #{secondNum},</if>
<if test="entryTime != null">entry_time = #{entryTime},</if>
<if test="registerDate != null">register_date = #{registerDate},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEmisTmsDriverById" parameterType="Long">
delete from emis_tms_driver where id = #{id}
</delete>
<delete id="deleteEmisTmsDriverByIds" parameterType="String">
delete from emis_tms_driver where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>