外部接口

This commit is contained in:
jiang 2025-08-23 19:31:31 +08:00
parent bbdb2ee405
commit 763141e7e5
13 changed files with 679 additions and 67 deletions

View File

@ -363,4 +363,9 @@ public class DevInfo extends BaseEntity {
private String lesseePerson;
private String type;
@ApiModelProperty(value = "资产原值", required = true)
private BigDecimal assetValue;
@ApiModelProperty(value = "购置费用来源", required = true)
private String purchaseSource;
}

View File

@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* @author syruan
*/
@ -18,4 +20,7 @@ public class InfoMotionDto extends DevInfo {
@ApiModelProperty(value = "纬度", required = true)
private String lat;
}

View File

@ -0,0 +1,69 @@
package com.bonus.material.externalInterface.controller;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.externalInterface.service.EquipmentExternalService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 装备管理
*/
@RequestMapping("equipmentExternal")
public class EquipmentExternalController extends BaseController {
@Resource
private EquipmentExternalService equipmentExternalService;
/**
* 查询指定装备的技术参数信息支持参数分类和格式化显示
*
* @param equipmentId 设备id
* @return AjaxResult
*/
@GetMapping("/specifications/{equipmentId}")
public AjaxResult specifications(@PathVariable String equipmentId) {
return equipmentExternalService.specifications(equipmentId);
}
/**
* 更新装备技术参数支持批量更新和参数校验
*
* @param equipmentId 设备id
* @param specifications 技术参数
* @return AjaxResult
*/
@PostMapping("/updateSpecifications")
public AjaxResult updateSpecifications(String equipmentId, List<Map<String, Object>> specifications) {
return equipmentExternalService.updateSpecifications(equipmentId, specifications);
}
/**
* 查询装备完整资质信息包含所有证书文件和时间信息
*
* @param equipmentId 设备id
* @return AjaxResult
*/
@GetMapping("/qualifications/{equipmentId}")
public AjaxResult qualifications(@PathVariable String equipmentId) {
return equipmentExternalService.qualifications(equipmentId);
}
/**
* 删除指定资质文件支持批量删除和安全校验
*
* @param fileId 文件id
* @return AjaxResult
*/
@GetMapping("qualifications/file/{fileId}")
public AjaxResult delFile(@PathVariable String[] fileId) {
return equipmentExternalService.delFile(fileId);
}
}

View File

@ -0,0 +1,69 @@
package com.bonus.material.externalInterface.controller;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.externalInterface.service.LargeScreenExternalService;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
/**
* 装备共享一张图
*/
@RequestMapping("largeScreenExternal")
public class LargeScreenExternalController extends BaseController {
@Resource
private LargeScreenExternalService largeScreenExternalService;
/**
* 统计各种状态下的装备数量用于大屏展示
*
* @param accountId 用户id
* @return AjaxResult
*/
@GetMapping("/deviceStatusStatistics")
public AjaxResult deviceStatusStatistics(String accountId) {
return largeScreenExternalService.deviceStatusStatistics(accountId);
}
/**
* 图表展示当前账号下装备的分级统计可切换分布查看IIIIII类下的分级统计
*
* @param accountId 用户id
* @param level 分级
* @return AjaxResult
*/
@GetMapping("/deviceLevelStatistics")
public AjaxResult deviceLevelStatistics(String level, String accountId) {
return largeScreenExternalService.deviceLevelStatistics(level, accountId);
}
/**
* 图表展示当前账号下每月租赁费用统计包括内部费用市场化费用及平台总费用
*
* @param accountId 用户id
* @param startMonth 开始时间
* @param endMonth 结束时间
* @return AjaxResult
*/
@GetMapping("/deviceRentalCostStatistics")
public AjaxResult deviceRentalCostStatistics(String accountId, String startMonth, String endMonth) {
return largeScreenExternalService.deviceRentalCostStatistics(accountId, startMonth, endMonth);
}
/**
* 图标展示当前账号下各工程在用的装备总数自有装备数市场化装备数
*
* @param accountId 用户id
* @param projectId 工程id
* @return AjaxResult
*/
@GetMapping("/projectEquipmentStatistics")
public AjaxResult projectEquipmentStatistics(String accountId, String projectId) {
return largeScreenExternalService.projectEquipmentStatistics(accountId, projectId);
}
}

View File

@ -0,0 +1,54 @@
package com.bonus.material.externalInterface.mapper;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface EquipmentExternalMapper {
/**
* 查询指定装备的技术参数信息支持参数分类和格式化显示
*
* @param equipmentId 设备id
* @return AjaxResult
*/
@MapKey("id")
List<Map<String, Object>> specifications(String equipmentId);
/**
* 更新装备技术参数支持批量更新和参数校验
*
* @param equipmentId 设备id
* @param specifications 技术参数
* @return AjaxResult
*/
Integer updateSpecifications(String equipmentId, List<Map<String, Object>> specifications);
/**
* 更新前删除原先数据
*
* @param equipmentId 设备id
* @return AjaxResult
*/
Integer deleteSpecifications(String equipmentId);
/**
* 查询装备完整资质信息包含所有证书文件和时间信息
*
* @param equipmentId 设备id
* @return AjaxResult
*/
@MapKey("id")
List<Map<String, Object>> qualifications(String equipmentId);
/**
* 删除指定资质文件支持批量删除和安全校验
*
* @param fileId 文件id
* @return 数量
*/
Integer delFile(String[] fileId);
}

View File

@ -0,0 +1,52 @@
package com.bonus.material.externalInterface.mapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* 装备共享一张图
*/
@Mapper
public interface LargeScreenExternalMapper {
/**
* 统计各种状态下的装备数量用于大屏展示
*
* @param accountId id
* @return 设备数据
*/
@MapKey("name")
Map<String, Object> deviceStatusStatistics(String accountId);
/**
* 图表展示当前账号下装备的分级统计可切换分布查看IIIIII类下的分级统计
*
* @param level 分级
* @param accountId id
* @return 分级统计
*/
@MapKey("name")
Map<String, Object> deviceLevelStatistics(@Param("level") String level, @Param("accountId") String accountId);
/**
* 图表展示当前账号下每月租赁费用统计包括内部费用市场化费用及平台总费用
*
* @param accountId id
* @param startMonth 开始时间
* @param endMonth 结束时间
* @return 平台总费用
*/
@MapKey("name")
Map<String, Object> deviceRentalCostStatistics(@Param("accountId") String accountId, @Param("startMonth") String startMonth, @Param("endMonth") String endMonth);
/**
* 图标展示当前账号下各工程在用的装备总数自有装备数市场化装备数
*
* @param accountId 用户id
* @param projectId 工程id
* @return AjaxResult
*/
Map<String, Object> projectEquipmentStatistics(String accountId, String projectId);
}

View File

@ -0,0 +1,39 @@
package com.bonus.material.externalInterface.service;
import com.bonus.common.core.web.domain.AjaxResult;
import java.util.List;
import java.util.Map;
public interface EquipmentExternalService {
/**
* 查询指定装备的技术参数信息支持参数分类和格式化显示
*
* @param equipmentId 设备id
* @return AjaxResult
*/
AjaxResult specifications(String equipmentId);
/**
* 更新装备技术参数支持批量更新和参数校验
*
* @param equipmentId 设备id
* @param specifications 技术参数
* @return AjaxResult
*/
AjaxResult updateSpecifications(String equipmentId, List<Map<String, Object>> specifications);
/**
* 查询装备完整资质信息包含所有证书文件和时间信息
*
* @param equipmentId 设备id
* @return AjaxResult
*/
AjaxResult qualifications(String equipmentId);
/**
* 删除指定资质文件支持批量删除和安全校验
*
* @param fileId 文件id
* @return AjaxResult
*/
AjaxResult delFile(String[] fileId);
}

View File

@ -0,0 +1,44 @@
package com.bonus.material.externalInterface.service;
import com.bonus.common.core.web.domain.AjaxResult;
/**
* 装备共享一张图
*/
public interface LargeScreenExternalService {
/**
* 统计各种状态下的装备数量用于大屏展示
*
* @param accountId id
* @return 设备数据
*/
AjaxResult deviceStatusStatistics(String accountId);
/**
* 图表展示当前账号下装备的分级统计可切换分布查看IIIIII类下的分级统计
*
* @param accountId id
* @param level 分级
* @return 分级统计
*/
AjaxResult deviceLevelStatistics(String level, String accountId);
/**
* 图表展示当前账号下每月租赁费用统计包括内部费用市场化费用及平台总费用
*
* @param accountId id
* @param startMonth 开始时间
* @param endMonth 结束时间
* @return 平台总费用
*/
AjaxResult deviceRentalCostStatistics(String accountId, String startMonth, String endMonth);
/**
* 图标展示当前账号下各工程在用的装备总数自有装备数市场化装备数
*
* @param accountId 用户id
* @param projectId 工程id
* @return AjaxResult
*/
AjaxResult projectEquipmentStatistics(String accountId, String projectId);
}

