diff --git a/src/main/java/com/ai/da/mapper/secondary/AttributeRetrievalMapper.java b/src/main/java/com/ai/da/mapper/secondary/AttributeRetrievalMapper.java index 1c3be31b..772d63df 100644 --- a/src/main/java/com/ai/da/mapper/secondary/AttributeRetrievalMapper.java +++ b/src/main/java/com/ai/da/mapper/secondary/AttributeRetrievalMapper.java @@ -17,11 +17,11 @@ import java.util.List; public interface AttributeRetrievalMapper { - List getSystemSketchPool(@Param("attributeRetrievalAttrDict") AttributeRetrieval attributeRetrievalAttrDict, @Param("tableName") String tableName, @Param("poolNum") int poolNum, @Param("style") String style); + List getSystemSketchPool(@Param("attributeRetrievalAttrDict") AttributeRetrieval attributeRetrievalAttrDict, @Param("tableName") String tableName, @Param("poolNum") int poolNum, @Param("style") String style, @Param("isFemaleTable") boolean isFemaleTable); - AttributeRetrieval getSystemRandom(String tableName, String style); + AttributeRetrieval getSystemRandom(String tableName, String style, boolean isFemaleTable); - List getSystemSketchPoolBySameCategory(AttributeRetrieval attributeRetrievalAttrDict, String tableName, String style); + List getSystemSketchPoolBySameCategory(AttributeRetrieval attributeRetrievalAttrDict, String tableName, String style, boolean isFemaleTable); Long getIdByFileName(String fileName, String tableName); diff --git a/src/main/java/com/ai/da/python/PythonService.java b/src/main/java/com/ai/da/python/PythonService.java index 3dd32bb3..0dd6163c 100644 --- a/src/main/java/com/ai/da/python/PythonService.java +++ b/src/main/java/com/ai/da/python/PythonService.java @@ -644,14 +644,18 @@ public class PythonService { AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON); String tableName; tableName = getTableName(modelSex, styleCategory); - List attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style); + boolean isFemaleTable = false; + if (tableName.contains("female")) { + isFemaleTable = true; + } + List attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable); if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) { attributeRetrievalAttrDict.setDesign(null); - attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style); + attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable); } if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) { attributeRetrievalAttrDict.setSilhouette(null); - attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style); + attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable); } return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex); } @@ -670,7 +674,10 @@ public class PythonService { AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON); String tableName; tableName = getTableName(modelSex, styleCategory); - + boolean isFemaleTable = false; + if (tableName.contains("female")) { + isFemaleTable = true; + } // 存储非空字段的列表 List nonNullFields = new ArrayList<>(); if (attributeRetrievalAttrDict.getType() != null) { @@ -712,7 +719,7 @@ public class PythonService { } } - List attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style); + List attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable); if (CollectionUtil.isEmpty(attributeRetrievalList)) { System.out.println(attributeRetrievalAttrDict); System.out.println(tableName); @@ -720,12 +727,12 @@ public class PythonService { attributeRetrievalAttrDict.setType(null); attributeRetrievalAttrDict.setOpeningType(null); attributeRetrievalAttrDict.setSubtype(null); - attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style); + attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable); }else { attributeRetrievalAttrDict.setType(null); attributeRetrievalAttrDict.setOpeningType(null); attributeRetrievalAttrDict.setSubtype(null); - attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style); + attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable); } } return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex); @@ -946,7 +953,11 @@ public class PythonService { Integer randomNum = RandomsUtil.randomSysFile(dressings.size()); String category = dressings.get(randomNum).getStyleCategory(); String tableName = getTableName(validateElementVO.getModelSex(), category); - AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle()); + boolean isFemaleTable = false; + if (tableName.contains("female")) { + isFemaleTable = true; + } + AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle(), isFemaleTable); CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex()); return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO); } @@ -986,7 +997,11 @@ public class PythonService { Integer randomNum = RandomsUtil.randomSysFile(dressings.size()); String category = dressings.get(randomNum).getStyleCategory(); String tableName = getTableName(validateElementVO.getModelSex(), category); - AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle()); + boolean isFemaleTable = false; + if (tableName.contains("female")) { + isFemaleTable = true; + } + AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle(), isFemaleTable); CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex()); return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO); } diff --git a/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml b/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml index bcdfa819..ed6bc6a6 100644 --- a/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml +++ b/src/main/resources/mapper/secondary/AttributeRetrievalMapper.xml @@ -32,7 +32,9 @@ AND style = #{style} - + + AND deprecated = 0 + ORDER BY RAND() @@ -48,7 +50,9 @@ AND style = #{style} - + + AND deprecated = 0 + ORDER BY RAND() @@ -73,7 +77,9 @@ AND style = #{style} - + + AND deprecated = 0 + ORDER BY RAND()