修复默认酒店启动覆盖名称问题

This commit is contained in:
andy
2026-07-13 14:51:47 +08:00
parent 76ef878ef6
commit c55090bc2e
2 changed files with 26 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import cn.nianxx.thhotel.ThHotelApplication;
import java.time.LocalDateTime;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -101,4 +102,24 @@ class PlatformIdentityBootstrapRunnerTest {
""", Integer.class, viewerRoleId, debugPermissionId);
assertThat(staleCount).isZero();
}
@Test
void shouldNotOverwriteExistingBootstrapHotelDisplayFields() {
jdbcTemplate.update("""
UPDATE platform_hotel
SET hotel_name = ?, time_zone = ?, sort_order = ?
WHERE hotel_id = 'HOTEL-TEST'
""", "人工维护酒店", "Asia/Shanghai", 66);
bootstrapRunner.run((ApplicationArguments) null);
Map<String, Object> hotel = jdbcTemplate.queryForMap("""
SELECT hotel_name, time_zone, sort_order
FROM platform_hotel
WHERE hotel_id = 'HOTEL-TEST'
""");
assertThat(hotel.get("hotel_name")).isEqualTo("人工维护酒店");
assertThat(hotel.get("time_zone")).isEqualTo("Asia/Shanghai");
assertThat(((Number) hotel.get("sort_order")).intValue()).isEqualTo(66);
}
}