View File

@ -0,0 +1,89 @@
package com.bonus.material.externalInterface.service.impl;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.externalInterface.mapper.EquipmentExternalMapper;
import com.bonus.material.externalInterface.service.EquipmentExternalService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
public class EquipmentExternalServiceImpl implements EquipmentExternalService {
@Resource
private EquipmentExternalMapper equipmentExternalMapper;
/**
* 查询指定装备的技术参数信息支持参数分类和格式化显示
*
* @param equipmentId 设备id
* @return AjaxResult
*/
@Override
public AjaxResult specifications(String equipmentId) {
try {
List<Map<String, Object>> specifications = equipmentExternalMapper.specifications(equipmentId);
return !specifications.isEmpty() ? AjaxResult.success(specifications) : AjaxResult.error();
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error();
}
}
/**
* 更新装备技术参数支持批量更新和参数校验
*
* @param equipmentId 设备id
* @param specifications 技术参数
* @return AjaxResult
*/
@Override
public AjaxResult updateSpecifications(String equipmentId, List<Map<String, Object>> specifications) {
try {
equipmentExternalMapper.deleteSpecifications(equipmentId);
Integer i = equipmentExternalMapper.updateSpecifications(equipmentId, specifications);
return i > 0 ? AjaxResult.success() : AjaxResult.error();
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error();
}
}
/**
* 查询装备完整资质信息包含所有证书文件和时间信息
*
* @param equipmentId 设备id
* @return AjaxResult
*/
@Override
public AjaxResult qualifications(String equipmentId) {
try {
List<Map<String, Object>> qualifications = equipmentExternalMapper.qualifications(equipmentId);
return !qualifications.isEmpty() ? AjaxResult.success(qualifications) : AjaxResult.error();
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error();
}
}
/**
* 删除指定资质文件支持批量删除和安全校验
*
* @param fileId 文件id
* @return AjaxResult
*/
@Override
public AjaxResult delFile(String[] fileId) {
try {
Integer num = equipmentExternalMapper.delFile(fileId);
return num > 0 ? AjaxResult.success() : AjaxResult.error();
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error();
}
}
}

View File

@ -0,0 +1,94 @@
package com.bonus.material.externalInterface.service.impl;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.externalInterface.mapper.LargeScreenExternalMapper;
import com.bonus.material.externalInterface.service.LargeScreenExternalService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Map;
/**
* 装备共享一张图
*/
@Service
@Slf4j
public class LargeScreenExternalServiceImpl implements LargeScreenExternalService {
@Resource
private LargeScreenExternalMapper largeScreenExternalMapper;
/**
* 统计各种状态下的装备数量用于大屏展示
*
* @param accountId id
* @return 设备数据
*/
@Override
public AjaxResult deviceStatusStatistics(String accountId) {
try {
Map<String, Object> stringObjectMap = largeScreenExternalMapper.deviceStatusStatistics(accountId);
return ObjectUtils.isNotEmpty(stringObjectMap) ? AjaxResult.success(stringObjectMap) : AjaxResult.error();
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error();
}
}
/**
* 图表展示当前账号下装备的分级统计可切换分布查看IIIIII类下的分级统计
*
* @param level 分级
* @param accountId id
* @return 分级统计
*/
@Override
public AjaxResult deviceLevelStatistics(String level, String accountId) {
try {
Map<String, Object> stringObjectMap = largeScreenExternalMapper.deviceLevelStatistics(level, accountId);
return ObjectUtils.isNotEmpty(stringObjectMap) ? AjaxResult.success(stringObjectMap) : AjaxResult.error();
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error();
}
}
/**
* 图表展示当前账号下每月租赁费用统计包括内部费用市场化费用及平台总费用
*
* @param accountId id
* @param startMonth 开始时间
* @param endMonth 结束时间
* @return 平台总费用
*/
@Override
public AjaxResult deviceRentalCostStatistics(String accountId, String startMonth, String endMonth) {
try {
Map<String, Object> stringObjectMap = largeScreenExternalMapper.deviceRentalCostStatistics(accountId, startMonth, endMonth);
return ObjectUtils.isNotEmpty(stringObjectMap) ? AjaxResult.success(stringObjectMap) : AjaxResult.error();
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error();
}
}
/**
* 图标展示当前账号下各工程在用的装备总数自有装备数市场化装备数
*
* @param accountId 用户id
* @param projectId 工程id
* @return AjaxResult
*/
@Override
public AjaxResult projectEquipmentStatistics(String accountId, String projectId) {
try {
Map<String, Object> stringObjectMap = largeScreenExternalMapper.projectEquipmentStatistics(accountId, projectId);
return ObjectUtils.isNotEmpty(stringObjectMap) ? AjaxResult.success(stringObjectMap) : AjaxResult.error();
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error();
}
}
}

