admin
2021-06-30 92cc47680855fd0ad62c90de013ea79530cf5c21
src/main/java/org/yeshi/utils/generater/mybatis/MyBatisMapperUtil.java
@@ -85,15 +85,15 @@
                }
                if (type.equalsIgnoreCase("Date")) {
                    String tempProperty = "min" + property.substring(0, 1).toUpperCase() + property.substring(1);
                    buffer.append(String.format("\tpublic %s %s", type, tempProperty));
                    buffer.append(String.format("\tpublic %s %s;", type, tempProperty));
                    queryColumnData.add(new MybatisColumnData(columnName, tempProperty, type));
                    buffer.append("\n\t");
                    tempProperty = "max" + property.substring(0, 1).toUpperCase() + property.substring(1);
                    buffer.append(String.format("\tpublic %s %s", type, tempProperty));
                    buffer.append(String.format("\tpublic %s %s;", type, tempProperty));
                    queryColumnData.add(new MybatisColumnData(columnName, tempProperty, type));
                    buffer.append("\n\t");
                } else {
                    buffer.append(String.format("\tpublic %s %s", type, property));
                    buffer.append(String.format("\tpublic %s %s;", type, property));
                    queryColumnData.add(new MybatisColumnData(columnName, property, type));
                    buffer.append("\n\t");
                }
@@ -126,12 +126,13 @@
        buffer.append(String.format("public interface %sMapper extends BaseMapper<%s> {", clz.getSimpleName(), clz.getSimpleName()));
        buffer.append("\n\n\t");
        buffer.append(String.format("%s selectByPrimaryKeyForUpdate(@Param(\"id\") id);",clz.getSimpleName()));
        //TODO 确定ID类型
        buffer.append(String.format("%s selectByPrimaryKeyForUpdate(@Param(\"id\") Long id);",clz.getSimpleName()));
        buffer.append("\n\n\t");
        buffer.append(String.format("List<%s> list(@Param(\"query\") query);", clz.getSimpleName()));
        buffer.append(String.format("List<%s> list(@Param(\"query\") DaoQuery query);", clz.getSimpleName()));
        buffer.append("\n\n\t");
        buffer.append("long count(@Param(\"query\") query);");
        buffer.append("long count(@Param(\"query\") DaoQuery query);");
        buffer.append("\n\n\t");
        List<MybatisColumnData> queryColumnData = createMapperDaoQuery(importPosition, buffer, clz);
@@ -236,7 +237,7 @@
            select.addText("select");
            org.dom4j.Element include = select.addElement("include");
            include.addAttribute("refid", "Base_Column_List");
            select.addText(String.format("from %s where %s = #{%s,jdbcType=BIGINT}", tableName, idKeys.column,
            select.addText(String.format(" from %s where %s = #{%s,jdbcType=BIGINT}", tableName, idKeys.column,
                    idKeys.attribute));
@@ -247,7 +248,7 @@
            select.addText("select");
            include = select.addElement("include");
            include.addAttribute("refid", "Base_Column_List");
            select.addText(String.format("from %s where %s = #{%s,jdbcType=BIGINT} for update", tableName, idKeys.column,
            select.addText(String.format(" from %s where %s = #{%s,jdbcType=BIGINT} for update", tableName, idKeys.column,
                    idKeys.attribute));
            //添加sql
@@ -274,7 +275,7 @@
            select.addText("select");
            include = select.addElement("include");
            include.addAttribute("refid", "Base_Column_List");
            select.addText(String.format("from %s where 1=1", tableName));
            select.addText(String.format(" from %s where 1=1", tableName));
            include = select.addElement("include");
            include.addAttribute("refid", "listWhereSQL");