shiyunteng
2025-04-01 ffbddedac17c4a7d18d382c4917b3f375356e061
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
<?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.DeviceLeasingLedgerItemMapper">
 
  <resultMap id="deviceLeasingLedgerItemMap" type="com.by4cloud.platformx.device.entity.DeviceLeasingLedgerItem">
        <id property="id" column="id"/>
        <result property="compId" column="comp_id"/>
        <result property="deviceCode" column="device_code"/>
        <result property="deviceId" column="device_id"/>
        <result property="deviceModels" column="device_models"/>
        <result property="deviceName" column="device_name"/>
        <result property="keyParameter" column="key_parameter"/>
        <result property="meteringUnit" column="metering_unit"/>
        <result property="num" column="num"/>
        <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="selectDeviceNumByContractId" resultType="java.lang.Integer">
        select
            ifnull(sum(dlli.num),0)
        from
            device_leasing_ledger_item dlli
        where
            dlli.device_id = #{deviceId}
          and exists (
                select
                    *
                from
                    device_leasing_ledger dll
                where
                    dll.contract_id  = #{contractId}
                  and dll.id = dlli.ledger_id )
    </select>
</mapper>