修复业务菜单图标并固化菌种编码模糊查询

This commit is contained in:
焦龙言
2026-07-28 08:43:31 +08:00
parent 9ef214f040
commit b4822fef12
5 changed files with 368 additions and 11 deletions
@@ -570,6 +570,23 @@ class TestMasterDao(unittest.IsolatedAsyncioTestCase):
self.assertIn(f'ORDER BY {statement.get_final_froms()[0].name}.{expected_tokens[-1]}', sql)
self.assertEqual((2, 5, True), paginate_mock.await_args.args[2:])
async def test_strain_code_search_keeps_partial_matching_for_leading_zero_codes(self) -> None:
page = PageModel(rows=[], pageNum=1, pageSize=10, total=0, hasNext=False)
for strain_code in ('01', '1'):
with (
self.subTest(strain_code=strain_code),
patch.object(PageUtil, 'paginate', new=AsyncMock(return_value=page)) as paginate_mock,
):
result = await MasterDao.list_strain(
self.db,
StrainPageQueryModel(strainCode=strain_code, pageNum=1, pageSize=10),
is_page=True,
)
statement = paginate_mock.await_args.args[1]
self.assertIs(page, result)
self.assertIn(f"biz_strain.strain_code LIKE '%{strain_code}%'", compile_sql(statement))
async def test_get_queries_use_expected_table_and_primary_key(self) -> None:
cases = (
('strain', 'biz_strain', 'strain_id'),