修改mapper
This commit is contained in:
parent
1de0d396b1
commit
8ac9ac3dab
|
|
@ -890,17 +890,8 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
|
||||
@Override
|
||||
public List<DevInfoVo> getDevList(DevInfoVo devInfo) {
|
||||
Integer rentNum = devInfo.getRentNum();
|
||||
List<DevInfoVo> devList = devInfoMapper.getDevList(devInfo);
|
||||
for (DevInfoVo devInfoVo : devList) {
|
||||
DevInfo devInfo1 = devInfoMapper.getDevStatus(devInfoVo);
|
||||
devInfoVo.setRentNum(devInfo1.getRentNum());
|
||||
devInfoVo.setMaStatus(devInfo1.getMaStatus());
|
||||
}
|
||||
if (rentNum != null) {
|
||||
devList = devList.stream().filter(devInfoVo -> devInfoVo.getRentNum().equals(rentNum)).collect(Collectors.toList());
|
||||
}
|
||||
return devList;
|
||||
// 直接由SQL一次性返回 rentNum 与 maStatus,无需循环二次查询
|
||||
return devInfoMapper.getDevList(devInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt.manage_type as manageType,
|
||||
d.production_date as productionDate,
|
||||
d.working_hours as workingHours,
|
||||
d.serial_number as serialNumber,
|
||||
d.person as person,
|
||||
d.person_phone as personPhone,
|
||||
c.company_name as companyName,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
<result column="brand" property="brand"/>
|
||||
<result column="production_date" property="productionDate"/>
|
||||
<result column="working_hours" property="workingHours"/>
|
||||
<result column="serial_number" property="serialNumber"/>
|
||||
<result column="month_lease_price" property="monthLeasePrice"/>
|
||||
<result column="day_lease_price" property="dayLeasePrice"/>
|
||||
<result column="js_month_price" property="jsMonthPrice"/>
|
||||
|
|
@ -223,9 +222,6 @@
|
|||
<if test="workingHours != null">
|
||||
working_hours = #{workingHours},
|
||||
</if>
|
||||
<if test="serialNumber != null and serialNumber != ''">
|
||||
serial_number = #{serialNumber},
|
||||
</if>
|
||||
|
||||
<!-- 价格相关字段 -->
|
||||
<if test="monthLeasePrice != null">
|
||||
|
|
|
|||
|
|
@ -311,7 +311,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="modelName != null and modelName != ''">#{modelName},</if>
|
||||
<if test="productionDate != null">#{productionDate},</if>
|
||||
<if test="workingHours != null and workingHours != ''">#{workingHours},</if>
|
||||
<if test="serialNumber != null and serialNumber != ''">#{serialNumber},</if>
|
||||
<if test="picUrl != null and picUrl != ''">#{picUrl},</if>
|
||||
<if test="jsMonthPrice != null and jsMonthPrice != ''">#{jsMonthPrice},</if>
|
||||
<if test="jsDayPrice != null and jsDayPrice != ''">#{jsDayPrice},</if>
|
||||
|
|
@ -652,7 +651,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="modelName != null and modelName != ''">#{modelName},</if>
|
||||
<if test="productionDate != null">#{productionDate},</if>
|
||||
<if test="workingHours != null and workingHours != ''">#{workingHours},</if>
|
||||
<if test="serialNumber != null and serialNumber != ''">#{serialNumber},</if>
|
||||
<if test="picUrl != null and picUrl != ''">#{picUrl},</if>
|
||||
<if test="jsMonthPrice != null and jsMonthPrice != ''">#{jsMonthPrice},</if>
|
||||
<if test="jsDayPrice != null and jsDayPrice != ''">#{jsDayPrice},</if>
|
||||
|
|
@ -800,6 +798,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt4.type_name AS typeName,
|
||||
mt4.unit_name AS unitName,
|
||||
d.ma_status AS maStatus,
|
||||
IFNULL(r.rent_num, 0) AS rentNum,
|
||||
d.brand AS brand,
|
||||
d.production_date AS productionDate,
|
||||
d.working_hours AS workingHours,
|
||||
|
|
@ -820,6 +819,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ma_dev_info d
|
||||
LEFT JOIN sys_dept sd ON d.on_company = sd.dept_id
|
||||
LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id
|
||||
LEFT JOIN (
|
||||
SELECT md.ma_id, COUNT(moi.order_id) AS rent_num
|
||||
FROM ma_order_details md
|
||||
LEFT JOIN ma_order_info moi ON moi.order_id = md.order_id
|
||||
GROUP BY md.ma_id
|
||||
) r ON r.ma_id = d.ma_id
|
||||
LEFT JOIN ma_type mt4 ON mt4.type_id = d.type_id
|
||||
AND mt4.del_flag = '0'
|
||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt4.parent_id
|
||||
|
|
@ -842,6 +847,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="maStatus != null">
|
||||
AND d.ma_status = #{maStatus}
|
||||
</if>
|
||||
<if test="rentNum != null">
|
||||
AND IFNULL(r.rent_num, 0) = #{rentNum}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
AND d.update_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
d.brand as brand,
|
||||
d.production_date as productionDate,
|
||||
d.working_hours as workingHours,
|
||||
d.serial_number as serialNumber,
|
||||
d.person as person,
|
||||
d.person_phone as personPhone,
|
||||
c.company_name as companyName,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
<result property="code" column="code"/>
|
||||
<result property="unitName" column="unit_name"/>
|
||||
<result property="manageType" column="manage_type"/>
|
||||
<result property="leasePrice" column="lease_price"/>
|
||||
<result property="effTime" column="eff_time"/>
|
||||
<result property="rentPrice" column="rent_price"/>
|
||||
<result property="buyPrice" column="buy_price"/>
|
||||
|
|
@ -44,11 +43,8 @@
|
|||
code,
|
||||
unit_name,
|
||||
manage_type,
|
||||
lease_price,
|
||||
eff_time,
|
||||
rent_price,
|
||||
buy_price,
|
||||
pay_price,
|
||||
level,
|
||||
rated_load,
|
||||
test_load,
|
||||
|
|
@ -319,11 +315,8 @@
|
|||
m.storage_num,
|
||||
m.unit_name,
|
||||
m.manage_type,
|
||||
m.lease_price,
|
||||
m.eff_time,
|
||||
m.rent_price,
|
||||
m.buy_price,
|
||||
m.pay_price,
|
||||
m.level,
|
||||
m.rated_load,
|
||||
m.test_load,
|
||||
|
|
@ -392,12 +385,8 @@
|
|||
m.storage_num,
|
||||
m.unit_name,
|
||||
m.manage_type,
|
||||
m.lease_price,
|
||||
m.is_state_grid,
|
||||
m.eff_time,
|
||||
m.rent_price,
|
||||
m.buy_price,
|
||||
m.pay_price,
|
||||
m.level,
|
||||
m.rated_load,
|
||||
m.test_load,
|
||||
|
|
@ -445,7 +434,7 @@
|
|||
|
||||
<select id="selectMaTypeTreeByLevel" resultMap="MaTypeResult" parameterType="java.lang.String">
|
||||
select m.type_id, m.type_name, m.parent_id, m.storage_num, m.manage_type,
|
||||
m.lease_price, m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
|
||||
m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load,
|
||||
m.holding_time, m.warn_num, m.del_flag, m.create_by, m.create_time, m.maintenance_alarm_day,
|
||||
m.remark, m.company_id,mtf.file_url photoUrl
|
||||
from ma_type m
|
||||
|
|
@ -462,7 +451,6 @@
|
|||
m.parent_id,
|
||||
m.storage_num,
|
||||
m.manage_type,
|
||||
m.lease_price,
|
||||
m.eff_time,
|
||||
m.rent_price,
|
||||
m.buy_price,
|
||||
|
|
@ -476,7 +464,6 @@
|
|||
m.create_by,
|
||||
m.create_time,
|
||||
m.remark,
|
||||
m.company_id,
|
||||
m.maintenance_alarm_day,
|
||||
mtf.file_url photoUrl,
|
||||
mt.photoUrl as childPhoto
|
||||
|
|
@ -563,7 +550,6 @@
|
|||
m.storage_num,
|
||||
m.unit_name,
|
||||
m.manage_type,
|
||||
m.lease_price,
|
||||
m.eff_time,
|
||||
m.rent_price,
|
||||
m.buy_price,
|
||||
|
|
|
|||
Loading…
Reference in New Issue