2024-08-01 17:24:41 +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="cn.iocoder.yudao.module.custom.mapper.CarMainMapper">
|
|
|
|
|
|
2024-08-02 18:31:12 +08:00
|
|
|
<sql id="baseCarMainColumn">
|
|
|
|
|
tbcm.id,
|
|
|
|
|
tbcm.engine_number,
|
|
|
|
|
tbcm.vin,
|
|
|
|
|
tbcm.license_number,
|
|
|
|
|
tbcm.car_model,
|
|
|
|
|
tbcm.maintenance_date,
|
|
|
|
|
tbcm.maintenance_mileage,
|
|
|
|
|
tbcm.inspection_date,
|
|
|
|
|
tbcm.insurance_date,
|
|
|
|
|
tbcm.check_date,
|
|
|
|
|
tbcm.next_maintenance_date,
|
|
|
|
|
tbcm.next_maintenance_mileage,
|
|
|
|
|
tbcm.next_inspection_date,
|
|
|
|
|
tbcm.insurance_expiry_date,
|
|
|
|
|
tbcm.next_check_date,
|
|
|
|
|
tbcm.car_brand,
|
|
|
|
|
tbcm.car_nature,
|
|
|
|
|
tbcm.car_category,
|
|
|
|
|
tbcm.car_register_date,
|
|
|
|
|
tbcm.car_license_img,
|
|
|
|
|
tbcm.recently_handled_business,
|
|
|
|
|
tbcm.recently_handle_business_time,
|
|
|
|
|
tbcm.deleted,
|
|
|
|
|
tbcm.creator,
|
|
|
|
|
tbcm.create_time,
|
|
|
|
|
tbcm.updater,
|
|
|
|
|
tbcm.update_time
|
2024-08-01 17:24:41 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="findPage" resultType="cn.iocoder.yudao.module.custom.vo.CarMainRespVO">
|
|
|
|
|
SELECT
|
2024-08-02 18:31:12 +08:00
|
|
|
<include refid="baseCarMainColumn"></include>
|
|
|
|
|
FROM `base_car_main` tbcm
|
2024-08-01 17:24:41 +08:00
|
|
|
WHERE
|
2024-08-02 18:31:12 +08:00
|
|
|
tbcm.deleted = 0
|
2024-08-01 17:24:41 +08:00
|
|
|
<if test="dto.licenseNumber != null and dto.licenseNumber != ''">
|
2024-08-02 18:31:12 +08:00
|
|
|
AND tbcm.license_number LIKE CONCAT('%',#{dto.licenseNumber},'%')
|
2024-08-01 17:24:41 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="dto.carBrand != null and dto.carBrand != ''">
|
2024-08-02 18:31:12 +08:00
|
|
|
AND tbcm.car_brand = #{dto.carBrand}
|
2024-08-01 17:24:41 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="dto.carCategory != null and dto.carCategory != ''">
|
2024-08-02 18:31:12 +08:00
|
|
|
AND tbcm.car_category = #{dto.carCategory}
|
2024-08-01 17:24:41 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="dto.recentlyHandledBusiness != null and dto.recentlyHandledBusiness != ''">
|
2024-08-02 18:31:12 +08:00
|
|
|
AND tbcm.recently_handled_business = #{dto.recentlyHandledBusiness}
|
2024-08-01 17:24:41 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="dto.recentlyHandleBusinessTime != null">
|
2024-08-02 18:31:12 +08:00
|
|
|
AND tbcm.recently_handle_business_time = #{dto.recentlyHandleBusinessTime}
|
2024-08-01 17:24:41 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="dto.vin != null and dto.vin != ''">
|
2024-08-02 18:31:12 +08:00
|
|
|
AND tbcm.vin LIKE CONCAT('%',#{dto.vin},'%')
|
2024-08-01 17:24:41 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="dto.recentlyHandledBusiness != null and dto.recentlyHandledBusiness != ''">
|
2024-08-02 18:31:12 +08:00
|
|
|
AND tbcm.tenant_id = #{dto.tenant}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="dto.carModel != null and dto.carModel != ''">
|
|
|
|
|
AND tbcm.car_model = #{dto.carModel}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="dto.carNature != null and dto.carNature != ''">
|
|
|
|
|
AND tbcm.car_nature = #{dto.carNature}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="dto.engineNumber != null and dto.engineNumber != ''">
|
|
|
|
|
AND tbcm.engine_number LIKE CONCAT('%',#{dto.engineNumber},'%')
|
|
|
|
|
</if>
|
|
|
|
|
ORDER BY
|
|
|
|
|
tbcm.car_register_date DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="isDataKeyValueRepeat" resultType="cn.iocoder.yudao.module.custom.entity.CarMain">
|
|
|
|
|
SELECT
|
|
|
|
|
tbcm.id
|
|
|
|
|
FROM `base_car_main` tbcm
|
|
|
|
|
WHERE
|
|
|
|
|
tbcm.deleted = 0
|
|
|
|
|
<if test="dto.licenseNumber != null and dto.licenseNumber != ''">
|
|
|
|
|
AND tbcm.license_number = #{dto.licenseNumber}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="dto.vin != null and dto.vin != ''">
|
|
|
|
|
AND tbcm.vin = #{dto.vin}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="dto.engineNumber != null and dto.engineNumber != ''">
|
|
|
|
|
AND tbcm.engine_number = #{dto.engineNumber}
|
2024-08-01 17:24:41 +08:00
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</select>
|
2024-08-03 21:51:22 +08:00
|
|
|
<select id="selectListByCusId" resultType="cn.iocoder.yudao.module.custom.vo.CarMainRespVO">
|
2024-08-03 16:16:37 +08:00
|
|
|
SELECT
|
2024-08-05 18:51:33 +08:00
|
|
|
<include refid="baseCarMainColumn"></include>,
|
|
|
|
|
main.is_owner AS isOwner
|
2024-08-03 16:16:37 +08:00
|
|
|
FROM
|
2024-08-05 18:51:33 +08:00
|
|
|
base_customer_car main
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
base_car_main tbcm ON main.car_id = tbcm.id AND tbcm.deleted = 0
|
2024-08-03 16:16:37 +08:00
|
|
|
WHERE
|
2024-08-05 18:51:33 +08:00
|
|
|
main.deleted = 0
|
|
|
|
|
AND main.cus_id = #{cusId}
|
|
|
|
|
ORDER BY
|
|
|
|
|
main.create_time DESC
|
2024-08-03 16:16:37 +08:00
|
|
|
</select>
|
2024-08-01 17:24:41 +08:00
|
|
|
</mapper>
|