接口对接
This commit is contained in:
parent
b7d861f9b6
commit
d6e9a6ed59
|
|
@ -6,15 +6,14 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.material.push.domain.*;
|
||||
import com.bonus.material.push.service.ProDataUseInfoService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
|
|
@ -51,9 +50,11 @@ public class PushProDataUseInfoController extends BaseController {
|
|||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
|
||||
@GetMapping(value = "getMachineDetails")
|
||||
public TableDataInfo getMachineDetails(ProIdsBean bean) {
|
||||
try {
|
||||
startPage();
|
||||
List<MachineInfoBean> results = service.getMachineDetails(bean);
|
||||
return getDataTable(results);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -62,8 +63,22 @@ public class PushProDataUseInfoController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "getMaTypeList")
|
||||
public TableDataInfo getMaTypeList(ProIdsBean bean) {
|
||||
try {
|
||||
startPage();
|
||||
List<MachineInfoBean> results = service.getMaTypeList(bean);
|
||||
return getDataTable(results);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
throw new ServiceException("数据查询异常,请联系运维人员查询日志处理");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询七大类设备保有量、在用量、再修量、库存量
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -94,6 +109,7 @@ public class PushProDataUseInfoController extends BaseController {
|
|||
@GetMapping(value = "getApproachingDetails")
|
||||
public TableDataInfo getApproachingDetails(ProIdsBean bean) {
|
||||
try {
|
||||
startPage();
|
||||
List<MachineInfoBean> results = service.getApproachingDetails(bean);
|
||||
return getDataTable(results);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -102,6 +118,18 @@ public class PushProDataUseInfoController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "getApproachingDetailsByUnit")
|
||||
public AjaxResult getApproachingDetailsByUnit() {
|
||||
try {
|
||||
List<Map<String, Object>> map = service.getApproachingDetailsByUnit();
|
||||
return AjaxResult.success(map);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
throw new ServiceException("数据查询异常,请联系运维人员查询日志处理");
|
||||
}
|
||||
}
|
||||
|
||||
// 竣工未退预警数量
|
||||
@GetMapping(value = "getCompletionNotRefunded")
|
||||
public AjaxResult getCompletionNotRefunded(ProIdsBean bean) {
|
||||
|
|
@ -135,6 +163,7 @@ public class PushProDataUseInfoController extends BaseController {
|
|||
@GetMapping(value = "getCompletionNotRefundedDetails")
|
||||
public TableDataInfo getCompletionNotRefundedDetails(ProIdsBean bean) {
|
||||
try {
|
||||
startPage();
|
||||
List<MachineInfoBean> results = service.getCompletionNotRefundedDetails(bean);
|
||||
return getDataTable(results);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -147,6 +176,7 @@ public class PushProDataUseInfoController extends BaseController {
|
|||
@GetMapping(value = "getInventoryAlert")
|
||||
public TableDataInfo getInventoryAlert(ProIdsBean bean) {
|
||||
try {
|
||||
startPage();
|
||||
List<InventoryAlertBean> results = service.getInventoryAlert(bean);
|
||||
return getDataTable(results);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -155,4 +185,16 @@ public class PushProDataUseInfoController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "getInventoryAlertName")
|
||||
public AjaxResult getInventoryAlertName(ProIdsBean bean) {
|
||||
try {
|
||||
List<InventoryAlertBean> results = service.getInventoryAlertName(bean);
|
||||
return AjaxResult.success(results);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
throw new ServiceException("数据查询异常,请联系运维人员查询日志处理");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.push.domain;
|
||||
|
||||
import cn.hutool.db.Page;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -36,4 +37,6 @@ public class ProIdsBean {
|
|||
* 公司名称
|
||||
*/
|
||||
private String unitName;
|
||||
|
||||
private String externalId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +1,37 @@
|
|||
package com.bonus.material.push.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/8/23 - 16:29
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("装备总览")
|
||||
public class TotalNumsBean {
|
||||
|
||||
@ApiModelProperty(value = "装备总览")
|
||||
private BigDecimal total;
|
||||
|
||||
@ApiModelProperty("分层列表")
|
||||
List<SingleEquipmentStatistic> list;
|
||||
|
||||
/**
|
||||
* 单个分层
|
||||
* 分类类型: 0-总计, 1-牵张设备, 2-抱杆, 3-动力设备,
|
||||
* 4-变电专业设备, 5-安全工器具, 6-自主创新设备, 7-其他
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("单个分层实体vo")
|
||||
public static class SingleEquipmentStatistic {
|
||||
private Integer isStatics;
|
||||
|
||||
@ApiModelProperty("类别名称")
|
||||
private String equipmentName;
|
||||
private BigDecimal inventoryNum;
|
||||
private BigDecimal useNum;
|
||||
private BigDecimal repairNum;
|
||||
private BigDecimal num;
|
||||
private BigDecimal ApproachingNum;
|
||||
private BigDecimal TimeoutNum;
|
||||
|
||||
@ApiModelProperty("保有量")
|
||||
private BigDecimal inventoryNum;
|
||||
// 可以根据需要添加分类名称getter方法
|
||||
public String getCategoryName() {
|
||||
if (isStatics == null) return "未知";
|
||||
|
||||
@ApiModelProperty("在用量")
|
||||
private BigDecimal useNum;
|
||||
|
||||
@ApiModelProperty("维修数量")
|
||||
private BigDecimal repairNum;
|
||||
|
||||
@ApiModelProperty("库存量")
|
||||
private BigDecimal num;
|
||||
switch (isStatics) {
|
||||
case 0: return "总计";
|
||||
case 1: return "牵张设备";
|
||||
case 2: return "抱杆";
|
||||
case 3: return "动力设备";
|
||||
case 4: return "变电专业设备";
|
||||
case 5: return "安全工器具";
|
||||
case 6: return "自主创新设备";
|
||||
case 7: return "其他";
|
||||
default: return "未知分类";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
|
|
@ -35,4 +36,10 @@ public interface ProDataUseInfoMapper {
|
|||
List<MachineInfoBean> getCompletionNotRefundedDetails(ProIdsBean bean);
|
||||
|
||||
List<InventoryAlertBean> getInventoryAlert(ProIdsBean bean);
|
||||
|
||||
List<InventoryAlertBean> getInventoryAlertName(ProIdsBean bean);
|
||||
|
||||
List<Map<String, Object>> getApproachingDetailsByUnit();
|
||||
|
||||
List<MachineInfoBean> getMaTypeList(ProIdsBean bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.bonus.material.push.domain.*;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
|
|
@ -16,6 +17,7 @@ public interface ProDataUseInfoService {
|
|||
|
||||
/**
|
||||
* 查询七大类设备保有量、在用量、再修量、库存量
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -30,4 +32,10 @@ public interface ProDataUseInfoService {
|
|||
List<MachineInfoBean> getCompletionNotRefundedDetails(ProIdsBean bean);
|
||||
|
||||
List<InventoryAlertBean> getInventoryAlert(ProIdsBean bean);
|
||||
|
||||
List<InventoryAlertBean> getInventoryAlertName(ProIdsBean bean);
|
||||
|
||||
List<Map<String, Object>> getApproachingDetailsByUnit();
|
||||
|
||||
List<MachineInfoBean> getMaTypeList(ProIdsBean bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,7 @@ import org.springframework.stereotype.Service;
|
|||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
|
|
@ -48,24 +46,86 @@ public class ProDataUseInfoImpl implements ProDataUseInfoService {
|
|||
|
||||
/**
|
||||
* 统计数据
|
||||
*
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TotalNumsBean> getNumsByStatics(ProIdsBean bean) {
|
||||
TotalNumsBean totalNumsBean = new TotalNumsBean();
|
||||
List<TotalNumsBean> beans = new ArrayList<>();
|
||||
BigDecimal totalNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
List<StaticsNumsBean> list = proDataUseInfoMapper.getNumsByStatics(bean);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (StaticsNumsBean staticsNumsBean : list) {
|
||||
totalNum = totalNum.add(staticsNumsBean.getInventoryNum());
|
||||
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 初始化7个分类的统计对象
|
||||
TotalNumsBean[] categoryBeans = new TotalNumsBean[7];
|
||||
for (int i = 0; i < 7; i++) {
|
||||
categoryBeans[i] = new TotalNumsBean();
|
||||
categoryBeans[i].setIsStatics(i + 1); // 设置分类类型(1-7)
|
||||
// 初始化所有数值字段为0
|
||||
categoryBeans[i].setInventoryNum(BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP));
|
||||
categoryBeans[i].setUseNum(BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP));
|
||||
categoryBeans[i].setRepairNum(BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP));
|
||||
categoryBeans[i].setNum(BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP));
|
||||
categoryBeans[i].setApproachingNum(BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP));
|
||||
categoryBeans[i].setTimeoutNum(BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP));
|
||||
}
|
||||
|
||||
// 总统计对象
|
||||
TotalNumsBean totalBean = new TotalNumsBean();
|
||||
totalBean.setIsStatics(0); // 0表示总计
|
||||
totalBean.setInventoryNum(BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP));
|
||||
totalBean.setUseNum(BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP));
|
||||
totalBean.setRepairNum(BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP));
|
||||
totalBean.setNum(BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP));
|
||||
totalBean.setApproachingNum(BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP));
|
||||
totalBean.setTimeoutNum(BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP));
|
||||
|
||||
// 遍历数据并分类统计
|
||||
for (StaticsNumsBean staticsNumsBean : list) {
|
||||
Integer category = staticsNumsBean.getIsStatics();
|
||||
|
||||
if (category != null && category >= 1 && category <= 7) {
|
||||
TotalNumsBean categoryBean = categoryBeans[category - 1];
|
||||
|
||||
// 累加各个数值字段
|
||||
addToTotal(categoryBean, staticsNumsBean);
|
||||
// 同时累加到总计
|
||||
addToTotal(totalBean, staticsNumsBean);
|
||||
}
|
||||
}
|
||||
|
||||
// 添加到结果列表
|
||||
beans.add(totalBean); // 先添加总计
|
||||
Collections.addAll(beans, categoryBeans);
|
||||
}
|
||||
|
||||
return beans;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将源对象的数值累加到目标对象
|
||||
*/
|
||||
private void addToTotal(TotalNumsBean target, StaticsNumsBean source) {
|
||||
if (source.getInventoryNum() != null) {
|
||||
target.setInventoryNum(target.getInventoryNum().add(source.getInventoryNum()));
|
||||
}
|
||||
if (source.getUseNum() != null) {
|
||||
target.setUseNum(target.getUseNum().add(source.getUseNum()));
|
||||
}
|
||||
if (source.getRepairNum() != null) {
|
||||
target.setRepairNum(target.getRepairNum().add(source.getRepairNum()));
|
||||
}
|
||||
if (source.getNum() != null) {
|
||||
target.setNum(target.getNum().add(source.getNum()));
|
||||
}
|
||||
if (source.getApproachingNum() != null) {
|
||||
target.setApproachingNum(target.getApproachingNum().add(source.getApproachingNum()));
|
||||
}
|
||||
if (source.getTimeoutNum() != null) {
|
||||
target.setTimeoutNum(target.getTimeoutNum().add(source.getTimeoutNum()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaticsNumsBean> getApproachingAndTimeout(ProIdsBean bean) {
|
||||
return proDataUseInfoMapper.getApproachingAndTimeout(bean);
|
||||
|
|
@ -90,4 +150,30 @@ public class ProDataUseInfoImpl implements ProDataUseInfoService {
|
|||
public List<InventoryAlertBean> getInventoryAlert(ProIdsBean bean) {
|
||||
return proDataUseInfoMapper.getInventoryAlert(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<InventoryAlertBean> getInventoryAlertName(ProIdsBean bean) {
|
||||
return proDataUseInfoMapper.getInventoryAlertName(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getApproachingDetailsByUnit() {
|
||||
return proDataUseInfoMapper.getApproachingDetailsByUnit();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MachineInfoBean> getMaTypeList(ProIdsBean bean) {
|
||||
return proDataUseInfoMapper.getMaTypeList(bean);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,24 +5,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<mapper namespace="com.bonus.material.push.mapper.ProDataUseInfoMapper">
|
||||
|
||||
<select id="getProDataUseInfo" resultType="com.bonus.material.push.domain.ProIdsBean">
|
||||
select
|
||||
bp.pro_name as proName,
|
||||
sum(sai.num) typeNum,
|
||||
mt2.type_id as typeId,
|
||||
mt2.is_statics as isStatics,
|
||||
bp.pro_id as proId
|
||||
from slt_agreement_info sai
|
||||
left join bm_agreement_info bai on sai.agreement_id = bai.agreement_id
|
||||
left join bm_project bp on bai.project_id = bp.pro_id
|
||||
left join ma_type mt on sai.type_id = mt.type_id
|
||||
left join ma_type mt2 on mt.parent_id = mt2.type_id
|
||||
where sai.is_slt = 0 and sai.end_time is null
|
||||
AND bp.pro_id = #{proId}
|
||||
AND mt2.type_id in
|
||||
SELECT
|
||||
ANY_VALUE(bp.pro_name) as proName, -- 使用ANY_VALUE
|
||||
sum(sai.num) typeNum, -- 聚合函数
|
||||
ANY_VALUE(mt2.type_id) as typeId, -- 【修正】补上了缺失的右括号
|
||||
mt2.is_statics as isStatics, -- 【关键修正】为is_statics也加上ANY_VALUE
|
||||
bp.external_id as externalId -- 已在GROUP BY中,无需处理
|
||||
FROM slt_agreement_info sai
|
||||
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
WHERE
|
||||
sai.is_slt = 0
|
||||
AND sai.end_time IS NULL
|
||||
AND bp.external_id = #{proId}
|
||||
AND mt2.type_id IN
|
||||
<foreach collection="typeIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
GROUP BY bp.pro_id,mt2.is_statics
|
||||
GROUP BY bp.pro_id, mt2.is_statics -- 分组条件
|
||||
</select>
|
||||
<select id="getTypeId" resultType="java.lang.Integer">
|
||||
select type_id from ma_type where is_statics in (1,2,3,4,5,6,7)
|
||||
|
|
@ -44,7 +46,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join ma_type mt2 on mt.parent_id = mt2.type_id
|
||||
left join ma_machine mm on mt.type_id = mm.type_id
|
||||
where sai.is_slt = 0 and sai.end_time is null
|
||||
AND bp.pro_id = #{proId}
|
||||
AND mt2.is_statics = #{isStatics}
|
||||
<if test="typeName != null and typeName !=''">
|
||||
AND mt2.type_name = #{typeName}
|
||||
|
|
@ -196,7 +197,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
where mm.next_check_time is not null
|
||||
where mm.next_check_time is not null and mt.`level` = '4'
|
||||
<if test="proId != null">
|
||||
AND bp.pro_id = #{proId}
|
||||
</if>
|
||||
|
|
@ -228,7 +229,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN sys_dept sd on bp.imp_unit = sd.dept_id
|
||||
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
WHERE mm.next_check_time is not null
|
||||
WHERE mm.next_check_time is not null AND mt.`level`=4
|
||||
<if test="proId != null">
|
||||
AND bp.pro_id = #{proId}
|
||||
</if>
|
||||
|
|
@ -270,7 +271,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join sys_dept sd on bp.imp_unit = sd.dept_id
|
||||
left join ma_type mt on sai.type_id = mt.type_id
|
||||
left join ma_type mt2 on mt.parent_id = mt2.type_id
|
||||
where sai.is_slt = 0 and sai.end_time is null and bp.actual_end_date is not null
|
||||
where sai.is_slt = 0 and sai.end_time is null and bp.actual_end_date is not null AND sd.dept_name in
|
||||
('送电一分公司','送电二分公司','检修试验分公司','建筑分公司(消防分公司)','安徽宏源电力建设有限公司','变电分公司')
|
||||
<if test="proId != null">
|
||||
AND bp.pro_id = #{proId}
|
||||
</if>
|
||||
|
|
@ -278,7 +280,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="proId != null">
|
||||
bp.pro_id,
|
||||
</if>
|
||||
bp.imp_unit
|
||||
bp.imp_unit
|
||||
</select>
|
||||
<select id="getCompletionNotRefundedDetails" resultType="com.bonus.material.push.domain.MachineInfoBean">
|
||||
select
|
||||
|
|
@ -317,25 +319,79 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="typeModelName != null and typeModelName !=''">
|
||||
AND mt.type_name = #{typeModelName}
|
||||
</if>
|
||||
GROUP BY
|
||||
<if test="proId != null">
|
||||
bp.pro_id,
|
||||
</if>
|
||||
bp.imp_unit
|
||||
|
||||
</select>
|
||||
<select id="getInventoryAlert" resultType="com.bonus.material.push.domain.InventoryAlertBean">
|
||||
select
|
||||
mt.type_name as typeModelName,
|
||||
mt2.type_name as typeName,
|
||||
mt.warn_num as warnNum,
|
||||
mt.storage_num as num,
|
||||
mt.warn_num - mt.storage_num as poorNum
|
||||
mt.storage_num as num
|
||||
from ma_type mt
|
||||
left join ma_type mt2 on mt.parent_id = mt2.type_id
|
||||
where mt2.is_statics in (1,2,3,4,5,6,7)
|
||||
and mt.warn_num - mt.storage_num > 0
|
||||
where mt.del_flag = 0 and mt.`level`=4
|
||||
<if test="typeName != null and typeName !=''">
|
||||
AND mt2.type_name = #{typeName}
|
||||
</if>
|
||||
<if test="typeModelName != null and typeModelName !=''">
|
||||
AND mt.type_name = #{typeModelName}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getInventoryAlertName" resultType="com.bonus.material.push.domain.InventoryAlertBean">
|
||||
select
|
||||
mt.type_name as typeModelName,
|
||||
mt2.type_name as typeName
|
||||
from ma_type mt
|
||||
left join ma_type mt2 on mt.parent_id = mt2.type_id
|
||||
where mt.del_flag = 0 and mt.`level`=4
|
||||
<if test="typeName != null and typeName !=''">
|
||||
AND mt2.type_name = #{typeName}
|
||||
</if>
|
||||
<if test="typeModelName != null and typeModelName !=''">
|
||||
AND mt.type_name = #{typeModelName}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getApproachingDetailsByUnit" resultType="java.util.Map">
|
||||
SELECT COUNT(CASE
|
||||
WHEN mm.next_check_time BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 30 DAY) THEN 1
|
||||
ELSE NULL END)
|
||||
AS ApproachingNum,
|
||||
COUNT(CASE WHEN mm.next_check_time < NOW() THEN 1 ELSE NULL END) AS TimeoutNum,
|
||||
sd.dept_name as deptName
|
||||
FROM ma_machine mm
|
||||
LEFT JOIN slt_agreement_info sai ON sai.ma_id = mm.ma_id
|
||||
AND mm.type_id = sai.type_id
|
||||
AND sai.`status` = '0'
|
||||
AND sai.end_time IS NULL
|
||||
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
LEFT JOIN sys_dept sd on bp.imp_unit = sd.dept_id
|
||||
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
WHERE mm.next_check_time IS NOT NULL
|
||||
AND mt.`level` = '4'
|
||||
AND sd.dept_name in
|
||||
('送电一分公司', '送电二分公司', '检修试验分公司', '建筑分公司(消防分公司)', '安徽宏源电力建设有限公司',
|
||||
'变电分公司')
|
||||
GROUP BY bp.imp_unit
|
||||
</select>
|
||||
<select id="getMaTypeList" resultType="com.bonus.material.push.domain.MachineInfoBean">
|
||||
SELECT
|
||||
mt.type_name AS typeModelName,
|
||||
mt2.type_name AS typeName,
|
||||
mt.unit_name AS unitName,
|
||||
mt.storage_num AS storageNum
|
||||
FROM
|
||||
ma_type mt
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
WHERE
|
||||
mt.del_flag = 0
|
||||
AND mt.`level` =4
|
||||
<if test="typeName != null and typeName !=''">
|
||||
AND mt2.type_name = #{typeName}
|
||||
</if>
|
||||
<if test="typeModelName != null and typeModelName !=''">
|
||||
AND mt.type_name = #{typeModelName}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue