代码提交
This commit is contained in:
parent
a5274db2e3
commit
17178c4dfb
|
|
@ -5,12 +5,15 @@ import com.bonus.common.core.web.controller.BaseController;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.common.core.web.page.TableDataInfo;
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
import com.bonus.material.push.domain.*;
|
import com.bonus.material.push.domain.*;
|
||||||
|
import com.bonus.material.push.mapper.ProDataUseInfoMapper;
|
||||||
import com.bonus.material.push.service.ProDataUseInfoService;
|
import com.bonus.material.push.service.ProDataUseInfoService;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -27,6 +30,9 @@ public class PushProDataUseInfoController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private ProDataUseInfoService service;
|
private ProDataUseInfoService service;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ProDataUseInfoMapper proDataUseInfoMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询推送数据使用信息
|
* 查询推送数据使用信息
|
||||||
*
|
*
|
||||||
|
|
@ -93,6 +99,37 @@ public class PushProDataUseInfoController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保有量、在用量、再修量、库存量 装备详情
|
||||||
|
*
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "getAllMacheDetails")
|
||||||
|
public TableDataInfo getAllMacheDetails(ProIdsBean bean) {
|
||||||
|
List<MachineInfoBean> objects = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
startPage();
|
||||||
|
if (StringUtils.isNotBlank(bean.getStatus()) && bean.getStatus().equals("在用")) {
|
||||||
|
objects = service.getUseNumsDetails(bean);
|
||||||
|
} else if (StringUtils.isNotBlank(bean.getStatus()) && bean.getStatus().equals("在修")) {
|
||||||
|
objects = service.getRepairNumsDetails(bean);
|
||||||
|
} else if (StringUtils.isNotBlank(bean.getStatus()) && bean.getStatus().equals("在库")) {
|
||||||
|
objects = service.getNumsDetails(bean);
|
||||||
|
} else {
|
||||||
|
objects = service.getAllMacheDetails(bean);
|
||||||
|
}
|
||||||
|
for (MachineInfoBean machineDetail : objects) {
|
||||||
|
String typeKeeperName = proDataUseInfoMapper.getTypeKeeperName(machineDetail);
|
||||||
|
machineDetail.setTypeKeeperName(typeKeeperName);
|
||||||
|
}
|
||||||
|
return getDataTable(objects);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.toString(), e);
|
||||||
|
throw new ServiceException("数据查询异常,请联系运维人员查询日志处理");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 检验临期和检验超期数量
|
// 检验临期和检验超期数量
|
||||||
@GetMapping(value = "getApproachingAndTimeout")
|
@GetMapping(value = "getApproachingAndTimeout")
|
||||||
public AjaxResult getApproachingAndTimeout(ProIdsBean bean) {
|
public AjaxResult getApproachingAndTimeout(ProIdsBean bean) {
|
||||||
|
|
@ -130,7 +167,7 @@ public class PushProDataUseInfoController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 竣工未退预警数量
|
// 竣工未退预警数量(总公司)
|
||||||
@GetMapping(value = "getCompletionNotRefunded")
|
@GetMapping(value = "getCompletionNotRefunded")
|
||||||
public AjaxResult getCompletionNotRefunded(ProIdsBean bean) {
|
public AjaxResult getCompletionNotRefunded(ProIdsBean bean) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -142,6 +179,18 @@ public class PushProDataUseInfoController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 竣工未退预警数量(分公司)
|
||||||
|
@GetMapping(value = "getCompletionNotRefundedSub")
|
||||||
|
public AjaxResult getCompletionNotRefundedSub(ProIdsBean bean) {
|
||||||
|
try {
|
||||||
|
List<MachineInfoBean> results = service.getCompletionNotRefundedSub(bean);
|
||||||
|
return AjaxResult.success(results);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.toString(), e);
|
||||||
|
throw new ServiceException("数据查询异常,请联系运维人员查询日志处理");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//竣工未退预警总量
|
//竣工未退预警总量
|
||||||
@GetMapping(value = "getCompletionNotRefundedNum")
|
@GetMapping(value = "getCompletionNotRefundedNum")
|
||||||
|
|
|
||||||
|
|
@ -47,5 +47,11 @@ public class MachineInfoBean {
|
||||||
private Integer daysDiff;
|
private Integer daysDiff;
|
||||||
// 竣工时间
|
// 竣工时间
|
||||||
private String actualEndDate;
|
private String actualEndDate;
|
||||||
|
// 负责人
|
||||||
|
private String personName;
|
||||||
|
|
||||||
|
// 联系方式
|
||||||
|
private String personPhone;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ public class ProIdsBean {
|
||||||
private String proName;
|
private String proName;
|
||||||
private Integer typeId;
|
private Integer typeId;
|
||||||
private String typeName;
|
private String typeName;
|
||||||
|
private String status;
|
||||||
private String typeModelName;
|
private String typeModelName;
|
||||||
private String deptName;
|
private String deptName;
|
||||||
private String proCenter;
|
private String proCenter;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.bonus.material.push.mapper;
|
package com.bonus.material.push.mapper;
|
||||||
|
|
||||||
import com.bonus.material.push.domain.*;
|
import com.bonus.material.push.domain.*;
|
||||||
|
import com.bonus.system.api.domain.SysUser;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
|
@ -42,4 +43,16 @@ public interface ProDataUseInfoMapper {
|
||||||
List<Map<String, Object>> getApproachingDetailsByUnit();
|
List<Map<String, Object>> getApproachingDetailsByUnit();
|
||||||
|
|
||||||
List<MachineInfoBean> getMaTypeList(ProIdsBean bean);
|
List<MachineInfoBean> getMaTypeList(ProIdsBean bean);
|
||||||
|
|
||||||
|
List<MachineInfoBean> getUseNumsDetails(ProIdsBean bean);
|
||||||
|
|
||||||
|
List<MachineInfoBean> getRepairNumsDetails(ProIdsBean bean);
|
||||||
|
|
||||||
|
List<MachineInfoBean> getNumsDetails(ProIdsBean bean);
|
||||||
|
|
||||||
|
List<MachineInfoBean> getAllMacheDetails(ProIdsBean bean);
|
||||||
|
|
||||||
|
SysUser getPersonNameAndPhone(MachineInfoBean machineDetail);
|
||||||
|
|
||||||
|
List<MachineInfoBean> getCompletionNotRefundedSub(ProIdsBean bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,12 @@ public interface ProDataUseInfoService {
|
||||||
List<Map<String, Object>> getApproachingDetailsByUnit();
|
List<Map<String, Object>> getApproachingDetailsByUnit();
|
||||||
|
|
||||||
List<MachineInfoBean> getMaTypeList(ProIdsBean bean);
|
List<MachineInfoBean> getMaTypeList(ProIdsBean bean);
|
||||||
|
|
||||||
|
List<MachineInfoBean> getUseNumsDetails(ProIdsBean bean);
|
||||||
|
List<MachineInfoBean> getRepairNumsDetails(ProIdsBean bean);
|
||||||
|
List<MachineInfoBean> getNumsDetails(ProIdsBean bean);
|
||||||
|
|
||||||
|
List<MachineInfoBean> getAllMacheDetails(ProIdsBean bean);
|
||||||
|
|
||||||
|
List<MachineInfoBean> getCompletionNotRefundedSub(ProIdsBean bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,14 @@ import com.bonus.material.push.domain.*;
|
||||||
|
|
||||||
import com.bonus.material.push.mapper.ProDataUseInfoMapper;
|
import com.bonus.material.push.mapper.ProDataUseInfoMapper;
|
||||||
import com.bonus.material.push.service.ProDataUseInfoService;
|
import com.bonus.material.push.service.ProDataUseInfoService;
|
||||||
|
import com.bonus.system.api.domain.SysUser;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:liang.chao
|
* @Author:liang.chao
|
||||||
|
|
@ -164,7 +166,7 @@ public class ProDataUseInfoImpl implements ProDataUseInfoService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getApproachingDetailsByUnit() {
|
public List<Map<String, Object>> getApproachingDetailsByUnit() {
|
||||||
return proDataUseInfoMapper.getApproachingDetailsByUnit();
|
return proDataUseInfoMapper.getApproachingDetailsByUnit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -174,6 +176,41 @@ public class ProDataUseInfoImpl implements ProDataUseInfoService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<MachineInfoBean> getMaTypeList(ProIdsBean bean) {
|
public List<MachineInfoBean> getMaTypeList(ProIdsBean bean) {
|
||||||
return proDataUseInfoMapper.getMaTypeList(bean);
|
List<MachineInfoBean> maTypeList = proDataUseInfoMapper.getMaTypeList(bean);
|
||||||
|
for (MachineInfoBean machineDetail : maTypeList) {
|
||||||
|
SysUser user = proDataUseInfoMapper.getPersonNameAndPhone(machineDetail);
|
||||||
|
machineDetail.setPersonName(user.getNickName());
|
||||||
|
machineDetail.setPersonPhone(user.getPhonenumber());
|
||||||
|
}
|
||||||
|
return maTypeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MachineInfoBean> getUseNumsDetails(ProIdsBean bean) {
|
||||||
|
// 在用量
|
||||||
|
return proDataUseInfoMapper.getUseNumsDetails(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MachineInfoBean> getRepairNumsDetails(ProIdsBean bean) {
|
||||||
|
// 在修量
|
||||||
|
return proDataUseInfoMapper.getRepairNumsDetails(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MachineInfoBean> getNumsDetails(ProIdsBean bean) {
|
||||||
|
// 库存量
|
||||||
|
return proDataUseInfoMapper.getNumsDetails(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MachineInfoBean> getAllMacheDetails(ProIdsBean bean) {
|
||||||
|
List<MachineInfoBean> objects = proDataUseInfoMapper.getAllMacheDetails(bean);
|
||||||
|
return objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MachineInfoBean> getCompletionNotRefundedSub(ProIdsBean bean) {
|
||||||
|
return proDataUseInfoMapper.getCompletionNotRefundedSub(bean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="getProDataUseInfo" resultType="com.bonus.material.push.domain.ProIdsBean">
|
<select id="getProDataUseInfo" resultType="com.bonus.material.push.domain.ProIdsBean">
|
||||||
SELECT
|
SELECT
|
||||||
ANY_VALUE(bp.pro_name) as proName, -- 使用ANY_VALUE
|
ANY_VALUE(bp.pro_name) as proName,
|
||||||
sum(sai.num) typeNum, -- 聚合函数
|
sum(sai.num) typeNum,
|
||||||
ANY_VALUE(mt2.type_id) as typeId, -- 【修正】补上了缺失的右括号
|
ANY_VALUE(mt2.type_id) as typeId,
|
||||||
mt2.is_statics as isStatics, -- 【关键修正】为is_statics也加上ANY_VALUE
|
mt2.is_statics as isStatics,
|
||||||
bp.external_id as externalId -- 已在GROUP BY中,无需处理
|
bp.external_id as externalId
|
||||||
FROM slt_agreement_info sai
|
FROM slt_agreement_info sai
|
||||||
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
|
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 bm_project bp ON bai.project_id = bp.pro_id
|
||||||
|
|
@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<foreach collection="typeIds" item="id" open="(" separator="," close=")">
|
<foreach collection="typeIds" item="id" open="(" separator="," close=")">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
GROUP BY bp.pro_id, mt2.is_statics -- 分组条件
|
GROUP BY bp.external_id, mt2.is_statics
|
||||||
</select>
|
</select>
|
||||||
<select id="getTypeId" resultType="java.lang.Integer">
|
<select id="getTypeId" resultType="java.lang.Integer">
|
||||||
select type_id from ma_type where is_statics in (1,2,3,4,5,6,7)
|
select type_id from ma_type where is_statics in (1,2,3,4,5,6,7)
|
||||||
|
|
@ -44,8 +44,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
left join bm_project bp on bai.project_id = bp.pro_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 mt on sai.type_id = mt.type_id
|
||||||
left join ma_type mt2 on mt.parent_id = mt2.type_id
|
left join ma_type mt2 on mt.parent_id = mt2.type_id
|
||||||
left join ma_machine mm on mt.type_id = mm.type_id
|
left join ma_machine mm on sai.ma_id = mm.ma_id
|
||||||
where sai.is_slt = 0 and sai.end_time is null
|
where sai.is_slt = 0 and sai.end_time is null
|
||||||
|
AND bp.external_id = #{externalId}
|
||||||
AND mt2.is_statics = #{isStatics}
|
AND mt2.is_statics = #{isStatics}
|
||||||
<if test="typeName != null and typeName !=''">
|
<if test="typeName != null and typeName !=''">
|
||||||
AND mt2.type_name like concat ('%', #{typeName}, '%')
|
AND mt2.type_name like concat ('%', #{typeName}, '%')
|
||||||
|
|
@ -53,7 +54,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="typeModelName != null and typeModelName !=''">
|
<if test="typeModelName != null and typeModelName !=''">
|
||||||
AND mt.type_name like concat ('%', #{typeModelName}, '%')
|
AND mt.type_name like concat ('%', #{typeModelName}, '%')
|
||||||
</if>
|
</if>
|
||||||
GROUP BY bp.pro_id
|
|
||||||
</select>
|
</select>
|
||||||
<select id="getTypeKeeperName" resultType="java.lang.String">
|
<select id="getTypeKeeperName" resultType="java.lang.String">
|
||||||
select group_concat(su.nick_name) from ma_type_keeper mtk
|
select group_concat(su.nick_name) from ma_type_keeper mtk
|
||||||
|
|
@ -123,8 +123,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="unitName != null and unitName !=''">
|
<if test="unitName != null and unitName !=''">
|
||||||
AND sd.dept_name = #{unitName}
|
AND sd.dept_name = #{unitName}
|
||||||
</if>
|
</if>
|
||||||
<if test="proId != null">
|
<if test="deptId != null">
|
||||||
AND bp.pro_id = #{proId}
|
AND sd.dept_id = #{deptId}
|
||||||
</if>
|
</if>
|
||||||
<if test="isStatics != null">
|
<if test="isStatics != null">
|
||||||
and mt2.is_statics = #{isStatics}
|
and mt2.is_statics = #{isStatics}
|
||||||
|
|
@ -163,8 +163,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="unitName != null and unitName !=''">
|
<if test="unitName != null and unitName !=''">
|
||||||
AND sd.dept_name = #{unitName}
|
AND sd.dept_name = #{unitName}
|
||||||
</if>
|
</if>
|
||||||
<if test="proId != null">
|
<if test="deptId != null">
|
||||||
AND bp.pro_id = #{proId}
|
AND sd.dept_id = #{deptId}
|
||||||
</if>
|
</if>
|
||||||
<if test="isStatics != null">
|
<if test="isStatics != null">
|
||||||
and mt2.is_statics = #{isStatics}
|
and mt2.is_statics = #{isStatics}
|
||||||
|
|
@ -197,14 +197,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_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 mt ON sai.type_id = mt.type_id
|
||||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||||
|
left join sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||||
where mm.next_check_time is not null and mt.`level` = '4'
|
where mm.next_check_time is not null and mt.`level` = '4'
|
||||||
<if test="proId != null">
|
<if test="deptId != null">
|
||||||
AND bp.pro_id = #{proId}
|
AND sd.dept_id = #{deptId}
|
||||||
</if>
|
</if>
|
||||||
AND mm.next_check_time IS NOT NULL
|
AND mm.next_check_time IS NOT NULL
|
||||||
<if test="proId != null">
|
|
||||||
GROUP BY bp.pro_id
|
|
||||||
</if>
|
|
||||||
</select>
|
</select>
|
||||||
<select id="getApproachingDetails" resultType="com.bonus.material.push.domain.MachineInfoBean">
|
<select id="getApproachingDetails" resultType="com.bonus.material.push.domain.MachineInfoBean">
|
||||||
SELECT
|
SELECT
|
||||||
|
|
@ -261,7 +259,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="getCompletionNotRefunded" resultType="com.bonus.material.push.domain.MachineInfoBean">
|
<select id="getCompletionNotRefunded" resultType="com.bonus.material.push.domain.MachineInfoBean">
|
||||||
select
|
select
|
||||||
bp.pro_name as proName,
|
bp.pro_name as proName,
|
||||||
sum(sai.num) num,
|
count(bp.pro_id) num,
|
||||||
mt2.type_id as typeId,
|
mt2.type_id as typeId,
|
||||||
sd.dept_name as deptName,
|
sd.dept_name as deptName,
|
||||||
sd.dept_id as deptId
|
sd.dept_id as deptId
|
||||||
|
|
@ -376,6 +374,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
<select id="getMaTypeList" resultType="com.bonus.material.push.domain.MachineInfoBean">
|
<select id="getMaTypeList" resultType="com.bonus.material.push.domain.MachineInfoBean">
|
||||||
SELECT
|
SELECT
|
||||||
|
mt.type_id AS typeId,
|
||||||
mt.type_name AS typeModelName,
|
mt.type_name AS typeModelName,
|
||||||
mt2.type_name AS typeName,
|
mt2.type_name AS typeName,
|
||||||
mt.unit_name AS unit,
|
mt.unit_name AS unit,
|
||||||
|
|
@ -393,5 +392,269 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
AND mt.type_name like concat ('%', #{typeModelName}, '%')
|
AND mt.type_name like concat ('%', #{typeModelName}, '%')
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getUseNumsDetails" resultType="com.bonus.material.push.domain.MachineInfoBean">
|
||||||
|
select
|
||||||
|
mt.type_id as typeId,
|
||||||
|
mt2.type_name as typeName,
|
||||||
|
mt.type_name as typeModelName,
|
||||||
|
mt.unit_name as unit,
|
||||||
|
mm.assets_code as assetsCode,
|
||||||
|
ifnull(mt.lease_price,0) as rentPrice,
|
||||||
|
SUM(IFNULL( sai.num, 0 )) AS num,
|
||||||
|
'在用' AS status
|
||||||
|
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 mt.type_id = sai.type_id
|
||||||
|
left join ma_machine mm ON mm.ma_id = sai.ma_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
|
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||||
|
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||||
|
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||||
|
WHERE
|
||||||
|
sai.`status` = '0' and sai.`is_slt` = '0'
|
||||||
|
<if test="unitName != null and unitName !=''">
|
||||||
|
AND sd.dept_name = #{unitName}
|
||||||
|
</if>
|
||||||
|
<if test="deptId != null">
|
||||||
|
AND sd.dept_id = #{deptId}
|
||||||
|
</if>
|
||||||
|
<if test="isStatics != null">
|
||||||
|
and mt2.is_statics = #{isStatics}
|
||||||
|
</if>
|
||||||
|
<if test="typeName != null and typeName !=''">
|
||||||
|
AND mt2.type_name like concat ('%', #{typeName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="typeModelName != null and typeModelName !=''">
|
||||||
|
AND mt.type_name like concat ('%', #{typeModelName}, '%')
|
||||||
|
</if>
|
||||||
|
AND sai.end_time IS NULL
|
||||||
|
AND sai.back_id IS NULL
|
||||||
|
GROUP BY mt.type_id
|
||||||
|
</select>
|
||||||
|
<select id="getRepairNumsDetails" resultType="com.bonus.material.push.domain.MachineInfoBean">
|
||||||
|
SELECT
|
||||||
|
mt.type_id as typeId,
|
||||||
|
mt2.type_name as typeName,
|
||||||
|
mt.type_name as typeModelName,
|
||||||
|
mt.unit_name as unit,
|
||||||
|
mm.assets_code as assetsCode,
|
||||||
|
ifnull(mt.lease_price,0) as rentPrice,
|
||||||
|
SUM(
|
||||||
|
IFNULL(rad.repair_num, 0) - IFNULL(rad.repaired_num, 0) -
|
||||||
|
IFNULL(rad.scrap_num, 0)) AS num,
|
||||||
|
'在修' AS status
|
||||||
|
FROM repair_apply_details rad
|
||||||
|
LEFT JOIN tm_task tt ON rad.task_id = tt.task_id
|
||||||
|
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
|
||||||
|
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||||
|
LEFT JOIN ma_type mt ON mt.type_id = rad.type_id
|
||||||
|
left join ma_machine mm ON mm.ma_id = rad.ma_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
|
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||||
|
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||||
|
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||||
|
WHERE
|
||||||
|
rad.status = '0'
|
||||||
|
<if test="unitName != null and unitName !=''">
|
||||||
|
AND sd.dept_name = #{unitName}
|
||||||
|
</if>
|
||||||
|
<if test="deptId != null">
|
||||||
|
AND sd.dept_id = #{deptId}
|
||||||
|
</if>
|
||||||
|
<if test="isStatics != null">
|
||||||
|
and mt2.is_statics = #{isStatics}
|
||||||
|
</if>
|
||||||
|
<if test="typeName != null and typeName !=''">
|
||||||
|
AND mt2.type_name like concat ('%', #{typeName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="typeModelName != null and typeModelName !=''">
|
||||||
|
AND mt.type_name like concat ('%', #{typeModelName}, '%')
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
mt.type_id
|
||||||
|
</select>
|
||||||
|
<select id="getNumsDetails" resultType="com.bonus.material.push.domain.MachineInfoBean">
|
||||||
|
SELECT
|
||||||
|
mt.type_id as typeId,
|
||||||
|
mt2.type_name as typeName,
|
||||||
|
mt.type_name as typeModelName,
|
||||||
|
mt.unit_name as unit,
|
||||||
|
mm.assets_code as assetsCode,
|
||||||
|
ifnull(mt.lease_price,0) as rentPrice,
|
||||||
|
CASE mt.manage_type
|
||||||
|
WHEN 0 THEN
|
||||||
|
IFNULL(count(mm.ma_id), 0)
|
||||||
|
ELSE
|
||||||
|
IFNULL(mt.storage_num, 0)
|
||||||
|
END AS num,
|
||||||
|
'在库' AS status
|
||||||
|
FROM ma_machine mm
|
||||||
|
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
|
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||||
|
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||||
|
WHERE mm.ma_code is not null and mm.ma_status in (1) and mt.`level` = 4
|
||||||
|
<if test="typeName != null and typeName !=''">
|
||||||
|
AND mt2.type_name like concat ('%', #{typeName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="typeModelName != null and typeModelName !=''">
|
||||||
|
AND mt.type_name like concat ('%', #{typeModelName}, '%')
|
||||||
|
</if>
|
||||||
|
GROUP BY mt.type_id
|
||||||
|
</select>
|
||||||
|
<select id="getAllMacheDetails" resultType="com.bonus.material.push.domain.MachineInfoBean">
|
||||||
|
( SELECT
|
||||||
|
mt.type_id as typeId,
|
||||||
|
mt2.type_name as typeName,
|
||||||
|
mt.type_name as typeModelName,
|
||||||
|
mt.unit_name as unit,
|
||||||
|
mm.assets_code as assetsCode,
|
||||||
|
ifnull(mt.lease_price,0) as rentPrice,
|
||||||
|
SUM(
|
||||||
|
IFNULL( sai.num, 0 )) AS num,
|
||||||
|
'在用' AS STATUS
|
||||||
|
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 mt.type_id = sai.type_id
|
||||||
|
left join ma_machine mm ON mm.ma_id = sai.ma_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
|
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||||
|
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||||
|
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||||
|
WHERE
|
||||||
|
sai.STATUS = '0' AND mt.LEVEL = 4
|
||||||
|
<if test="unitName != null and unitName !=''">
|
||||||
|
AND sd.dept_name = #{unitName}
|
||||||
|
</if>
|
||||||
|
<if test="deptId != null">
|
||||||
|
AND sd.dept_id = #{deptId}
|
||||||
|
</if>
|
||||||
|
<if test="isStatics != null">
|
||||||
|
and mt2.is_statics = #{isStatics}
|
||||||
|
</if>
|
||||||
|
<if test="typeName != null and typeName !=''">
|
||||||
|
AND mt2.type_name like concat ('%', #{typeName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="typeModelName != null and typeModelName !=''">
|
||||||
|
AND mt.type_name like concat ('%', #{typeModelName}, '%')
|
||||||
|
</if>
|
||||||
|
AND sai.is_slt = '0'
|
||||||
|
AND sai.end_time IS NULL
|
||||||
|
AND sai.back_id IS NULL
|
||||||
|
GROUP BY
|
||||||
|
mt.type_id
|
||||||
|
) UNION ALL
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
mt.type_id as typeId,
|
||||||
|
mt2.type_name as typeName,
|
||||||
|
mt.type_name as typeModelName,
|
||||||
|
mt.unit_name as unit,
|
||||||
|
mm.assets_code as assetsCode,
|
||||||
|
ifnull(mt.lease_price,0) as rentPrice,
|
||||||
|
SUM(
|
||||||
|
IFNULL( rad.repair_num, 0 ) - IFNULL( rad.repaired_num, 0 ) - IFNULL( rad.scrap_num, 0 )) AS num,
|
||||||
|
'在修' AS STATUS
|
||||||
|
FROM
|
||||||
|
repair_apply_details rad
|
||||||
|
LEFT JOIN tm_task tt ON rad.task_id = tt.task_id
|
||||||
|
LEFT JOIN tm_task_agreement tta ON tt.task_id = tta.task_id
|
||||||
|
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||||
|
LEFT JOIN ma_type mt ON mt.type_id = rad.type_id
|
||||||
|
left join ma_machine mm ON mm.ma_id = rad.ma_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
|
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||||
|
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||||
|
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||||
|
WHERE
|
||||||
|
rad.STATUS = '0' AND mt.LEVEL = 4
|
||||||
|
<if test="unitName != null and unitName !=''">
|
||||||
|
AND sd.dept_name = #{unitName}
|
||||||
|
</if>
|
||||||
|
<if test="deptId != null">
|
||||||
|
AND sd.dept_id = #{deptId}
|
||||||
|
</if>
|
||||||
|
<if test="isStatics != null">
|
||||||
|
and mt2.is_statics = #{isStatics}
|
||||||
|
</if>
|
||||||
|
<if test="typeName != null and typeName !=''">
|
||||||
|
AND mt2.type_name like concat ('%', #{typeName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="typeModelName != null and typeModelName !=''">
|
||||||
|
AND mt.type_name like concat ('%', #{typeModelName}, '%')
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
mt.type_id
|
||||||
|
) UNION ALL
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
mt.type_id as typeId,
|
||||||
|
mt2.type_name as typeName,
|
||||||
|
mt.type_name as typeModelName,
|
||||||
|
mt.unit_name as unit,
|
||||||
|
mm.assets_code as assetsCode,
|
||||||
|
ifnull(mt.lease_price,0) as rentPrice,
|
||||||
|
CASE
|
||||||
|
mt.manage_type
|
||||||
|
WHEN 0 THEN
|
||||||
|
IFNULL( COUNT( mm.ma_id ), 0 ) ELSE IFNULL( mt.storage_num, 0 )
|
||||||
|
END AS num,
|
||||||
|
'在库' AS STATUS
|
||||||
|
FROM
|
||||||
|
ma_machine mm
|
||||||
|
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
|
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||||
|
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||||
|
WHERE
|
||||||
|
mm.ma_code IS NOT NULL
|
||||||
|
AND mm.ma_status IN ( 1 )
|
||||||
|
AND mt.LEVEL = 4
|
||||||
|
<if test="typeName != null and typeName !=''">
|
||||||
|
AND mt2.type_name like concat ('%', #{typeName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="typeModelName != null and typeModelName !=''">
|
||||||
|
AND mt.type_name like concat ('%', #{typeModelName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="isStatics != null">
|
||||||
|
and mt2.is_statics = #{isStatics}
|
||||||
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
mt.type_id
|
||||||
|
)
|
||||||
|
</select>
|
||||||
|
<select id="getPersonNameAndPhone" resultType="com.bonus.system.api.domain.SysUser">
|
||||||
|
SELECT
|
||||||
|
su.nick_name AS nickName,
|
||||||
|
su.phonenumber
|
||||||
|
FROM ma_type_keeper mtk
|
||||||
|
LEFT JOIN sys_user su ON mtk.user_id = su.user_id
|
||||||
|
WHERE mtk.type_id = #{typeId}
|
||||||
|
AND su.phonenumber IS NOT NULL
|
||||||
|
ORDER BY mtk.user_id DESC
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
<select id="getCompletionNotRefundedSub" resultType="com.bonus.material.push.domain.MachineInfoBean">
|
||||||
|
select
|
||||||
|
bp.pro_center as proCenter,
|
||||||
|
count(bp.pro_id) num,
|
||||||
|
mt2.type_id as typeId,
|
||||||
|
sd.dept_name as deptName,
|
||||||
|
sd.dept_id as deptId
|
||||||
|
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 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 AND bp.imp_unit = #{deptId}
|
||||||
|
GROUP BY bp.pro_center
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue