puzhibing
2023-03-15 79962435853baf5a28e08461f46a831fffa1a4b0
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?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.IncomeMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Income">
        <id column="id" property="id"/>
        <result column="userType" property="userType"/>
        <result column="objectId" property="objectId"/>
        <result column="type" property="type"/>
        <result column="incomeId" property="incomeId"/>
        <result column="orderType" property="orderType"/>
        <result column="money" property="money"/>
        <result column="insertTime" property="insertTime"/>
    </resultMap>
 
 
    <select id="query" resultType="map">
        select
        incomeId as incomeId,
        orderType as orderType,
        money as money,
        DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as time
        from t_income where 1 = 1
        <if test="null != userType">
            and userType = #{userType}
        </if>
        <if test="null != objectId">
          and objectId = #{objectId}
        </if>
        <if test="null != type">
          and `type` = #{type}
        </if>
        order by insertTime desc limit #{pageNum}, #{size}
    </select>
 
 
 
    <select id="queryData" resultType="Income">
        select
        id as id,
        userType as userType,
        objectId as objectId,
        type as type,
        incomeId as incomeId,
        orderType as orderType,
        money as money,
        insertTime as insertTime
        from t_income where 1 = 1
        <if test="null != userType">
            and userType = #{userType}
        </if>
        <if test="null != objectId">
            and objectId = #{objectId}
        </if>
        <if test="null != type">
            and `type` = #{type}
        </if>
        <if test="null != incomeId">
            and incomeId = #{incomeId}
        </if>
        <if test="null != orderType">
            and orderType = #{orderType}
        </if>
    </select>
</mapper>