接口调试
This commit is contained in:
parent
ac845e3c5c
commit
75c57a4e86
|
|
@ -155,32 +155,7 @@ public class ArchivesServiceImpl implements ArchivesService {
|
|||
*/
|
||||
@Override
|
||||
public List<ArchivesDetails> getDetailsList(ArchivesDetails archivesDetails) {
|
||||
List<ArchivesDetails> list = archivesMapper.selectDetailsList(archivesDetails);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (ArchivesDetails details : list) {
|
||||
if ((StringUtils.isNotBlank(details.getDocUrl())) && StringUtils.isNotBlank(details.getDocName())) {
|
||||
if (details.getDocUrl().startsWith("http") && details.getUpdateBy() == null) {
|
||||
String originalPath = details.getDocName();
|
||||
// 找到最后一个 '/' 字符的位置
|
||||
int lastSlashIndex = originalPath.lastIndexOf('/');
|
||||
// 从最后一个 '/' 字符之后提取文件名
|
||||
String fileName = originalPath.substring(lastSlashIndex + 1);
|
||||
// 找到 '.png' 的位置
|
||||
int dotIndex = fileName.lastIndexOf('.');
|
||||
// 找到倒数第二个 '_' 的位置
|
||||
int underscoreIndex = fileName.lastIndexOf('_', dotIndex - 1);
|
||||
// 截取文件名部分(不包含后缀和多余部分)
|
||||
String namePart = fileName.substring(0, underscoreIndex);
|
||||
// 截取后缀部分
|
||||
String suffix = fileName.substring(dotIndex);
|
||||
// 拼接最终的文件名
|
||||
String extractedFileName = namePart + suffix;
|
||||
details.setDocName(extractedFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
return archivesMapper.selectDetailsList(archivesDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -341,22 +316,6 @@ public class ArchivesServiceImpl implements ArchivesService {
|
|||
for (FileInfo fileInfo : fileInfos) {
|
||||
String fileUrl = fileInfo.getFilePath();
|
||||
String originalPath = fileInfo.getFileName();
|
||||
if (fileInfo.getUpdateBy() == null) {
|
||||
// 找到最后一个 '/' 字符的位置
|
||||
int lastSlashIndex = originalPath.lastIndexOf('/');
|
||||
// 从最后一个 '/' 字符之后提取文件名
|
||||
String fileName = originalPath.substring(lastSlashIndex + 1);
|
||||
// 找到 '.png' 的位置
|
||||
int dotIndex = fileName.lastIndexOf('.');
|
||||
// 找到倒数第二个 '_' 的位置
|
||||
int underscoreIndex = fileName.lastIndexOf('_', dotIndex - 1);
|
||||
// 截取文件名部分(不包含后缀和多余部分)
|
||||
String namePart = fileName.substring(0, underscoreIndex);
|
||||
// 截取后缀部分
|
||||
String suffix = fileName.substring(dotIndex);
|
||||
// 拼接最终的文件名
|
||||
originalPath = namePart + suffix;
|
||||
}
|
||||
if (!isValidFileExtension(originalPath)) {
|
||||
// 可以根据业务需求添加默认文件类型或进行其他处理
|
||||
if (originalPath.lastIndexOf('.') == -1) {
|
||||
|
|
@ -419,7 +378,7 @@ public class ArchivesServiceImpl implements ArchivesService {
|
|||
*/
|
||||
private boolean isValidFileExtension(String originalPath) {
|
||||
// 定义一个正则表达式,匹配常见的文件扩展名
|
||||
String regex = ".*\\.(png|pdf|jpg|jpeg|txt|docx|xlsx|xls|ppt|pptx|zip)$";
|
||||
String regex = ".*\\.(bmp|gif|jpg|jpeg|png|svg|doc|docx|xls|xlsx|csv|ppt|pptx|html|htm|txt|rar|zip|gz|bz2|mp4|avi|rmvb|pdf)$";
|
||||
return Pattern.matches(regex, originalPath);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.bonus.common.core.utils.poi.ExcelUtil;
|
|||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.basic.domain.*;
|
||||
import com.bonus.material.basic.domain.vo.MaTypeSelectInfo;
|
||||
import com.bonus.material.basic.service.ComplexQueryService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -398,4 +399,31 @@ public class ComplexQueryController extends BaseController {
|
|||
util.exportExcel(response, list, "综合查询--机具出库查询");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修试查询--一机一档案查询
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修试查询--一机一档案查询")
|
||||
@GetMapping("/getMaTypeSelectList")
|
||||
public AjaxResult getMaTypeSelectList(MaTypeSelectInfo bean) {
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||
List<MaTypeSelectInfo> list = complexQueryService.getMaTypeSelectList(bean);
|
||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出修试查询--一机一档案查询
|
||||
* @param response
|
||||
* @param bean
|
||||
*/
|
||||
@ApiOperation("导出一机一档案查询")
|
||||
@PostMapping("/exportMaTypeSelectList")
|
||||
public void exportMaTypeSelectList(HttpServletResponse response, MaTypeSelectInfo bean)
|
||||
{
|
||||
List<MaTypeSelectInfo> list = complexQueryService.getMaTypeSelectList(bean);
|
||||
ExcelUtil<MaTypeSelectInfo> util = new ExcelUtil<>(MaTypeSelectInfo.class);
|
||||
util.exportExcel(response, list, "修试查询--导出一机一档案查询");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,96 @@
|
|||
package com.bonus.material.basic.domain.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 修试查询-一机一档案查询
|
||||
* @Author ma_sh
|
||||
* @create 2025/4/2 10:22
|
||||
*/
|
||||
@Data
|
||||
public class MaTypeSelectInfo {
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "协议号")
|
||||
@Excel(name = "协议号")
|
||||
private String agreementCode;
|
||||
|
||||
@ApiModelProperty(value = "单位id")
|
||||
private Long unitId;
|
||||
|
||||
@ApiModelProperty(value = "单位名称")
|
||||
@Excel(name = "单位名称")
|
||||
private String bmUnitName;
|
||||
|
||||
@ApiModelProperty(value="工程id")
|
||||
private Long proId;
|
||||
|
||||
@ApiModelProperty(value="工程名称")
|
||||
@Excel(name = "工程名称")
|
||||
private String bmProName;
|
||||
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
@Excel(name = "类型名称")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String typeModelName;
|
||||
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value = "设备编码")
|
||||
@Excel(name = "设备编码")
|
||||
private String maCode;
|
||||
|
||||
@ApiModelProperty(value = "单号")
|
||||
@Excel(name = "单号")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "操作人")
|
||||
@Excel(name = "操作人")
|
||||
private String createBy;
|
||||
|
||||
@ApiModelProperty(value = "操作日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "操作日期", dateFormat = "yyyy-MM-dd", width = 20)
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "操作类型")
|
||||
@Excel(name = "操作类型")
|
||||
private String operationType;
|
||||
|
||||
@ApiModelProperty(value = "操作信息")
|
||||
@Excel(name = "操作信息")
|
||||
private String operationInfo;
|
||||
|
||||
@ApiModelProperty(value="开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value="结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value="关键字")
|
||||
private String keyWord;
|
||||
|
||||
@ApiModelProperty(value="任务类型")
|
||||
private int taskType;
|
||||
|
||||
@ApiModelProperty(value="任务id")
|
||||
private Long taskId;
|
||||
|
||||
@ApiModelProperty(value="类型id")
|
||||
private Long typeId;
|
||||
|
||||
@ApiModelProperty(value="机具id")
|
||||
private Long maId;
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.material.basic.mapper;
|
||||
|
||||
import com.bonus.material.basic.domain.*;
|
||||
import com.bonus.material.basic.domain.vo.MaTypeSelectInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -123,4 +124,25 @@ public interface ComplexQueryMapper {
|
|||
* @return
|
||||
*/
|
||||
List<ScrapAuditInfo> getScrapAuditList(ScrapAuditInfo bean);
|
||||
|
||||
/**
|
||||
* 修试查询--一机一档案查询
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaTypeSelectInfo> getMaTypeSelectList(MaTypeSelectInfo bean);
|
||||
|
||||
/**
|
||||
* 根据id查询单位、工程及协议信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
MaTypeSelectInfo selectUnitAndProAndAgreementInfo(MaTypeSelectInfo dto);
|
||||
|
||||
/**
|
||||
* 查询收费配件信息
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
String getPartInfoList(MaTypeSelectInfo dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.material.basic.service;
|
||||
|
||||
import com.bonus.material.basic.domain.*;
|
||||
import com.bonus.material.basic.domain.vo.MaTypeSelectInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -101,4 +102,11 @@ public interface ComplexQueryService {
|
|||
* @return
|
||||
*/
|
||||
List<ScrapAuditInfo> getScrapAuditList(ScrapAuditInfo bean);
|
||||
|
||||
/**
|
||||
* 修试查询--一机一档案查询
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaTypeSelectInfo> getMaTypeSelectList(MaTypeSelectInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.alibaba.nacos.common.utils.CollectionUtils;
|
|||
import com.alibaba.nacos.common.utils.StringUtils;
|
||||
import com.bonus.common.biz.enums.MaTypeManageTypeEnum;
|
||||
import com.bonus.material.basic.domain.*;
|
||||
import com.bonus.material.basic.domain.vo.MaTypeSelectInfo;
|
||||
import com.bonus.material.basic.mapper.ComplexQueryMapper;
|
||||
import com.bonus.material.basic.service.ComplexQueryService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -503,4 +504,69 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
|
|||
return complexQueryMapper.getScrapAuditList(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修试查询--一机一档案查询
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MaTypeSelectInfo> getMaTypeSelectList(MaTypeSelectInfo bean) {
|
||||
List<MaTypeSelectInfo> recordList = complexQueryMapper.getMaTypeSelectList(bean);
|
||||
List<MaTypeSelectInfo> list = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(recordList)) {
|
||||
for (MaTypeSelectInfo dto : recordList) {
|
||||
if (StringUtils.isNotBlank(dto.getMaCode())) {
|
||||
String[] split = dto.getMaCode().split(",");
|
||||
if (split.length > 1) {
|
||||
for (String code : split) {
|
||||
MaTypeSelectInfo newRecord = new MaTypeSelectInfo();
|
||||
BeanUtils.copyProperties(dto, newRecord);
|
||||
newRecord.setMaCode(code);
|
||||
list.add(newRecord);
|
||||
}
|
||||
} else {
|
||||
list.add(dto);
|
||||
}
|
||||
} else {
|
||||
list.add(dto);
|
||||
}
|
||||
// 领用申请
|
||||
if (dto.getTaskType() == 19) {
|
||||
// 根据id查询单位、工程及协议信息
|
||||
MaTypeSelectInfo vo = complexQueryMapper.selectUnitAndProAndAgreementInfo(dto);
|
||||
if (vo != null) {
|
||||
dto.setAgreementCode(StringUtils.isNotBlank(vo.getAgreementCode()) ? vo.getAgreementCode() : "");
|
||||
dto.setBmUnitName(StringUtils.isNotBlank(vo.getBmUnitName()) ? vo.getBmUnitName() : "");
|
||||
dto.setBmProName(StringUtils.isNotBlank(vo.getBmProName()) ? vo.getBmProName() : "");
|
||||
}
|
||||
}
|
||||
// 查询收费配件信息
|
||||
if (dto.getTaskType() == 4) {
|
||||
String result = complexQueryMapper.getPartInfoList(dto);
|
||||
if (StringUtils.isNotBlank(result)) {
|
||||
dto.setOperationInfo(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 根据关键字搜索查询
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
if (StringUtils.isNotBlank(bean.getKeyWord())) {
|
||||
String keyWord = bean.getKeyWord();
|
||||
return list.stream().filter(item -> {
|
||||
return (StringUtils.isNotBlank(item.getMaCode()) && item.getMaCode().contains(keyWord)) ||
|
||||
(StringUtils.isNotBlank(item.getTypeName()) && item.getTypeName().contains(keyWord)) ||
|
||||
(StringUtils.isNotBlank(item.getTypeModelName()) && item.getTypeModelName().contains(keyWord)) ||
|
||||
(StringUtils.isNotBlank(item.getAgreementCode()) && item.getAgreementCode().contains(keyWord)) ||
|
||||
(StringUtils.isNotBlank(item.getBmUnitName()) && item.getBmUnitName().contains(keyWord)) ||
|
||||
(StringUtils.isNotBlank(item.getBmProName()) && item.getBmProName().contains(keyWord)) ||
|
||||
(StringUtils.isNotBlank(item.getCode()) && item.getCode().contains(keyWord)) ||
|
||||
(StringUtils.isNotBlank(item.getCreateBy()) && item.getCreateBy().contains(keyWord)) ||
|
||||
(StringUtils.isNotBlank(item.getOperationInfo()) && item.getOperationInfo().contains(keyWord)) ||
|
||||
(StringUtils.isNotBlank(item.getOperationType()) && item.getOperationType().contains(keyWord));
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN tm_task tt ON bs.task_id = tt.task_id
|
||||
WHERE bs.in_num != 0 and bs.result_msg = '操作成功'
|
||||
WHERE bs.in_num != 0 and (bs.result_msg = '操作成功' OR bs.result_msg = '入库成功')
|
||||
<if test="inputType != null and inputType != ''">
|
||||
and (
|
||||
CASE
|
||||
|
|
@ -894,5 +894,277 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
GROUP BY mm.ma_code ,mt.type_id
|
||||
</select>
|
||||
<select id="getMaTypeSelectList" resultType="com.bonus.material.basic.domain.vo.MaTypeSelectInfo">
|
||||
(
|
||||
SELECT
|
||||
bagi.agreement_code AS agreementCode,
|
||||
bu.unit_name AS bmUnitName,
|
||||
bp.pro_name AS bmProName,
|
||||
mt2.type_name AS typeName,
|
||||
mt1.type_name AS typeModelName,
|
||||
mm.ma_code AS maCode,
|
||||
mt1.unit_name AS unitName,
|
||||
tt.`code` AS code,
|
||||
bcd.create_by AS createBy,
|
||||
bcd.create_time AS createTime,
|
||||
'退料' AS operationType,
|
||||
bcd.parent_id AS id,
|
||||
tt.task_type AS taskType,
|
||||
a.task_id AS taskId,
|
||||
bcd.type_id AS typeId,
|
||||
bcd.ma_id AS maId
|
||||
FROM
|
||||
back_check_details bcd
|
||||
LEFT JOIN ( SELECT id, task_id FROM back_apply_info GROUP BY id ) a ON bcd.parent_id = a.id
|
||||
LEFT JOIN tm_task tt ON tt.task_id = a.task_id
|
||||
LEFT JOIN tm_task_agreement tta ON tta.task_id = tt.task_id
|
||||
LEFT JOIN bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
|
||||
AND bagi.`status` = '1'
|
||||
LEFT JOIN bm_project bp ON bp.pro_id = bagi.project_id
|
||||
AND bp.del_flag = '0'
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = bagi.unit_id
|
||||
AND bu.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt1.type_id = bcd.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
|
||||
AND mt2.del_flag = '0'
|
||||
LEFT JOIN ma_machine mm ON bcd.ma_id = mm.ma_id
|
||||
WHERE 1 = 1
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and DATE_FORMAT( bcd.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
<if test="unitId != null">
|
||||
and bu.unit_id = #{unitId}
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
and bp.pro_id = #{proId}
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and mt2.type_name like concat('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="typeModelName != null and typeModelName != ''">
|
||||
and mt1.type_name like concat('%',#{typeModelName},'%')
|
||||
</if>
|
||||
)
|
||||
UNION ALL
|
||||
(
|
||||
SELECT
|
||||
bagi.agreement_code AS agreementCode,
|
||||
bu.unit_name AS bmUnitName,
|
||||
bp.pro_name AS bmProName,
|
||||
mt2.type_name AS typeName,
|
||||
mt1.type_name AS typeModelName,
|
||||
mm.ma_code AS maCode,
|
||||
mt1.unit_name AS unitName,
|
||||
tt.`code` AS code,
|
||||
su.nick_name AS createBy,
|
||||
rad.create_time AS createTime,
|
||||
'维修' AS operationType,
|
||||
rad.repair_id AS id,
|
||||
tt.task_type AS taskType,
|
||||
a.task_id AS taskId,
|
||||
a.type_id AS typeId,
|
||||
a.ma_id AS maId
|
||||
FROM
|
||||
repair_audit_details rad
|
||||
LEFT JOIN ( SELECT id, task_id, type_id, ma_id FROM repair_apply_details GROUP BY id ) a ON rad.repair_id = a.id
|
||||
LEFT JOIN tm_task tt ON tt.task_id = a.task_id
|
||||
LEFT JOIN tm_task_agreement tta ON tta.task_id = tt.task_id
|
||||
LEFT JOIN bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
|
||||
AND bagi.`status` = '1'
|
||||
LEFT JOIN bm_project bp ON bp.pro_id = bagi.project_id
|
||||
AND bp.del_flag = '0'
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = bagi.unit_id
|
||||
AND bu.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt1.type_id = rad.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
|
||||
AND mt2.del_flag = '0'
|
||||
LEFT JOIN ma_machine mm ON rad.ma_id = mm.ma_id
|
||||
LEFT JOIN sys_user su ON rad.create_by = su.user_id
|
||||
WHERE
|
||||
rad.`status` = '1'
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and DATE_FORMAT( rad.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
<if test="unitId != null">
|
||||
and bu.unit_id = #{unitId}
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
and bp.pro_id = #{proId}
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and mt2.type_name like concat('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="typeModelName != null and typeModelName != ''">
|
||||
and mt1.type_name like concat('%',#{typeModelName},'%')
|
||||
</if>
|
||||
)
|
||||
UNION ALL
|
||||
(
|
||||
SELECT
|
||||
bagi.agreement_code AS agreementCode,
|
||||
bu.unit_name AS bmUnitName,
|
||||
bp.pro_name AS bmProName,
|
||||
mt1.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
bs.ma_code AS maCode,
|
||||
mt.unit_name AS unitName,
|
||||
tt.`code` AS code,
|
||||
bs.creator AS createBy,
|
||||
bs.create_time AS createTime,
|
||||
'新购入库' AS operationType,
|
||||
bs.id AS id,
|
||||
tt.task_type AS taskType,
|
||||
bs.task_id AS taskId,
|
||||
bs.type_id AS typeId,
|
||||
NULL AS maId
|
||||
FROM
|
||||
bm_storage_log bs
|
||||
LEFT JOIN ma_type mt ON bs.type_id = mt.type_id
|
||||
AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN tm_task tt ON bs.task_id = tt.task_id
|
||||
LEFT JOIN tm_task_agreement tta ON tta.task_id = tt.task_id
|
||||
LEFT JOIN bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
|
||||
AND bagi.`status` = '1'
|
||||
LEFT JOIN bm_project bp ON bp.pro_id = bagi.project_id
|
||||
AND bp.del_flag = '0'
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = bagi.unit_id
|
||||
AND bu.del_flag = '0'
|
||||
WHERE
|
||||
bs.in_num != 0 AND bs.result_msg = '入库成功'
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and DATE_FORMAT( bs.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
<if test="unitId != null">
|
||||
and bu.unit_id = #{unitId}
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
and bp.pro_id = #{proId}
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and mt1.type_name like concat('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="typeModelName != null and typeModelName != ''">
|
||||
and mt.type_name like concat('%',#{typeModelName},'%')
|
||||
</if>
|
||||
)
|
||||
UNION ALL
|
||||
(
|
||||
SELECT
|
||||
bagi.agreement_code AS agreementCode,
|
||||
bu.unit_name AS bmUnitName,
|
||||
bp.pro_name AS bmProName,
|
||||
mt2.type_name AS typeName,
|
||||
mt1.type_name AS typeModelName,
|
||||
mm.ma_code AS maCode,
|
||||
mt1.unit_name AS unitName,
|
||||
tt.`code` AS code,
|
||||
lod.create_by AS createBy,
|
||||
lod.create_time AS createTime,
|
||||
'领料' AS operationType,
|
||||
lod.parent_id AS id,
|
||||
tt.task_type AS taskType,
|
||||
a.task_id AS taskId,
|
||||
lod.type_id AS typeId,
|
||||
lod.ma_id AS maId
|
||||
FROM
|
||||
lease_out_details lod
|
||||
LEFT JOIN ( SELECT id, task_id FROM lease_apply_info GROUP BY id ) a ON lod.parent_id = a.id
|
||||
LEFT JOIN tm_task tt ON tt.task_id = a.task_id
|
||||
LEFT JOIN tm_task_agreement tta ON tta.task_id = tt.task_id
|
||||
LEFT JOIN bm_agreement_info bagi ON bagi.agreement_id = tta.agreement_id
|
||||
AND bagi.`status` = '1'
|
||||
LEFT JOIN bm_project bp ON bp.pro_id = bagi.project_id
|
||||
AND bp.del_flag = '0'
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = bagi.unit_id
|
||||
AND bu.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt1.type_id = lod.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id
|
||||
AND mt2.del_flag = '0'
|
||||
LEFT JOIN ma_machine mm ON lod.ma_id = mm.ma_id
|
||||
where 1 = 1
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and DATE_FORMAT( lod.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
<if test="unitId != null">
|
||||
and bu.unit_id = #{unitId}
|
||||
</if>
|
||||
<if test="proId != null">
|
||||
and bp.pro_id = #{proId}
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and mt2.type_name like concat('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="typeModelName != null and typeModelName != ''">
|
||||
and mt1.type_name like concat('%',#{typeModelName},'%')
|
||||
</if>
|
||||
)
|
||||
ORDER BY createTime DESC
|
||||
</select>
|
||||
|
||||
<select id="selectUnitAndProAndAgreementInfo"
|
||||
resultType="com.bonus.material.basic.domain.vo.MaTypeSelectInfo">
|
||||
SELECT
|
||||
bagi.agreement_code AS agreementCode,
|
||||
bu.unit_name AS bmUnitName,
|
||||
bp.pro_name AS bmProName
|
||||
FROM
|
||||
lease_apply_info lai
|
||||
LEFT JOIN bm_agreement_info bagi ON bagi.unit_id = lai.unit_id
|
||||
AND bagi.project_id = lai.project_id
|
||||
AND bagi.`status` = '1'
|
||||
LEFT JOIN bm_unit bu ON lai.unit_id = bu.unit_id
|
||||
LEFT JOIN bm_project bp ON bp.pro_id = lai.project_id
|
||||
WHERE
|
||||
lai.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getPartInfoList" resultType="java.lang.String">
|
||||
SELECT
|
||||
CONCAT(GROUP_CONCAT(
|
||||
DISTINCT
|
||||
CASE
|
||||
WHEN rar.part_name IS NOT NULL
|
||||
OR rar.part_id IS NOT NULL THEN
|
||||
CONCAT_WS(
|
||||
',',
|
||||
rar.part_name,
|
||||
CASE
|
||||
WHEN rar.part_id IS NOT NULL THEN
|
||||
concat( mpt1.pa_name, '-', mpt.pa_name )
|
||||
END
|
||||
) ELSE NULL
|
||||
END
|
||||
), ',',SUM(
|
||||
CASE
|
||||
WHEN rar.part_type = 1
|
||||
AND rar.part_id IS NOT NULL THEN
|
||||
rar.part_num * rar.part_price
|
||||
WHEN rar.part_type = 1
|
||||
AND rar.part_id IS NULL THEN
|
||||
rar.part_price ELSE 0
|
||||
END
|
||||
), ',','收费')
|
||||
FROM
|
||||
repair_apply_record rar
|
||||
LEFT JOIN ma_part_type mpt ON rar.part_id = mpt.pa_id
|
||||
AND mpt.del_flag = '0'
|
||||
LEFT JOIN ma_part_type mpt1 ON mpt.parent_id = mpt1.pa_id
|
||||
AND mpt1.del_flag = '0'
|
||||
WHERE
|
||||
rar.`status` = '1'
|
||||
AND rar.part_type = '1'
|
||||
AND rar.task_id = #{taskId}
|
||||
<if test="typeId != null">
|
||||
AND rar.type_id = #{typeId}
|
||||
</if>
|
||||
<if test="maId != null">
|
||||
AND rar.ma_id = #{maId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue