lanan-system/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml

71 lines
2.5 KiB
XML
Raw Normal View History

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">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<sql id="column">
id,
engine_number,
vin,
license_number,
car_model,
maintenance_date,
maintenance_mileage,
inspection_date,
insurance_date,
check_date,
next_maintenance_date,
next_maintenance_mileage,
next_inspection_date,
insurance_expiry_date,
next_check_date,
car_brand,
car_nature,
car_category,
car_register_date,
car_license_img,
recently_handled_business,
recently_handle_business_time,
deleted,
creator,
create_time,
updater,
update_time
</sql>
<select id="findPage" resultType="cn.iocoder.yudao.module.custom.vo.CarMainRespVO">
SELECT
<include refid="column"></include>
FROM `base_car_main`
WHERE
deleted = 0
<if test="dto.licenseNumber != null and dto.licenseNumber != ''">
AND license_number LIKE CONCAT('%',#{dto.licenseNumber},'%')
</if>
<if test="dto.carBrand != null and dto.carBrand != ''">
AND car_brand = #{dto.carBrand}
</if>
<if test="dto.carCategory != null and dto.carCategory != ''">
AND car_category = #{dto.carCategory}
</if>
<if test="dto.recentlyHandledBusiness != null and dto.recentlyHandledBusiness != ''">
AND recently_handled_business = #{dto.recentlyHandledBusiness}
</if>
<if test="dto.recentlyHandleBusinessTime != null">
AND recently_handle_business_time = #{dto.recentlyHandleBusinessTime}
</if>
<if test="dto.vin != null and dto.vin != ''">
AND vin LIKE CONCAT('%',#{dto.vin},'%')
</if>
<if test="dto.recentlyHandledBusiness != null and dto.recentlyHandledBusiness != ''">
AND tenant_id = #{dto.tenant}
</if>
</select>
</mapper>