<?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.stylefeng.guns.modular.system.dao.TCarModelMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TCarModel">
|
<id column="id" property="id" />
|
<result column="name" property="name" />
|
<result column="remark" property="remark" />
|
<result column="insertTime" property="insertTime" />
|
<result column="state" property="state" />
|
<result column="seat" property="seat" />
|
<result column="brandId" property="brandId" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, name, remark, insertTime, state, seat, brandId
|
</sql>
|
|
<!--根据条件查询车辆车型列表-->
|
<select id="getCarModelList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
|
SELECT * FROM (SELECT cb.`name` as brandName,IFNULL(cc.num,0) as carNum,cm.* FROM t_car_model as cm
|
LEFT JOIN (select * from t_car_brand where state = 1) as cb on cb.id = cm.brandId
|
LEFT JOIN (SELECT COUNT(id) as num,carModelId from t_car where state = 1 GROUP BY carModelId) as cc on cc.carModelId = cm.id) as o
|
<where>
|
o.state = 1
|
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
|
AND (o.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
|
</if>
|
<if test="name != null and name != ''">
|
and o.name LIKE CONCAT('%',#{name},'%')
|
</if>
|
</where>
|
order by o.id desc
|
</select>
|
|
</mapper>
|