| | |
| | | |
| | | import com.tcm.training.admin.app.register.entity.SysRegion; |
| | | import com.tcm.training.admin.app.register.mapper.SysRegionMapper; |
| | | import com.tcm.training.admin.app.register.vo.AppRegisterRegionDatasetVO; |
| | | import com.tcm.training.admin.app.register.vo.AppRegisterRegionOptionVO; |
| | | import org.junit.jupiter.api.BeforeEach; |
| | | import org.junit.jupiter.api.Test; |
| | |
| | | import org.mockito.Mock; |
| | | import org.mockito.junit.jupiter.MockitoExtension; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * APP 完整地区数据集应过滤区县层级的市辖区占位节点。 |
| | | */ |
| | | @Test |
| | | void buildRegionDatasetShouldHideMunicipalDistrictPlaceholder() { |
| | | SysRegion province = buildRegion(1L, "江西省", "360000", 0L); |
| | | SysRegion city = buildRegion(2L, "吉安市", "360800", 1L); |
| | | SysRegion placeholder = buildRegion(3L, "吉安市市辖区", "360801", 2L); |
| | | SysRegion district = buildRegion(4L, "吉州区", "360802", 2L); |
| | | when(sysRegionMapper.selectAllOrdered()).thenReturn( |
| | | Arrays.asList(province, city, placeholder, district) |
| | | ); |
| | | |
| | | AppRegisterRegionDatasetVO dataset = appRegisterRegionService.buildRegionDataset(); |
| | | |
| | | assertEquals(1, dataset.getAreas().size()); |
| | | assertEquals(1, dataset.getAreas().get(0).size()); |
| | | assertEquals(1, dataset.getAreas().get(0).get(0).size()); |
| | | assertEquals("吉州区", dataset.getAreas().get(0).get(0).get(0).getLabel()); |
| | | assertEquals("360802", dataset.getAreas().get(0).get(0).get(0).getValue()); |
| | | } |
| | | |
| | | /** |
| | | * 海诊通仅返回地区名称时,应通过 sys_region 解析出完整编码。 |
| | | */ |
| | | @Test |