diff --git a/os-mes/src/main/java/com/os/mes/base/service/impl/BaseStaffInfoServiceImpl.java b/os-mes/src/main/java/com/os/mes/base/service/impl/BaseStaffInfoServiceImpl.java index ba2decb..a339c71 100644 --- a/os-mes/src/main/java/com/os/mes/base/service/impl/BaseStaffInfoServiceImpl.java +++ b/os-mes/src/main/java/com/os/mes/base/service/impl/BaseStaffInfoServiceImpl.java @@ -5,6 +5,9 @@ import java.util.HashMap; import java.util.List; import com.os.common.utils.DateUtils; +import com.os.common.utils.StringUtils; +import com.os.mes.base.domain.BaseTeamMembers; +import com.os.mes.base.mapper.BaseTeamMembersMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.os.mes.base.mapper.BaseStaffInfoMapper; @@ -22,6 +25,9 @@ public class BaseStaffInfoServiceImpl implements IBaseStaffInfoService { @Autowired private BaseStaffInfoMapper baseStaffInfoMapper; + @Autowired + private BaseTeamMembersMapper baseTeamMembersMapper; + /** * 查询员工信息 * @@ -41,7 +47,22 @@ public class BaseStaffInfoServiceImpl implements IBaseStaffInfoService { */ @Override public List selectBaseStaffInfoList(BaseStaffInfo baseStaffInfo) { - return baseStaffInfoMapper.selectBaseStaffInfoList(baseStaffInfo); + List baseStaffInfos = baseStaffInfoMapper.selectBaseStaffInfoList(baseStaffInfo); + List teamMembers = baseTeamMembersMapper.selectBaseTeamMembersList(new BaseTeamMembers()); + for (BaseStaffInfo staffInfo : baseStaffInfos) { + if (StringUtils.isNotEmpty(staffInfo.getTeamCode())){ + for (BaseTeamMembers teamMember : teamMembers) { + if (staffInfo.getTeamCode().contains(teamMember.getTeamCode())){ + if (StringUtils.isEmpty(staffInfo.getTeamName())){ + staffInfo.setTeamName(teamMember.getTeamName()); + } else { + staffInfo.setTeamName(staffInfo.getTeamName() + "," + teamMember.getTeamName()); + } + } + } + } + } + return baseStaffInfos; } /** diff --git a/os-mes/src/main/resources/mapper/mes/base/BaseStaffInfoMapper.xml b/os-mes/src/main/resources/mapper/mes/base/BaseStaffInfoMapper.xml index 2a7fb97..4c95793 100644 --- a/os-mes/src/main/resources/mapper/mes/base/BaseStaffInfoMapper.xml +++ b/os-mes/src/main/resources/mapper/mes/base/BaseStaffInfoMapper.xml @@ -33,7 +33,6 @@ bsi.staff_type, bsi.card_id, bsi.team_code, - btm.team_name, bsi.phone_number, bsi.sex, bsi.pass_word, @@ -47,7 +46,6 @@ bsi.post_code, p.post_name from base_staff_info bsi - left join base_team_members btm on btm.team_code = bsi.team_code left join sys_post p on p.post_code = bsi.post_code @@ -58,7 +56,7 @@ and bsi.staff_name like concat('%', #{staffName}, '%') and bsi.staff_type = #{staffType} and bsi.card_id = #{cardId} - and bsi.team_code = #{teamCode} + and bsi.team_code like concat('%', #{teamCode}, '%') and bsi.phone_number = #{phoneNumber} and bsi.sex = #{sex} and bsi.pass_word = #{passWord} @@ -119,7 +117,7 @@ staff_name = #{staffName}, staff_type = #{staffType}, card_id = #{cardId}, - team_code = #{teamCode}, + team_code = #{teamCode}, phone_number = #{phoneNumber}, sex = #{sex}, pass_word = #{passWord},