mitao
2 天以前 853c8ba11072eae475273864e61733ae7294f004
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
<?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.ruoyi.system.mapper.AssetTypeMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.system.model.AssetType">
        <id column="id" property="id" />
        <result column="type_name" property="typeName" />
        <result column="type_code" property="typeCode" />
        <result column="parent_id" property="parentId" />
        <result column="level" property="level" />
        <result column="create_time" property="createTime" />
        <result column="create_by" property="createBy" />
        <result column="update_time" property="updateTime" />
        <result column="update_by" property="updateBy" />
        <result column="disabled" property="disabled" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, type_name, type_code, parent_id, level, create_time, create_by, update_time, update_by, disabled
    </sql>
    <select id="pageList" resultType="com.ruoyi.system.vo.AssetStatisticsVO">
        select t1.id as assetTypeIdSecond,t1.type_name as assetTypeNameSecond,
               t2.id as assetTypeIdFirst,t2.type_name as assetTypeNameFirst
        FROM asset_type t1
        left join asset_type t2 on t1.parent_id = t2.id
        where 1=1
        and
        t1.parent_id != 0
        <if test="query.assetTypeIds != null and query.assetTypeIds.size()>0">
            AND t1.id IN
            <foreach collection="query.assetTypeIds" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
               AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
               AND t2.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
 
    </select>
    <select id="pageListNoLimit" resultType="com.ruoyi.system.vo.AssetStatisticsVO">
        select t1.id as assetTypeIdSecond,t1.type_name as assetTypeNameSecond,
        t2.id as assetTypeIdFirst,t2.type_name as assetTypeNameFirst
        FROM asset_type t1
        left join asset_type t2 on t1.parent_id = t2.id
        where 1=1
        and
        t1.parent_id != 0
        <if test="query.assetTypeIds != null and query.assetTypeIds.size()>0">
            AND t1.id IN
            <foreach collection="query.assetTypeIds" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        AND t2.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
    </select>
 
</mapper>