<?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.device.mapper.DeviceLedgerMapper"> 
 | 
  
 | 
    <select id="queryPage" resultType="com.ruoyi.device.dto.DeviceLedgerDto"> 
 | 
        SELECT 
 | 
        dl.id, 
 | 
        dl.device_name, 
 | 
        dl.device_model, 
 | 
        dl.supplier_name, 
 | 
        dl.unit, 
 | 
        dl.number, 
 | 
        dl.status, 
 | 
        dl.plan_runtime_time, 
 | 
        dl.start_runtime_time, 
 | 
        dl.end_runtime_time, 
 | 
        dl.runtime_duration, 
 | 
        dl.tax_including_price_unit, 
 | 
        dl.tax_including_price_total, 
 | 
        dl.tax_rate, 
 | 
        dl.un_tax_including_price_total, 
 | 
        dl.create_time, 
 | 
        dl.update_time , 
 | 
        su.user_name AS createUser, 
 | 
        dl.update_user, 
 | 
        dl.tenant_id 
 | 
        FROM device_ledger dl 
 | 
        left join sys_user su on dl.create_user = su.user_id 
 | 
        <where> 
 | 
            <!-- 设备名称 --> 
 | 
            <if test="deviceLedger.deviceName != null and deviceLedger.deviceName != ''"> 
 | 
                AND device_name LIKE CONCAT('%', #{deviceLedger.deviceName}, '%') 
 | 
            </if> 
 | 
  
 | 
            <!-- 规格型号 --> 
 | 
            <if test="deviceLedger.deviceModel != null and deviceLedger.deviceModel != ''"> 
 | 
                AND device_model LIKE CONCAT('%', #{deviceLedger.deviceModel}, '%') 
 | 
            </if> 
 | 
  
 | 
            <!-- 供应商名称 --> 
 | 
            <if test="deviceLedger.supplierName != null and deviceLedger.supplierName != ''"> 
 | 
                AND supplier_name LIKE CONCAT('%', #{deviceLedger.supplierName}, '%') 
 | 
            </if> 
 | 
  
 | 
            <!-- 单位 --> 
 | 
            <if test="deviceLedger.unit != null and deviceLedger.unit != ''"> 
 | 
                AND unit = #{deviceLedger.unit} 
 | 
            </if> 
 | 
  
 | 
            <!-- 录入人 --> 
 | 
            <if test="deviceLedger.createUser != null and deviceLedger.createUser != ''"> 
 | 
                AND create_user LIKE CONCAT('%', #{deviceLedger.createUser}, '%') 
 | 
            </if> 
 | 
  
 | 
            <!-- 更新人 --> 
 | 
            <if test="deviceLedger.updateUser != null and deviceLedger.updateUser != ''"> 
 | 
                AND update_user LIKE CONCAT('%', #{deviceLedger.updateUser}, '%') 
 | 
            </if> 
 | 
  
 | 
            <if test="deviceLedger.entryDateStart != null and deviceLedger.entryDateStart != '' "> 
 | 
                AND dl.create_time >= DATE_FORMAT(#{deviceLedger.entryDateStart},'%Y-%m-%d') 
 | 
            </if> 
 | 
            <if test="deviceLedger.entryDateEnd != null and deviceLedger.entryDateEnd != '' "> 
 | 
                AND dl.create_time <= DATE_FORMAT(#{deviceLedger.entryDateEnd},'%Y-%m-%d') 
 | 
            </if> 
 | 
  
 | 
            <!-- 租户ID --> 
 | 
            <if test="deviceLedger.tenantId != null"> 
 | 
                AND tenant_id = #{deviceLedger.tenantId} 
 | 
            </if> 
 | 
        </where> 
 | 
        ORDER BY create_time DESC 
 | 
    </select> 
 | 
    <select id="deviceLedgerExportList" resultType="com.ruoyi.device.execl.DeviceLedgerExeclDto"> 
 | 
  
 | 
    </select> 
 | 
    <select id="selectById1" resultType="com.ruoyi.device.pojo.DeviceLedger"> 
 | 
        select * 
 | 
        from device_ledger 
 | 
        where id = #{id} 
 | 
    </select> 
 | 
  
 | 
</mapper> 
 |