fix(ebom): 修复精确搜索不能跨部门的问题

This commit is contained in:
曹鹏飞 2024-06-14 13:33:12 +08:00
parent 7ff168fd1a
commit 7806d18874
3 changed files with 31 additions and 25 deletions

View File

@ -82,7 +82,7 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
List<BomNewEbomParentEntity> getEBomParentByMaterialNos(@Param("job") Integer job, @Param("createdBy")String createdBy, @Param("materialNos") List<String> materialNos);
Page<BomNewEbomParentVO> workDetailsListByPageNew(Page<Object> objectPage, BomNewEbomParentQuery query, Integer userJob, String userCode, Long deptRowId);
Page<BomNewEbomParentVO> workDetailsListByPageNew(Page<Object> objectPage, BomNewEbomParentQuery query, Integer userJob, String userCode, Long deptRowId, boolean fuzzySearch);
List<BomNewEbomParentVO> getChildren(Long bomRowId, int type);

View File

@ -2221,14 +2221,13 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
Page<BomNewEbomParentVO> result;
if (StrUtil.isBlank(query.getMaterialNo()) && StrUtil.isBlank(query.getDrawingNo())) {
result = this.getBaseMapper().workDetailsListByPageNew(new Page<>(query.getPage()
, query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode(), SessionUtil.getDepartRowId());
, query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode(), SessionUtil.getDepartRowId(), true);
//列表搜索
materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
return result;
}
query.setShowMySelfOnly(0);
result = this.getBaseMapper().workDetailsListByPageNew(new Page<>(query.getPage()
, query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode(), SessionUtil.getDepartRowId());
, query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode(), SessionUtil.getDepartRowId(), false);
//根据编号或图号搜索
//从顶级开始查找
List<BomNewEbomParentVO> roots = result.getRecords().stream()

View File

@ -408,6 +408,7 @@
SELECT *,row_id as bomRowId
FROM t_bom_new_ebom_parent
<where>
<if test="fuzzySearch==true">
<if test="query.showMySelfOnly == 1">
AND created_by = #{userCode}
</if>
@ -419,7 +420,8 @@
created_by=#{userCode}
</if>
<if test="userJob==1">
AND ((root_is=1 OR user_root_is=1) AND status=2) OR (status IN (1,3) AND (root_is=1 OR user_root_is=1 OR
AND ((root_is=1 OR user_root_is=1) AND status=2) OR (status IN (1,3) AND (root_is=1 OR
user_root_is=1 OR
root_is_for_wait_review=1) AND created_by=#{userCode})
</if>
<if test="query.deviseName!=null and query.deviseName!=''">
@ -431,6 +433,10 @@
<if test="query.noticeNo!=null and query.noticeNo!=''">
AND notice_nums LIKE concat('%', #{query.noticeNo}, '%')
</if>
</if>
<if test="fuzzySearch==false">
status &lt; 4 AND (root_is=1 OR user_root_is=1 OR root_is_for_wait_review=1)
</if>
</where>
order by row_id desc
</select>
@ -445,6 +451,7 @@
, IFNULL(a.last_version_is, 1) last_version_is
, IFNULL(a.user_root_is, 0) user_root_is
, IFNULL(a.row_id, 0) AS bomRowId
, a.status
, b.*
FROM t_bom_new_ebom_child b
LEFT JOIN t_bom_new_ebom_parent a ON a.material_no = b.material_no