View File

@ -223,55 +223,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectDevInfoByMaId" parameterType="Long" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
SELECT
d.ma_id as maId,
d.code as code,
identify_code as identifyCode,
d.device_name as deviceName,
d.device_weight as deviceWeight,
d.device_count as deviceCount,
d.type_id as typeId,
d.check_date as checkDate,
d.check_cycle as checkCycle,
mt4.type_name as typeName,
mt4.unit_name as unitName,
mt4.manage_type as manageType,
mt4.maintenance_alarm_day,
d.ma_status as maStatus,
d.brand as brand,
d.model_name as modelName,
d.production_date as productionDate,
d.working_hours as workingHours,
d.serial_number as serialNumber,
mt4.lease_price as dayLeasePrice,
d.person as person,
d.person_phone as personPhone,
d.own_id as ownId,
d.own_co as companyId,
sd.dept_name as companyName,
c.operate_address as operateAddress,
mt3.type_id as thirdId,
mt3.type_name as thirdName,
mt2.type_id as secondId,
mt2.type_name as secondName,
mt1.type_id as firstId,
mt1.type_name as firstName,
GROUP_CONCAT(CONCAT(mt1.type_name, '/', mt2.type_name, '/', mt3.type_name)) AS groupName,
IFNULL(h.search_num, 0) as searchNum,
d.create_time as createTime,
d.update_time as updateTime,
d.is_zone as isZone, d.zone_id as zoneId
FROM
ma_dev_info d
LEFT JOIN sys_dept sd ON d.own_co = sd.dept_id
LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id
LEFT JOIN ma_hot_search h ON d.ma_id = h.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 and mt3.del_flag = '0'
LEFT JOIN ma_type mt2 ON mt2.type_id = mt3.parent_id and mt2.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt1.type_id = mt2.parent_id and mt1.del_flag = '0'
where
d.is_active='1' and d.ma_id = #{maId}
SELECT d.ma_id as maId,
d.code as code,
identify_code as identifyCode,
d.device_name as deviceName,
d.device_weight as deviceWeight,
d.device_count as deviceCount,
d.type_id as typeId,
d.check_date as checkDate,
d.check_cycle as checkCycle,
mt4.type_name as typeName,
mt4.unit_name as unitName,
mt4.manage_type as manageType,
mt4.maintenance_alarm_day,
d.ma_status as maStatus,
d.brand as brand,
d.model_name as modelName,
d.production_date as productionDate,
d.working_hours as workingHours,
d.serial_number as serialNumber,
mt4.lease_price as dayLeasePrice,
d.person as person,
d.person_phone as personPhone,
d.own_id as ownId,
d.own_co as companyId,
d.assetValue AS assetValue,
d.purchaseSource AS purchaseSource,
sd.dept_name as companyName,
c.operate_address as operateAddress,
mt3.type_id as thirdId,
mt3.type_name as thirdName,
mt2.type_id as secondId,
mt2.type_name as secondName,
mt1.type_id as firstId,
mt1.type_name as firstName,
GROUP_CONCAT(CONCAT(mt1.type_name, '/', mt2.type_name, '/', mt3.type_name)) AS groupName,
IFNULL(h.search_num, 0) as searchNum,
d.create_time as createTime,
d.update_time as updateTime,
d.is_zone as isZone,
d.zone_id as zoneId,
CASE
WHEN check_date IS NULL THEN '未设置检验日期'
WHEN check_date &gt; CURDATE() THEN '已过期'
ELSE '有效'
END AS verifyStatus
FROM ma_dev_info d
LEFT JOIN sys_dept sd ON d.own_co = sd.dept_id
LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id
LEFT JOIN ma_hot_search h ON d.ma_id = h.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 and mt3.del_flag = '0'
LEFT JOIN ma_type mt2 ON mt2.type_id = mt3.parent_id and mt2.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt1.type_id = mt2.parent_id and mt1.del_flag = '0'
where d.is_active = '1'
and d.ma_id = #{maId}
</select>
<select id="getFilesByMaId" parameterType="Long" resultType="com.bonus.common.biz.domain.SysFileInfo">
@ -292,7 +298,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="typeId != null and typeId != ''">type_id,</if>
<if test="maStatus != null">ma_status,</if>
<if test="leaseScope != null and leaseScope != ''">lease_scope,</if>
<if test="location != null and location != ''" >location,</if>
<if test="location != null and location != ''">location,</if>
<if test="provinceId != null and provinceId != ''">province_id,</if>
<if test="cityId != null and cityId != ''">city_id,</if>
<if test="areaId != null and areaId != ''">area_id,</if>
@ -306,9 +312,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="jsDayPrice != null and jsDayPrice != ''">js_day_price,</if>
<if test="description != null and description != ''">`description`,</if>
<if test="gpsCode != null and gpsCode != ''">gps_code,</if>
<if test="companyId != null and companyId != ''" >own_co,</if>
<if test="companyId != null and companyId != ''">own_co,</if>
<if test="person != null and person != ''">person,</if>
<if test="personPhone != null and personPhone != ''">person_phone,</if>
<if test="assetValue != null and assetValue != ''">assetValue,</if>
<if test="purchaseSource != null and purchaseSource != ''">purchaseSource,</if>
create_time,
<if test="creator != null and creator != ''">creator,</if>
update_time,
@ -323,7 +331,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="checkCycle != null">check_cycle,</if>
<if test="isZone != null">is_zone,</if>
<if test="zoneId != null">zone_id,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
<if test="deviceWeight != null and deviceWeight != ''">#{deviceWeight},</if>
@ -350,6 +358,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="companyId != null and companyId != ''">#{companyId},</if>
<if test="person != null and person != ''">#{person},</if>
<if test="personPhone != null and personPhone != ''">#{personPhone},</if>
<if test="assetValue != null and assetValue != ''">#{assetValue},</if>
<if test="purchaseSource != null and purchaseSource != ''">#{purchaseSource},</if>
now(),
<if test="creator != null and creator != ''">#{creator},</if>
now(),
@ -364,7 +374,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="checkCycle != null">#{checkCycle},</if>
<if test="isZone != null">#{isZone},</if>
<if test="zoneId != null">#{zoneId},</if>
</trim>
</trim>
</insert>
<insert id="insertLon">
@ -416,6 +426,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="checkCycle != null">check_cycle = #{checkCycle},</if>
<if test="isZone != null">is_zone = #{isZone},</if>
<if test="zoneId != null">zone_id = #{zoneId},</if>
<if test="assetValue != null">assetValue = #{assetValue},</if>
<if test="purchaseSource != null">purchaseSource = #{purchaseSource},</if>
update_time = now()
</trim>
where ma_id = #{maId}
@ -509,33 +521,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDevInfoLists" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
select
d.*,
mt4.type_name as typeName,mt4.unit_name as unitName,
mt3.type_id as thirdId,mt3.type_name as thirdName,
mt2.type_id as secondId,mt2.type_name as secondName,
mt1.type_id as firstId,mt1.type_name as firstName
d.*,
CASE
WHEN check_date IS NULL THEN '未设置检验日期'
WHEN check_date &gt; CURDATE() THEN '已过期'
ELSE '有效'
END AS verifyStatus,
mt4.type_name as typeName,mt4.unit_name as unitName,
mt3.type_id as thirdId,mt3.type_name as thirdName,
mt2.type_id as secondId,mt2.type_name as secondName,
mt1.type_id as firstId,mt1.type_name as firstName
from
ma_dev_info d
ma_dev_info d
left join ma_up_off u on d.ma_id = u.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 and mt3.del_flag = '0'
left join ma_type mt2 ON mt2.type_id = mt3.parent_id and mt2.del_flag = '0'
left join ma_type mt1 ON mt1.type_id = mt2.parent_id and mt1.del_flag = '0'
<where>
<if test="maId != null "> and d.ma_id = #{maId}</if>
<if test="code != null and code != ''"> and d.code = #{code}</if>
<if test="maId != null ">and d.ma_id = #{maId}</if>
<if test="code != null and code != ''">and d.code = #{code}</if>
<if test="deviceName != null and deviceName != ''">
and d.device_name like concat('%',#{deviceName},'%')
</if>
<if test="typeId != null">
and d.type_id = #{typeId}
</if>
<if test="maStatus != null"> and d.ma_status = #{maStatus}</if>
<if test="leaseScope != null "> and d.lease_scope = #{leaseScope}</if>
<if test="areaId != null and areaId != ''"> and d.area_id = #{areaId}</if>
<if test="brand != null and brand != ''"> and d.brand = #{brand}</if>
<if test="modelName != null and modelName != ''"> and d.model_name like concat('%', #{modelName}, '%')</if>
<if test="companyId != null and companyId !=''"> and d.own_co = #{companyId}</if>
<if test="maStatus != null">and d.ma_status = #{maStatus}</if>
<if test="leaseScope != null ">and d.lease_scope = #{leaseScope}</if>
<if test="areaId != null and areaId != ''">and d.area_id = #{areaId}</if>
<if test="brand != null and brand != ''">and d.brand = #{brand}</if>
<if test="modelName != null and modelName != ''">and d.model_name like concat('%', #{modelName}, '%')</if>
<if test="companyId != null and companyId !=''">and d.own_co = #{companyId}</if>
<if test="startTime != null and endTime !='' and endTime != null and endTime !=''">
and d.update_time between #{startTime} and #{endTime}
</if>

View File

@ -0,0 +1,52 @@
<?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.bonus.material.externalInterface.mapper.EquipmentExternalMapper">
<insert id="updateSpecifications">
insert into
ma_dev_info_properties(ma_id, property_name, property_value, create_time)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{maId},
#{item.propertyName},
#{item.propertyValue},
now()
)
</foreach>
</insert>
<delete id="deleteSpecifications">
delete
from ma_dev_info_properties
where ma_id = #{equipmentId}
</delete>
<delete id="delFile">
DELETE FROM bm_file_info
WHERE id IN
<foreach collection="fileId" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="specifications" resultType="java.util.Map">
select id AS id,
ma_id AS maId,
property_name AS propertyName,
property_value AS propertyValue,
create_time AS createTime
from ma_dev_info_properties
WHERE ma_id = #{equipmentId}
</select>
<select id="qualifications" resultType="java.util.Map">
SELECT bfi.model_id AS equipmentId,
bfi.id AS id,
bfi.name AS fileName,
bfi.url AS fileUrl,
sd.dict_label AS qualificationType
FROM bm_file_info bfi
LEFT JOIN sys_dict_data sd ON sd.dict_value = bfi.file_type
WHERE bfi.model_id = #{equipmentId}
and sd.dict_type = 'ma_file_type'
</select>
</mapper>

View File

@ -0,0 +1,23 @@
<?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.bonus.material.externalInterface.mapper.LargeScreenExternalMapper">
<!-- 统计各种状态下的装备数量,用于大屏展示 -->
<select id="deviceStatusStatistics" resultType="java.util.Map">
</select>
<!-- 图表展示当前账号下装备的分级统计可切换分布查看I、II、III类下的分级统计 -->
<select id="deviceLevelStatistics" resultType="java.util.Map">
</select>
<!-- 图表展示当前账号下每月租赁费用统计,包括内部费用、市场化费用及平台总费用 -->
<select id="deviceRentalCostStatistics" resultType="java.util.Map">
</select>
<!-- 图标展示当前账号下各工程在用的装备总数、自有装备数、市场化装备数 -->
<select id="projectEquipmentStatistics" resultType="java.util.Map">
</select>
</mapper>