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); 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); List<BomNewEbomParentVO> getChildren(Long bomRowId, int type);

View File

@ -2221,14 +2221,13 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
Page<BomNewEbomParentVO> result; Page<BomNewEbomParentVO> result;
if (StrUtil.isBlank(query.getMaterialNo()) && StrUtil.isBlank(query.getDrawingNo())) { if (StrUtil.isBlank(query.getMaterialNo()) && StrUtil.isBlank(query.getDrawingNo())) {
result = this.getBaseMapper().workDetailsListByPageNew(new Page<>(query.getPage() 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); materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
return result; return result;
} }
query.setShowMySelfOnly(0);
result = this.getBaseMapper().workDetailsListByPageNew(new Page<>(query.getPage() 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() List<BomNewEbomParentVO> roots = result.getRecords().stream()

View File

@ -408,28 +408,34 @@
SELECT *,row_id as bomRowId SELECT *,row_id as bomRowId
FROM t_bom_new_ebom_parent FROM t_bom_new_ebom_parent
<where> <where>
<if test="query.showMySelfOnly == 1"> <if test="fuzzySearch==true">
AND created_by = #{userCode} <if test="query.showMySelfOnly == 1">
AND created_by = #{userCode}
</if>
<if test="query.showMySelfOnly == 0">
AND dept_row_id = #{deptRowId}
</if>
<if test="userJob==0">
AND 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="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
root_is_for_wait_review=1) AND created_by=#{userCode})
</if>
<if test="query.deviseName!=null and query.deviseName!=''">
AND devise_name LIKE concat('%', #{query.deviseName}, '%')
</if>
<if test="query.startDate!=null and query.startDate!=''">
AND created_time BETWEEN #{query.startDate} AND DATE_ADD(#{query.endDate}, INTERVAL 1 DAY)
</if>
<if test="query.noticeNo!=null and query.noticeNo!=''">
AND notice_nums LIKE concat('%', #{query.noticeNo}, '%')
</if>
</if> </if>
<if test="query.showMySelfOnly == 0"> <if test="fuzzySearch==false">
AND dept_row_id = #{deptRowId} status &lt; 4 AND (root_is=1 OR user_root_is=1 OR root_is_for_wait_review=1)
</if>
<if test="userJob==0">
AND 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="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
root_is_for_wait_review=1) AND created_by=#{userCode})
</if>
<if test="query.deviseName!=null and query.deviseName!=''">
AND devise_name LIKE concat('%', #{query.deviseName}, '%')
</if>
<if test="query.startDate!=null and query.startDate!=''">
AND created_time BETWEEN #{query.startDate} AND DATE_ADD(#{query.endDate}, INTERVAL 1 DAY)
</if>
<if test="query.noticeNo!=null and query.noticeNo!=''">
AND notice_nums LIKE concat('%', #{query.noticeNo}, '%')
</if> </if>
</where> </where>
order by row_id desc order by row_id desc
@ -445,6 +451,7 @@
, IFNULL(a.last_version_is, 1) last_version_is , IFNULL(a.last_version_is, 1) last_version_is
, IFNULL(a.user_root_is, 0) user_root_is , IFNULL(a.user_root_is, 0) user_root_is
, IFNULL(a.row_id, 0) AS bomRowId , IFNULL(a.row_id, 0) AS bomRowId
, a.status
, b.* , b.*
FROM t_bom_new_ebom_child b FROM t_bom_new_ebom_child b
LEFT JOIN t_bom_new_ebom_parent a ON a.material_no = b.material_no LEFT JOIN t_bom_new_ebom_parent a ON a.material_no = b.material_no