BUGFIX:过滤已废弃

This commit is contained in:
shahaibo
2024-08-02 11:36:58 +08:00
parent a10d30337a
commit fada00c738
3 changed files with 36 additions and 15 deletions

View File

@@ -17,11 +17,11 @@ import java.util.List;
public interface AttributeRetrievalMapper { public interface AttributeRetrievalMapper {
List<AttributeRetrieval> getSystemSketchPool(@Param("attributeRetrievalAttrDict") AttributeRetrieval attributeRetrievalAttrDict, @Param("tableName") String tableName, @Param("poolNum") int poolNum, @Param("style") String style); List<AttributeRetrieval> 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<AttributeRetrieval> getSystemSketchPoolBySameCategory(AttributeRetrieval attributeRetrievalAttrDict, String tableName, String style); List<AttributeRetrieval> getSystemSketchPoolBySameCategory(AttributeRetrieval attributeRetrievalAttrDict, String tableName, String style, boolean isFemaleTable);
Long getIdByFileName(String fileName, String tableName); Long getIdByFileName(String fileName, String tableName);

View File

@@ -644,14 +644,18 @@ public class PythonService {
AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON); AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON);
String tableName; String tableName;
tableName = getTableName(modelSex, styleCategory); tableName = getTableName(modelSex, styleCategory);
List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style); boolean isFemaleTable = false;
if (tableName.contains("female")) {
isFemaleTable = true;
}
List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable);
if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) { if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) {
attributeRetrievalAttrDict.setDesign(null); 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) { if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) {
attributeRetrievalAttrDict.setSilhouette(null); attributeRetrievalAttrDict.setSilhouette(null);
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style); attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable);
} }
return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex); return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex);
} }
@@ -670,7 +674,10 @@ public class PythonService {
AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON); AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON);
String tableName; String tableName;
tableName = getTableName(modelSex, styleCategory); tableName = getTableName(modelSex, styleCategory);
boolean isFemaleTable = false;
if (tableName.contains("female")) {
isFemaleTable = true;
}
// 存储非空字段的列表 // 存储非空字段的列表
List<String> nonNullFields = new ArrayList<>(); List<String> nonNullFields = new ArrayList<>();
if (attributeRetrievalAttrDict.getType() != null) { if (attributeRetrievalAttrDict.getType() != null) {
@@ -712,7 +719,7 @@ public class PythonService {
} }
} }
List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style); List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable);
if (CollectionUtil.isEmpty(attributeRetrievalList)) { if (CollectionUtil.isEmpty(attributeRetrievalList)) {
System.out.println(attributeRetrievalAttrDict); System.out.println(attributeRetrievalAttrDict);
System.out.println(tableName); System.out.println(tableName);
@@ -720,12 +727,12 @@ public class PythonService {
attributeRetrievalAttrDict.setType(null); attributeRetrievalAttrDict.setType(null);
attributeRetrievalAttrDict.setOpeningType(null); attributeRetrievalAttrDict.setOpeningType(null);
attributeRetrievalAttrDict.setSubtype(null); attributeRetrievalAttrDict.setSubtype(null);
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style); attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable);
}else { }else {
attributeRetrievalAttrDict.setType(null); attributeRetrievalAttrDict.setType(null);
attributeRetrievalAttrDict.setOpeningType(null); attributeRetrievalAttrDict.setOpeningType(null);
attributeRetrievalAttrDict.setSubtype(null); attributeRetrievalAttrDict.setSubtype(null);
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style); attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable);
} }
} }
return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex); return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex);
@@ -946,7 +953,11 @@ public class PythonService {
Integer randomNum = RandomsUtil.randomSysFile(dressings.size()); Integer randomNum = RandomsUtil.randomSysFile(dressings.size());
String category = dressings.get(randomNum).getStyleCategory(); String category = dressings.get(randomNum).getStyleCategory();
String tableName = getTableName(validateElementVO.getModelSex(), category); 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()); CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO); return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
} }
@@ -986,7 +997,11 @@ public class PythonService {
Integer randomNum = RandomsUtil.randomSysFile(dressings.size()); Integer randomNum = RandomsUtil.randomSysFile(dressings.size());
String category = dressings.get(randomNum).getStyleCategory(); String category = dressings.get(randomNum).getStyleCategory();
String tableName = getTableName(validateElementVO.getModelSex(), category); 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()); CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO); return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
} }

View File

@@ -32,7 +32,9 @@
<if test="style != null"> <if test="style != null">
AND style = #{style} AND style = #{style}
</if> </if>
<if test="isFemaleTable">
AND deprecated = 0
</if>
</trim> </trim>
ORDER BY ORDER BY
RAND() RAND()
@@ -48,7 +50,9 @@
<if test="style != null"> <if test="style != null">
AND style = #{style} AND style = #{style}
</if> </if>
<if test="isFemaleTable">
AND deprecated = 0
</if>
</trim> </trim>
ORDER BY ORDER BY
RAND() RAND()
@@ -73,7 +77,9 @@
<if test="style != null"> <if test="style != null">
AND style = #{style} AND style = #{style}
</if> </if>
<if test="isFemaleTable">
AND deprecated = 0
</if>
</trim> </trim>
ORDER BY ORDER BY
RAND() RAND()