Pu Zhibing
2025-04-22 279d3bbbe15d4839cba8dfb48053c75b504aacc3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?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.TCarColorMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TCarColor">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="insertTime" property="insertTime"/>
        <result column="state" property="state"/>
    </resultMap>
 
 
    <select id="list" resultType="map">
        select
        id as id,
        name as name,
        DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') as insertTime
        from t_car_color where state = 1
        <if test="null != createTime and '' != createTime">
            and insertTime between CONCAT(#{createTime}, ' 00:00:00') and CONCAT(#{createTime}, ' 23:59:59')
        </if>
        <if test="null != name and '' != name">
            and name like CONCAT('%', #{name}, '%')
        </if>
        order by insertTime desc
        <if test="null != offset and null != limit">
            limit #{offset}, #{limit}
        </if>
    </select>
 
 
    <select id="listCount" resultType="int">
        select
        count(1)
        from t_car_color where state = 1
        <if test="null != createTime and '' != createTime">
            and insertTime between CONCAT(#{createTime}, ' 00:00:00') and CONCAT(#{createTime}, ' 23:59:59')
        </if>
        <if test="null != name and '' != name">
            and name like CONCAT('%', #{name}, '%')
        </if>
    </select>
</mapper>