shiyunteng
7 天以前 0ad13cb4bf387d4f2db2d62540ebb73a376087f5
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?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.by4cloud.platformx.device.mapper.DeviceMapper">
 
  <resultMap id="deviceMap" type="com.by4cloud.platformx.device.entity.Device">
        <id property="id" column="id"/>
        <result property="number" column="number"/>
        <result property="name" column="name"/>
        <result property="specification" column="specification"/>
        <result property="manu" column="manu"/>
        <result property="price" column="price"/>
        <result property="unit" column="unit"/>
        <result property="depreciation" column="depreciation"/>
        <result property="beforeDate" column="before_date"/>
        <result property="remindDate" column="remind_date"/>
        <result property="num" column="num"/>
        <result property="month" column="month"/>
        <result property="releaseDate" column="release_date"/>
        <result property="releasePerson" column="release_person"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="delFlag" column="del_flag"/>
  </resultMap>
    <select id="getDeviceSelectListByLedgerId" resultType="com.by4cloud.platformx.device.entity.Device">
        select
            id,
            d.name,
            d.specification,
            d.number
        from
            device d
        where
            d.del_flag = '0'
          and exists (
                select
                    ci.device_id
                from
                    contract_item ci
                        join contract c on
                        c.`id` = ci.contract_id
                        join device_leasing_ledger dll on
                        dll.contract_code = c.`number`
                        join device_leasing_ledger_item dlli on
                        dll.id = dlli.ledger_id
                where
                    dll.id = #{ledgerId}
                  and    d.id = ci.device_id );
    </select>
    <select id="getDeviceListByContractId" resultType="com.by4cloud.platformx.device.entity.Device">
        select
            *
        from
            device d
        where
            d.del_flag = '0'
          and exists (
                select
                    ci.device_id
                from
                    contract_item ci
                where
                    ci.del_flag = '0'
                  and ci.contract_id = #{contractId}
                  and ci.device_id = d.id )
    </select>
    <select id="getDropdownnByWinningId" resultType="com.by4cloud.platformx.device.entity.Device">
        select
            *
        from
            device d
        where
            d.del_flag = '0'
          and exists (
                select
                    pwl.device_id
                from
                    purchase_winning_letter pwl
                where
                    pwl.del_flag = '0'
                  and pwl.id = #{id}
                  and pwl.device_id = d.id )
    </select>
</mapper>