Browse Source

2026-07-30

RoHS和Lab:
增加【流程关闭】
master
fengyuan_yang 2 months ago
parent
commit
7d4ee61494
  1. 6
      src/main/java/com/spring/modules/lab/mapper/LabMapper.java
  2. 30
      src/main/java/com/spring/modules/lab/service/impl/LabServiceImpl.java
  3. 138
      src/main/resources/mapper/lab/LabMapper.xml

6
src/main/java/com/spring/modules/lab/mapper/LabMapper.java

@ -20,6 +20,12 @@ public interface LabMapper extends BaseMapper<LabEntity> {
IPage<LabEntity> queryPageWithNames(IPage<?> page, @Param("params") Map<String, Object> params);
long queryPageWithNamesCount(@Param("params") Map<String, Object> params);
List<LabEntity> queryPageWithNamesData(@Param("offset") long offset,
@Param("size") long size,
@Param("params") Map<String, Object> params);
IPage<LabEntity> queryPageWithNamesAny(IPage<?> page, @Param("params") Map<String, String> params);
LabEntity getDetailWithNames(@Param("site") String site, @Param("referenceNo") String referenceNo);

30
src/main/java/com/spring/modules/lab/service/impl/LabServiceImpl.java

@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.spring.common.utils.Constant;
import com.spring.common.utils.DateUtils;
import com.spring.common.utils.PageUtils;
import com.spring.common.utils.Query;
import com.spring.modules.base.data.OaUserData;
import com.spring.modules.base.data.PlmPropertiesItemAvailableData;
import com.spring.modules.base.utils.HttpClientUtil;
@ -107,15 +106,15 @@ public class LabServiceImpl extends ServiceImpl<LabMapper, LabEntity> implements
params.put("currentApprover", trimToNull((String) params.get("currentApprover")));
params.put("tester", trimToNull((String) params.get("tester")));
params.put("testerLike", buildTesterLikeParam((String) params.get("tester")));
// 主信息列表固定按序列号倒排避免被前端排序参数覆盖
params.put(Constant.ORDER_FIELD, "reference_no");
params.put(Constant.ORDER, "desc");
IPage<LabEntity> page = this.baseMapper.queryPageWithNames(
new Query<LabEntity>().getPage(params, "reference_no", false),
params
);
return new PageUtils(page);
long currPage = parseLong(params.get(Constant.PAGE), 1L);
long pageSize = parseLong(params.get(Constant.LIMIT), 10L);
long total = this.baseMapper.queryPageWithNamesCount(params);
long offset = pageSize > 0 ? Math.max(currPage - 1, 0L) * pageSize : 0L;
List<LabEntity> records = this.baseMapper.queryPageWithNamesData(offset, pageSize, params);
int resultPageSize = pageSize > 0
? (int) pageSize
: Math.max(records == null ? 0 : records.size(), 1);
return new PageUtils(records, (int) total, resultPageSize, (int) currPage);
}
@Override
@ -712,6 +711,17 @@ public class LabServiceImpl extends ServiceImpl<LabMapper, LabEntity> implements
return StringUtils.trimToEmpty(dictRows.get(0).getDictLabel());
}
private long parseLong(Object valueObj, long defaultValue) {
if (valueObj == null) {
return defaultValue;
}
try {
return Long.parseLong(String.valueOf(valueObj));
} catch (Exception e) {
return defaultValue;
}
}
private String trimToNull(String value) {
if (StringUtils.isBlank(value)) {
return null;

138
src/main/resources/mapper/lab/LabMapper.xml

@ -153,6 +153,144 @@
</if>
</select>
<select id="queryPageWithNamesCount" resultType="long">
select count(1)
from plm_lab a
left join plm_request_header prh on a.site = prh.site and prh.menu_id = #{params.menuId} and prh.status = 'Y'
left join plm_request_node d on a.site = d.site and prh.classification_no = d.classification_no and prh.workflow_id = d.workflow_id and a.step_id = d.step_id
outer apply (
select
stuff((
select ';' + vals.value
from (
select distinct isnull(pf.update_by, su.username) as value
from plm_process_form pf
left join sys_user su on pf.domain_control_account = su.domain_control_account
where pf.site = a.site
and pf.workflow_id = prh.workflow_id
and pf.node_id = d.node_id
and pf.document_no = a.reference_no
and pf.is_remark = '0'
) vals
for xml path(''), type
).value('.', 'nvarchar(max)'), 1, 1, '') as currentApprover
) approverData
where 1 = 1
<if test="params.site != null and params.site != ''">
and a.site = #{params.site}
</if>
<if test="params.referenceNo != null and params.referenceNo != ''">
and a.reference_no like #{params.referenceNo}
</if>
<if test="params.status != null and params.status != ''">
and a.status = #{params.status}
</if>
<if test="params.nodeId != null and params.nodeId != ''">
and d.node_id = #{params.nodeId}
</if>
<if test="params.currentApprover != null and params.currentApprover != ''">
and isnull(approverData.currentApprover, '') like #{params.currentApprover}
</if>
<if test="params.applicant != null and params.applicant != ''">
and a.applicant like #{params.applicant}
</if>
<if test="params.testerLike != null and params.testerLike != ''">
and (';' + isnull(replace(a.tester, ',', ';'), '') + ';') like ('%;' + #{params.testerLike} + ';%')
</if>
</select>
<select id="queryPageWithNamesData" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>,
d.node_id as nodeId,
d.node_name as nodeName,
isnull(approverData.currentApprover, '') as currentApprover,
isnull(approverData.currentApprover, '') as createBy2,
isnull(d.is_reject, 'N') as isReject,
isnull(customerData.customerName, '') as customerName,
isnull(projectData.projectName, '') as projectName,
isnull(testerData.testerName, '') as testerName,
isnull(labApproverData.labApproverName, '') as labApproverName,
case
when isnull(testLabData.testLabName, '') = '' then isnull(a.test_lab, '')
else testLabData.testLabName
end as testLabName
from plm_lab a
left join plm_request_header prh on a.site = prh.site and prh.menu_id = #{params.menuId} and prh.status = 'Y'
left join plm_request_node d on a.site = d.site and prh.classification_no = d.classification_no and prh.workflow_id = d.workflow_id and a.step_id = d.step_id
outer apply (
select top 1 customer_desc as customerName
from plm_customer_information pci
where pci.customer_no = a.customer_id
) customerData
outer apply (
select top 1 project_name as projectName
from plm_project_info ppi
where ppi.site = a.site
and ppi.project_id = a.project_id
) projectData
outer apply (
select top 1 user_display as testerName
from sys_user su
where su.username = a.tester
) testerData
outer apply (
select top 1 user_display as labApproverName
from sys_user su
where su.username = a.lab_approver
) labApproverData
outer apply (
select top 1 dict_label as testLabName
from sys_dict_data sdd
where sdd.dict_type = 'lab_test_lab'
and sdd.site = '41'
and sdd.dict_value = a.test_lab
) testLabData
outer apply (
select
stuff((
select ';' + vals.value
from (
select distinct isnull(pf.update_by, su.username) as value
from plm_process_form pf
left join sys_user su on pf.domain_control_account = su.domain_control_account
where pf.site = a.site
and pf.workflow_id = prh.workflow_id
and pf.node_id = d.node_id
and pf.document_no = a.reference_no
and pf.is_remark = '0'
) vals
for xml path(''), type
).value('.', 'nvarchar(max)'), 1, 1, '') as currentApprover
) approverData
where 1 = 1
<if test="params.site != null and params.site != ''">
and a.site = #{params.site}
</if>
<if test="params.referenceNo != null and params.referenceNo != ''">
and a.reference_no like #{params.referenceNo}
</if>
<if test="params.status != null and params.status != ''">
and a.status = #{params.status}
</if>
<if test="params.nodeId != null and params.nodeId != ''">
and d.node_id = #{params.nodeId}
</if>
<if test="params.currentApprover != null and params.currentApprover != ''">
and isnull(approverData.currentApprover, '') like #{params.currentApprover}
</if>
<if test="params.applicant != null and params.applicant != ''">
and a.applicant like #{params.applicant}
</if>
<if test="params.testerLike != null and params.testerLike != ''">
and (';' + isnull(replace(a.tester, ',', ';'), '') + ';') like ('%;' + #{params.testerLike} + ';%')
</if>
order by a.reference_no desc
<if test="size != null and size &gt; 0">
offset #{offset} rows fetch next #{size} rows only
</if>
</select>
<select id="queryPageWithNamesAny" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>,

Loading…
Cancel
Save