diff --git a/src/main/java/com/ycwl/basic/mapper/SourceMapper.java b/src/main/java/com/ycwl/basic/mapper/SourceMapper.java index 6fde6b0..6cbd958 100644 --- a/src/main/java/com/ycwl/basic/mapper/SourceMapper.java +++ b/src/main/java/com/ycwl/basic/mapper/SourceMapper.java @@ -85,4 +85,11 @@ public interface SourceMapper { int deleteUselessSource(); int updateMemberIdByFaceId(Long faceId, Long memberId); + + /** + * 根据faceId查询type=2的source列表 + * @param faceId 人脸ID + * @return type=2的source列表 + */ + List listImageSourcesByFaceId(Long faceId); } diff --git a/src/main/java/com/ycwl/basic/service/mobile/impl/AppScenicServiceImpl.java b/src/main/java/com/ycwl/basic/service/mobile/impl/AppScenicServiceImpl.java index b6a973c..bca2acb 100644 --- a/src/main/java/com/ycwl/basic/service/mobile/impl/AppScenicServiceImpl.java +++ b/src/main/java/com/ycwl/basic/service/mobile/impl/AppScenicServiceImpl.java @@ -103,6 +103,12 @@ public class AppScenicServiceImpl implements AppScenicService { ScenicLoginRespVO scenicLoginRespVO = new ScenicLoginRespVO(); BeanUtil.copyProperties(scenicAccount,scenicLoginRespVO); + List scenicIds = scenicAccountMapper.getAccountRelations(scenicAccount.getId()); + if (!scenicIds.isEmpty()) { + scenicLoginRespVO.setScenicId(scenicIds); + } else { + scenicLoginRespVO.setScenicId(List.of(scenicAccount.getId())); + } scenicLoginRespVO.setToken(token); return ApiResponse.success(scenicLoginRespVO); } diff --git a/src/main/java/com/ycwl/basic/service/pc/impl/ScenicAccountServiceImpl.java b/src/main/java/com/ycwl/basic/service/pc/impl/ScenicAccountServiceImpl.java index 4c210c7..edd049f 100644 --- a/src/main/java/com/ycwl/basic/service/pc/impl/ScenicAccountServiceImpl.java +++ b/src/main/java/com/ycwl/basic/service/pc/impl/ScenicAccountServiceImpl.java @@ -21,7 +21,13 @@ public class ScenicAccountServiceImpl implements ScenicAccountService { if (entity.getId() == null) { entity.setId(SnowFlakeUtil.getLongId()); } - return mapper.add(entity); + int result = mapper.add(entity); + if (entity.getScenicId() != null && !entity.getScenicId().isEmpty()) { + entity.getScenicId().forEach(scenicId -> { + mapper.addAccountScenicRelation(entity.getId(), scenicId, entity.getIsSuper()); + }); + } + return result; } @Override diff --git a/src/main/resources/mapper/ScenicAccountMapper.xml b/src/main/resources/mapper/ScenicAccountMapper.xml index 734ea7d..01ea7ab 100644 --- a/src/main/resources/mapper/ScenicAccountMapper.xml +++ b/src/main/resources/mapper/ScenicAccountMapper.xml @@ -2,8 +2,8 @@ - insert into scenic_account(id, scenic_id, is_super, name, phone, account, password, create_time, update_time) - values (#{id}, #{scenicId}, #{isSuper}, #{name}, #{phone}, #{account}, #{password}, now(), now()) + insert into scenic_account(id, is_super, name, phone, account, password, create_time, update_time) + values (#{id}, #{isSuper}, #{name}, #{phone}, #{account}, #{password}, now(), now()) insert into account_scenic(account_id, scenic_id, is_admin)