景区账号添加问题

This commit is contained in:
2025-07-31 14:22:20 +08:00
parent 9ed254c920
commit f797479515
4 changed files with 22 additions and 3 deletions

View File

@@ -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<SourceEntity> listImageSourcesByFaceId(Long faceId);
}

View File

@@ -103,6 +103,12 @@ public class AppScenicServiceImpl implements AppScenicService {
ScenicLoginRespVO scenicLoginRespVO = new ScenicLoginRespVO();
BeanUtil.copyProperties(scenicAccount,scenicLoginRespVO);
List<Long> 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);
}

View File

@@ -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

View File

@@ -2,8 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.ycwl.basic.mapper.ScenicAccountMapper">
<insert id="add">
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>
<insert id="addAccountScenicRelation">
insert into account_scenic(account_id, scenic_id, is_admin)