| | |
| | | private static final String PORT = "57654"; |
| | | private static final String USER = "lunhan"; |
| | | private static final String PASSWORD = "lunhan.20240330"; |
| | | private static final String DB_NAME = "water_trade_center"; |
| | | private static final String DB_NAME = "test_db1"; |
| | | private static final String AUTHOR = "lin.liu"; |
| | | |
| | | private static Connection CONN = null; |
| | |
| | | public static final String PO = "./src/main/java/com/lunhan/xxx/repository/po/"; |
| | | public static final String VO = "./src/main/java/com/lunhan/xxx/repository/vo/"; |
| | | public static final String CONVERT_MAPPER = "./src/main/java/com/lunhan/xxx/service/convert/"; |
| | | public static final String MAPPER_IMPL = "./src/main/java/com/lunhan/xxx/repository/mapper/"; |
| | | public static final String MAPPER = "./src/main/java/com/lunhan/xxx/repository/imapper/"; |
| | | public static final String MAPPER_IMPL = "./src/main/java/com/lunhan/xxx/repository/impl/"; |
| | | public static final String MAPPER = "./src/main/java/com/lunhan/xxx/repository/mapper/"; |
| | | public static final String SERVICE = "./src/main/java/com/lunhan/xxx/service/"; |
| | | public static final String Controller = "./src/main/java/com/lunhan/xxx/host/controller/"; |
| | | public static final String SEARCH = "./src/main/java/com/lunhan/xxx/entity/dto/search/"; |
| | |
| | | public static final String PO = "com.lunhan.xxx.repository.po"; |
| | | public static final String VO = "com.lunhan.xxx.repository.vo"; |
| | | public static final String CONVERT_MAPPER = "com.lunhan.xxx.service.convert"; |
| | | public static final String MAPPER_IMPL = "com.lunhan.xxx.repository.mapper"; |
| | | public static final String MAPPER = "com.lunhan.xxx.repository.imapper"; |
| | | public static final String MAPPER_IMPL = "com.lunhan.xxx.repository.impl"; |
| | | public static final String MAPPER = "com.lunhan.xxx.repository.mapper"; |
| | | public static final String SERVICE = "com.lunhan.xxx.service"; |
| | | public static final String Controller = "com.lunhan.xxx.host.controller"; |
| | | public static final String SEARCH = "com.lunhan.xxx.entity.dto.search"; |
| | |
| | | |
| | | //region po类 import 内容设置 |
| | | private static final String[] SET_PO_IMPORT = new String[]{ |
| | | "import com.lunhan.xxx.repository.BasicPO;", |
| | | "import com.baomidou.mybatisplus.annotation.*;", |
| | | "", |
| | | "import javax.persistence.*;", |
| | | "import java.io.Serializable;", |
| | | "import java.sql.Timestamp;" |
| | | }; |
| | |
| | | "import org.mapstruct.factory.Mappers;" + |
| | | "" + |
| | | "import java.util.List;" |
| | | }; |
| | | //endregion |
| | | |
| | | //region 字段名枚举类 import 内容设置 |
| | | private static final String[] SET_COLUMNS_ENUM_IMPORT = new String[]{ |
| | | "import com.lunhan.xxx.common.orm2.enums.ColumnBasic;", |
| | | "import java.util.Arrays;", |
| | | "import java.util.Objects;" |
| | | }; |
| | | //endregion |
| | | |
| | |
| | | //region service类 import 内容设置 |
| | | private static final String[] SET_Service_IMPORT = new String[]{ |
| | | "import com.lunhan.xxx.common.*;", |
| | | "import com.lunhan.xxx.common.enums.*;", |
| | | "import com.lunhan.xxx.common.model.Tuple;", |
| | | "import com.lunhan.xxx.common.util.*;", |
| | | "import org.apache.commons.lang3.BooleanUtils;", |
| | | "import org.springframework.beans.factory.annotation.Autowired;", |
| | | "import org.springframework.stereotype.Service;", |
| | | "import java.util.ArrayList;", |
| | | "import java.util.List;", |
| | | "import java.util.Objects;" |
| | | "import java.util.*;", |
| | | "import java.util.stream.Collectors;" |
| | | }; |
| | | //endregion |
| | | |
| | |
| | | |
| | | listColumn.add(SET_PRO_DESC_TPL.replaceAll("\\{\\#\\=desc\\}", desc)); |
| | | if (Objects.equals(isPK, 1)) { |
| | | listColumn.add("\t@Id"); |
| | | listColumn.add("\t@TableId"); |
| | | if (Objects.equals(isIdentity, 1)) { |
| | | listColumn.add("(type = IdType.AUTO)"); |
| | | } else { |
| | | listColumn.add("(type = IdType.ASSIGN_ID)"); |
| | | } |
| | | } |
| | | if (Objects.equals(isIdentity, 1)) { |
| | | listColumn.add("\t@GeneratedValue(strategy = GenerationType.AUTO)"); |
| | | } |
| | | String columnAnnotation = "\t@Column(name = \"" + name + "\""; |
| | | String columnAnnotation = "\t@TableField(\"" + name + "\""; |
| | | //忽略最后修改时间这一列的新增和编辑 |
| | | if (UPDATE_TIME_COLUMNS.stream().anyMatch(c -> c.equalsIgnoreCase(name))) { |
| | | columnAnnotation += ", insertable = false, updatable = false"; |
| | | } |
| | | // if (UPDATE_TIME_COLUMNS.stream().anyMatch(c -> c.equalsIgnoreCase(name))) { |
| | | // columnAnnotation += ", insertable = false, updatable = false"; |
| | | // } |
| | | if ("datachange_lasttime".equalsIgnoreCase(name)) { |
| | | propName = "dataChangeLastTime"; |
| | | columnNameUpper = "DataChangeLastTime"; |
| | |
| | | content.append("@Data"); |
| | | content.append(ConstantFactory.STR_NEWLINE); |
| | | } |
| | | content.append("@Entity"); |
| | | content.append(ConstantFactory.STR_NEWLINE); |
| | | content.append("@Table(name = \"" + tableName); |
| | | content.append("@TableName(\"" + tableName); |
| | | content.append("\")"); |
| | | content.append(ConstantFactory.STR_NEWLINE); |
| | | content.append("public class "); |
| | |
| | | content.append(" public ExecutedResult<Long> create(" + createDTOName + " request) {\n" + |
| | | " // 转换po\n" + |
| | | " " + poName + " item = CopierUtil.mapTo(request, " + poName + ".class);\n" + |
| | | " // 设置主键id\n" + |
| | | " //item.setId(SnowFlakeUtil.getId());\n" + |
| | | " // 设置状态\n" + |
| | | " //item.setStatus(EState.NORMAL.getValue());\n" + |
| | | " // 设置记录创建时间\n" + |