报表模块放在common
parent
66374d071e
commit
859ddefaf4
@ -0,0 +1,41 @@
|
||||
package com.foreverwin.mesnac.common.controller;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author zhaojiawei
|
||||
* @Since 2021-08-23
|
||||
*/
|
||||
|
||||
import com.foreverwin.mesnac.common.service.ReportDataService;
|
||||
import com.foreverwin.modular.core.util.CommonMethods;
|
||||
import com.foreverwin.modular.core.util.R;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/REPORT-DATA")
|
||||
public class ReportDataController {
|
||||
|
||||
@Autowired
|
||||
public ReportDataService reportDataService;
|
||||
|
||||
/**
|
||||
* 查询质量检验任务
|
||||
*
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/findInspectionTask")
|
||||
public R findInspectionTask(@RequestParam(required = false) Map paramMap) {
|
||||
try {
|
||||
paramMap.put("site", CommonMethods.getSite());
|
||||
List<Map<String, Object>> result = reportDataService.findInspectionTask(paramMap);
|
||||
return R.ok(result);
|
||||
} catch (Exception e) {
|
||||
return R.failed(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.foreverwin.mesnac.common.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Repository
|
||||
public interface ReportDataMapper {
|
||||
List<Map<String, Object>> findInspectionTask(Map paramMap);
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.foreverwin.mesnac.common.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ReportDataService {
|
||||
/**
|
||||
* 查询质量检验任务
|
||||
*
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> findInspectionTask(Map paramMap);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.foreverwin.mesnac.common.service.impl;
|
||||
|
||||
import com.foreverwin.mesnac.common.mapper.ReportDataMapper;
|
||||
import com.foreverwin.mesnac.common.service.ReportDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ReportDataServiceImpl implements ReportDataService{
|
||||
|
||||
@Autowired
|
||||
private ReportDataMapper reportDataMapper;
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> findInspectionTask(Map paramMap) {
|
||||
return reportDataMapper.findInspectionTask(paramMap);
|
||||
}
|
||||
}
|
@ -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.foreverwin.mesnac.common.mapper.ReportDataMapper">
|
||||
|
||||
<select id="findInspectionTask" resultType="java.util.HashMap" parameterType="java.util.HashMap">
|
||||
SELECT WT.DESCRIPTION WORK_CENTER_DESCRIPTION, C2.VALUE ITEM_NUMBER, C3.VALUE PRODUCT_MODEL,IM.ITEM ITEM, IT.DESCRIPTION ITEM_DESCRIPTION,
|
||||
ZT.SFC, ZT.OPERATION, OT.DESCRIPTION OPERATION_DESCRIPTION, ZT.RESRCE, RS.DESCRIPTION RESOURCE_DESCRIPTION, ZT.TASK_NO, ZT.CATEGORY,
|
||||
ZT."RESULT", ZT.CREATE_USER, ZNU.FULL_NAME, ZT.MODIFIED_DATE_TIME
|
||||
FROM Z_INSPECTION_TASK ZT
|
||||
LEFT JOIN WORK_CENTER WC ON WC.SITE = ZT.SITE AND WC.WORK_CENTER = ZT.WORK_CENTER
|
||||
LEFT JOIN WORK_CENTER_T WT ON WT.WORK_CENTER_BO = WC.HANDLE AND WT.LOCALE = 'zh'
|
||||
INNER JOIN SHOP_ORDER SO ON ZT.SITE = SO.SITE AND ZT.SHOP_ORDER = SO.SHOP_ORDER
|
||||
LEFT JOIN CUSTOM_FIELDS C1 ON C1.HANDLE = SO.HANDLE AND C1."ATTRIBUTE" = 'WORK_ORDER'
|
||||
LEFT JOIN CUSTOM_FIELDS C2 ON C2.HANDLE = SO.HANDLE AND C2."ATTRIBUTE" = 'ITEM_NUMBER'
|
||||
LEFT JOIN CUSTOM_FIELDS C3 ON C3.HANDLE = SO.HANDLE AND C3."ATTRIBUTE" = 'PRODUCT_MODEL'
|
||||
INNER JOIN ITEM IM ON IM.HANDLE = SO.ITEM_BO
|
||||
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = IM.HANDLE AND IT.LOCALE = 'zh'
|
||||
INNER JOIN OPERATION OP ON OP.SITE = ZT.SITE AND OP.OPERATION = ZT.OPERATION AND OP.CURRENT_REVISION = 'true'
|
||||
LEFT JOIN OPERATION_T OT ON OT.OPERATION_BO = OP.HANDLE AND OT.LOCALE = 'zh'
|
||||
INNER JOIN RESRCE RS ON RS.SITE = ZT.SITE AND RS.RESRCE = ZT.RESRCE
|
||||
LEFT JOIN Z_NWA_USER ZNU ON ZNU.SITE = ZT.SITE AND ZNU.USER_NAME = ZT.CREATE_USER
|
||||
WHERE ZT.SITE = #{site}
|
||||
<if test="workCenter != null and workCenter != ''" >
|
||||
AND WC.WORK_CENTER = #{workCenter}
|
||||
</if>
|
||||
<if test="category != null and category != ''" >
|
||||
AND ZT.CATEGORY = #{category}
|
||||
</if>
|
||||
<if test="itemNumber != null and itemNumber != ''" >
|
||||
AND C2.VALUE LIKE '%'||#{itemNumber}||'%'
|
||||
</if>
|
||||
<if test="model != null and model != ''" >
|
||||
AND C3.VALUE LIKE '%'||#{model}||'%'
|
||||
</if>
|
||||
<if test="operation != null and operation != ''" >
|
||||
AND ZT.OPERATION = #{operation}
|
||||
</if>
|
||||
<if test="resrce != null and resrce != ''" >
|
||||
AND ZT.RESRCE = #{resrce}
|
||||
</if>
|
||||
<if test="result != null and result != ''" >
|
||||
AND ZT.RESULT = #{result}
|
||||
</if>
|
||||
<if test="startFromDate != null and startFromDate != ''" >
|
||||
AND ZT.MODIFIED_DATE_TIME >= TO_DATE(#{startFromDate}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="startToDate != null and startToDate != ''" >
|
||||
AND ZT.MODIFIED_DATE_TIME <= TO_DATE(#{startToDate}|| '23:59:59', 'YYYY-MM-DD HH24:MI:SS')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue