维修管理--修饰审核 SQL及业务逻辑优化
This commit is contained in:
parent
db2aab3acc
commit
295d9e657b
|
|
@ -77,9 +77,9 @@ public class RepairController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取维修任务物资设备列表
|
* 获取维修任务物资设备列表--不分页
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取维修物资设备列表")
|
@ApiOperation(value = "获取维修物资设备列表---分页")
|
||||||
@GetMapping("/getRepairMaTypeList")
|
@GetMapping("/getRepairMaTypeList")
|
||||||
@RequiresPermissions("repair:manage:preview")
|
@RequiresPermissions("repair:manage:preview")
|
||||||
public TableDataInfo getRepairMaTypeList(RepairTaskDetails bean) {
|
public TableDataInfo getRepairMaTypeList(RepairTaskDetails bean) {
|
||||||
|
|
@ -91,7 +91,7 @@ public class RepairController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 获取维修任务机具列表
|
* 获取维修任务机具列表
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取维修任务机具列表")
|
@ApiOperation(value = "获取维修物资设备列表---不分页")
|
||||||
@GetMapping("/getAppRepairMaTypeList")
|
@GetMapping("/getAppRepairMaTypeList")
|
||||||
public AjaxResult getAppRepairMaTypeList(RepairTaskDetails bean) {
|
public AjaxResult getAppRepairMaTypeList(RepairTaskDetails bean) {
|
||||||
List<RepairTaskDetails> list = service.getRepairMaTypeList(bean);
|
List<RepairTaskDetails> list = service.getRepairMaTypeList(bean);
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,12 @@ public class RepairAuditDetails extends BaseEntity {
|
||||||
@ApiModelProperty(value = "规格ID")
|
@ApiModelProperty(value = "规格ID")
|
||||||
private Long typeId;
|
private Long typeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规格型号")
|
||||||
|
private String specificationType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "机具类型名称")
|
||||||
|
private String machineTypeName;
|
||||||
|
|
||||||
/** 维修总量 */
|
/** 维修总量 */
|
||||||
@Excel(name = "维修总量")
|
@Excel(name = "维修总量")
|
||||||
@ApiModelProperty(value = "维修总量")
|
@ApiModelProperty(value = "维修总量")
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.bonus.material.repair.domain.RepairRecord;
|
||||||
import com.bonus.material.repair.domain.RepairTaskDetails;
|
import com.bonus.material.repair.domain.RepairTaskDetails;
|
||||||
import com.bonus.material.repair.domain.vo.RepairAuditDetailsVO;
|
import com.bonus.material.repair.domain.vo.RepairAuditDetailsVO;
|
||||||
import com.bonus.material.repair.domain.vo.ScrapApplyDetailsVO;
|
import com.bonus.material.repair.domain.vo.ScrapApplyDetailsVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修试审核详细Mapper接口
|
* 修试审核详细Mapper接口
|
||||||
|
|
@ -88,7 +89,7 @@ public interface RepairAuditDetailsMapper {
|
||||||
* 根据taskIds批量查询规格名称---批量
|
* 根据taskIds批量查询规格名称---批量
|
||||||
* @param taskIds 任务id集合
|
* @param taskIds 任务id集合
|
||||||
*/
|
*/
|
||||||
Map<Long, String> selectTypeNamesByTaskIds(List<Long> taskIds);
|
Map<Long, String> selectTypeNamesByTaskIds(@Param("taskIds") List<Long> taskIds);
|
||||||
|
|
||||||
List<RepairAuditDetails> selectRepairAuditDetailsByTaskId(Long taskId);
|
List<RepairAuditDetails> selectRepairAuditDetailsByTaskId(Long taskId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,9 +103,9 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
List<ScrapApplyDetailsVO> repairQuestList = repairAuditDetailsMapper.selectRepairQuestList(repairAuditDetails);
|
List<ScrapApplyDetailsVO> repairQuestList = repairAuditDetailsMapper.selectRepairQuestList(repairAuditDetails);
|
||||||
// 通过流过滤掉空对象 并转换为 List集合
|
// 通过流过滤掉空对象 并转换为 List集合
|
||||||
List<Long> taskIds = repairQuestList.stream()
|
List<Long> taskIds = repairQuestList.stream()
|
||||||
.filter(Objects::nonNull) // 过滤掉空的 ScrapApplyDetailsVO 对象
|
.filter(Objects::nonNull)
|
||||||
.map(ScrapApplyDetailsVO::getTaskId)
|
.map(ScrapApplyDetailsVO::getTaskId)
|
||||||
.filter(Objects::nonNull) // 过滤掉空的 taskId
|
.filter(Objects::nonNull)
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
@ -113,6 +113,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
Map<Long, String> typeNameMap = repairAuditDetailsMapper.selectTypeNamesByTaskIds(taskIds);
|
Map<Long, String> typeNameMap = repairAuditDetailsMapper.selectTypeNamesByTaskIds(taskIds);
|
||||||
|
|
||||||
// 设置 itemType
|
// 设置 itemType
|
||||||
|
if (CollectionUtil.isNotEmpty(typeNameMap)) {
|
||||||
for (ScrapApplyDetailsVO scrapApplyDetailsVO : repairQuestList) {
|
for (ScrapApplyDetailsVO scrapApplyDetailsVO : repairQuestList) {
|
||||||
Long taskId = scrapApplyDetailsVO.getTaskId();
|
Long taskId = scrapApplyDetailsVO.getTaskId();
|
||||||
if (taskId != null) {
|
if (taskId != null) {
|
||||||
|
|
@ -122,7 +123,7 @@ public class RepairAuditDetailsServiceImpl implements IRepairAuditDetailsService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return repairQuestList;
|
return repairQuestList;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 异常处理
|
// 异常处理
|
||||||
|
|
|
||||||
|
|
@ -83,11 +83,10 @@
|
||||||
rd.task_id,
|
rd.task_id,
|
||||||
tt.CODE AS repairCode,
|
tt.CODE AS repairCode,
|
||||||
bui.unit_name AS backUnit,
|
bui.unit_name AS backUnit,
|
||||||
bpi.lot_name AS backPro,
|
bpi.pro_name AS backPro,
|
||||||
su.nick_name AS createName,
|
su.nick_name AS createName,
|
||||||
tt.create_time AS createTime,
|
tt.create_time AS createTime,
|
||||||
bai.CODE AS backCode,
|
bai.CODE AS backCode,
|
||||||
sd.name AS repairStatus,
|
|
||||||
tt.task_status AS repairStatusCode,
|
tt.task_status AS repairStatusCode,
|
||||||
tt.company_id AS companyId,
|
tt.company_id AS companyId,
|
||||||
GROUP_CONCAT(DISTINCT mt2.type_name) as type
|
GROUP_CONCAT(DISTINCT mt2.type_name) as type
|
||||||
|
|
@ -97,13 +96,12 @@
|
||||||
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 tm_task tt on rd.task_id = tt.task_id
|
LEFT JOIN tm_task tt on rd.task_id = tt.task_id
|
||||||
LEFT JOIN back_apply_info bai ON rd.back_id = bai.id
|
LEFT JOIN back_apply_info bai ON rd.back_id = bai.id
|
||||||
LEFT JOIN tm_task_agreement tta ON bai.task_id = tta.task_id
|
LEFT JOIN tm_task_agreement tta ON rd.task_id = tta.task_id
|
||||||
LEFT JOIN bm_agreement_info bai2 ON tta.agreement_id = bai2.agreement_id
|
LEFT JOIN bm_agreement_info bai2 ON tta.agreement_id = bai2.agreement_id
|
||||||
LEFT JOIN bm_unit_info bui ON bai2.unit_id = bui.unit_id
|
LEFT JOIN bm_unit bui ON bai2.unit_id = bui.unit_id
|
||||||
LEFT JOIN bm_project_lot bpi ON bai2.project_id = bpi.lot_id and bpi.status = '0' and bpi.del_flag = '0'
|
LEFT JOIN bm_project bpi ON bai2.project_id = bpi.pro_id and bpi.del_flag = '0'
|
||||||
left join sys_user su on rd.create_by = su.user_id
|
left join sys_user su on rd.create_by = su.user_id
|
||||||
left join sys_dic sd on sd.id = tt.task_status
|
<where>
|
||||||
where 1=1
|
|
||||||
<if test="keyword != null and keyword != ''">
|
<if test="keyword != null and keyword != ''">
|
||||||
AND (locate(#{keyword}, su.nick_name) > 0
|
AND (locate(#{keyword}, su.nick_name) > 0
|
||||||
or locate(#{keyword}, tt.CODE) > 0)
|
or locate(#{keyword}, tt.CODE) > 0)
|
||||||
|
|
@ -112,7 +110,7 @@
|
||||||
AND bui.unit_id = #{backUnit}
|
AND bui.unit_id = #{backUnit}
|
||||||
</if>
|
</if>
|
||||||
<if test="backPro != null and backPro != ''">
|
<if test="backPro != null and backPro != ''">
|
||||||
AND bpi.lot_id = #{backPro}
|
AND bpi.pro_id = #{backPro}
|
||||||
</if>
|
</if>
|
||||||
<if test="type != null and type != ''">
|
<if test="type != null and type != ''">
|
||||||
AND mt2.type_id = #{type}
|
AND mt2.type_id = #{type}
|
||||||
|
|
@ -126,7 +124,8 @@
|
||||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||||
AND tt.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
AND tt.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||||
</if>
|
</if>
|
||||||
GROUP BY rd.task_id,bui.unit_name,bpi.lot_name,bai.code,su.nick_name
|
</where>
|
||||||
|
GROUP BY rd.task_id,bui.unit_name,bpi.pro_name,bai.code,su.nick_name
|
||||||
order by tt.create_time desc
|
order by tt.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
@ -139,7 +138,6 @@
|
||||||
su.nick_name AS createName,
|
su.nick_name AS createName,
|
||||||
tt.create_time AS createTime,
|
tt.create_time AS createTime,
|
||||||
bai.CODE AS backCode,
|
bai.CODE AS backCode,
|
||||||
sd.NAME AS repairStatus,
|
|
||||||
tt.task_status AS repairStatusCode,
|
tt.task_status AS repairStatusCode,
|
||||||
tt.company_id AS companyId,
|
tt.company_id AS companyId,
|
||||||
mt2.type_name AS type,
|
mt2.type_name AS type,
|
||||||
|
|
@ -157,13 +155,12 @@
|
||||||
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 tm_task tt ON rd.task_id = tt.task_id
|
LEFT JOIN tm_task tt ON rd.task_id = tt.task_id
|
||||||
LEFT JOIN back_apply_info bai ON rd.back_id = bai.id
|
LEFT JOIN back_apply_info bai ON rd.back_id = bai.id
|
||||||
LEFT JOIN tm_task_agreement tta ON bai.task_id = tta.task_id
|
LEFT JOIN tm_task_agreement tta ON rd.task_id = tta.task_id
|
||||||
LEFT JOIN bm_agreement_info bai2 ON tta.agreement_id = bai2.agreement_id
|
LEFT JOIN bm_agreement_info bai2 ON tta.agreement_id = bai2.agreement_id
|
||||||
LEFT JOIN bm_unit_info bui ON bai2.unit_id = bui.unit_id
|
LEFT JOIN bm_unit_info bui ON bai2.unit_id = bui.unit_id
|
||||||
LEFT JOIN bm_project_lot bpi ON bai2.project_id = bpi.lot_id AND bpi.STATUS = '0' AND bpi.del_flag = '0'
|
LEFT JOIN bm_project_lot bpi ON bai2.project_id = bpi.lot_id AND bpi.STATUS = '0' AND bpi.del_flag = '0'
|
||||||
LEFT JOIN sys_user su ON rd.create_by = su.user_id
|
LEFT JOIN sys_user su ON rd.create_by = su.user_id
|
||||||
left join sys_user su2 on rd.repairer = su2.user_id
|
left join sys_user su2 on rd.repairer = su2.user_id
|
||||||
LEFT JOIN sys_dic sd ON sd.id = tt.task_status
|
|
||||||
LEFT JOIN ma_machine mm ON mm.ma_id = rd.ma_id
|
LEFT JOIN ma_machine mm ON mm.ma_id = rd.ma_id
|
||||||
where 1=1
|
where 1=1
|
||||||
<if test="keyword != null and keyword != ''">
|
<if test="keyword != null and keyword != ''">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue