From 74ca64d4ff51072221964e497911d575c10bce63 Mon Sep 17 00:00:00 2001 From: Alawn Date: Mon, 7 Nov 2022 09:44:52 +0800 Subject: [PATCH] add fact rest --- .../java/priv/alawn/aladmin/base/BaseDTO.java | 17 +- .../priv/alawn/aladmin/base/BaseEntity.java | 30 +-- .../mybatisplus/MyMetaObjectHandler.java | 7 +- .../idx/{ => entity}/domain/Dimension.java | 5 +- .../domain/DimensionAttribute.java | 34 +-- .../modules/idx/{ => entity}/domain/Fact.java | 30 ++- .../{ => entity}/domain/FactAttribute.java | 15 +- .../domain/FactMeasure.java} | 17 +- .../idx/{ => entity}/domain/Index.java | 3 +- .../domain/LogicModel.java} | 38 +-- .../idx/entity/domain/TableDefinition.java | 67 ++++++ .../idx/entity/dto/DimensionAttributeDto.java | 61 +++++ .../modules/idx/entity/dto/DimensionDto.java | 49 ++++ .../idx/entity/dto/FactAttributeDto.java | 52 +++++ .../modules/idx/entity/dto/FactDto.java | 53 +++++ .../idx/entity/dto/FactMeasureDto.java | 54 +++++ .../modules/idx/entity/dto/LogicModelDto.java | 46 ++++ .../modules/idx/entity/po/Dimension.java | 57 +++++ .../idx/entity/po/DimensionAttribute.java | 67 ++++++ .../aladmin/modules/idx/entity/po/Fact.java | 60 +++++ .../modules/idx/entity/po/FactAttribute.java | 62 +++++ .../modules/idx/entity/po/FactMeasure.java | 60 +++++ .../aladmin/modules/idx/entity/po/Index.java | 74 ++++++ .../modules/idx/entity/po/LogicModel.java | 59 +++++ .../idx/entity/po/TableDefinition.java | 71 ++++++ .../modules/idx/entity/vo/DimensionVo.java | 49 ++++ .../aladmin/modules/idx/entity/vo/FactVo.java | 55 +++++ .../modules/idx/entity/vo/LogicModelVo.java | 43 ++++ .../modules/idx/enums/AttributeTypeEnum.java | 22 ++ .../idx/mapper/DimensionAttributeMapper.java | 19 ++ .../modules/idx/mapper/DimensionMapper.java | 9 + .../idx/mapper/FactAttributeMapper.java | 18 ++ .../modules/idx/mapper/FactMapper.java | 24 +- .../modules/idx/mapper/FactMeasureMapper.java | 19 ++ .../idx/mapstruct/DimensionMapping.java | 24 ++ .../modules/idx/mapstruct/FactMapping.java | 33 +++ .../idx/mapstruct/LogicModelMapper.java | 23 ++ .../DimensionAttributeRepository.java | 27 +++ .../DimensionRepository.java} | 20 +- .../repository/FactAttributeRepository.java | 29 +++ .../idx/repository/FactMeasureRepository.java | 29 +++ .../idx/repository/FactRepository.java | 2 +- .../idx/repository/LogicModelRepository.java | 27 +++ .../modules/idx/rest/DimensionController.java | 50 ++-- .../modules/idx/rest/FactController.java | 98 +++++++- .../service/impl/DimensionServiceImpl.java | 99 ++++++++ .../idx/service/impl/FactServiceImpl.java | 132 +++++++++-- .../service/impl/LogicModelServiceImpl.java | 22 ++ aladmin-system/application.pid | 1 + aladmin-system/pom.xml | 4 + .../aladmin/modules/system/domain/Dept.java | 16 ++ .../aladmin/modules/system/domain/User.java | 22 ++ .../modules/system/rest/UserController.java | 3 + .../main/resources/config/application-dev.yml | 2 +- .../src/main/resources/config/application.yml | 2 +- .../java/priv/alawn/aladmin/IndexTests.java | 30 +++ .../alawn/aladmin/PasswordEncoderTests.java | 28 +++ nohup.out | 76 ++++++ pom.xml | 4 +- sql/aladmin.index.h2.sql | 221 ++++++++++-------- startApp.sh | 13 ++ stopApp.sh | 32 +++ stopKit.sh | 35 +++ 63 files changed, 2174 insertions(+), 276 deletions(-) rename aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/{ => entity}/domain/Dimension.java (94%) rename aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/{ => entity}/domain/DimensionAttribute.java (65%) rename aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/{ => entity}/domain/Fact.java (70%) rename aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/{ => entity}/domain/FactAttribute.java (82%) rename aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/{domain/Measure.java => entity/domain/FactMeasure.java} (80%) rename aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/{ => entity}/domain/Index.java (97%) rename aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/{domain/Model.java => entity/domain/LogicModel.java} (62%) create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/TableDefinition.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/DimensionAttributeDto.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/DimensionDto.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/FactAttributeDto.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/FactDto.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/FactMeasureDto.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/LogicModelDto.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/Dimension.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/DimensionAttribute.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/Fact.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/FactAttribute.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/FactMeasure.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/Index.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/LogicModel.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/TableDefinition.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/vo/DimensionVo.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/vo/FactVo.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/vo/LogicModelVo.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/enums/AttributeTypeEnum.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/DimensionAttributeMapper.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/DimensionMapper.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/FactAttributeMapper.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/FactMeasureMapper.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapstruct/DimensionMapping.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapstruct/FactMapping.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapstruct/LogicModelMapper.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/DimensionAttributeRepository.java rename aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/{service/FactService.java => repository/DimensionRepository.java} (63%) create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/FactAttributeRepository.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/FactMeasureRepository.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/LogicModelRepository.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/service/impl/DimensionServiceImpl.java create mode 100644 aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/service/impl/LogicModelServiceImpl.java create mode 100644 aladmin-system/application.pid create mode 100644 aladmin-system/src/test/java/priv/alawn/aladmin/IndexTests.java create mode 100644 aladmin-system/src/test/java/priv/alawn/aladmin/PasswordEncoderTests.java create mode 100644 nohup.out create mode 100755 startApp.sh create mode 100755 stopApp.sh create mode 100755 stopKit.sh diff --git a/aladmin-common/src/main/java/priv/alawn/aladmin/base/BaseDTO.java b/aladmin-common/src/main/java/priv/alawn/aladmin/base/BaseDTO.java index ddeb837..945393e 100644 --- a/aladmin-common/src/main/java/priv/alawn/aladmin/base/BaseDTO.java +++ b/aladmin-common/src/main/java/priv/alawn/aladmin/base/BaseDTO.java @@ -22,19 +22,4 @@ public class BaseDTO implements Serializable { private Timestamp createTime; private Timestamp updateTime; - - @Override - public String toString() { - ToStringBuilder builder = new ToStringBuilder(this); - Field[] fields = this.getClass().getDeclaredFields(); - try { - for (Field f : fields) { - f.setAccessible(true); - builder.append(f.getName(), f.get(this)).append("\n"); - } - } catch (Exception e) { - builder.append("toString builder encounter an error"); - } - return builder.toString(); - } -} +} \ No newline at end of file diff --git a/aladmin-common/src/main/java/priv/alawn/aladmin/base/BaseEntity.java b/aladmin-common/src/main/java/priv/alawn/aladmin/base/BaseEntity.java index 330699e..448e0b2 100644 --- a/aladmin-common/src/main/java/priv/alawn/aladmin/base/BaseEntity.java +++ b/aladmin-common/src/main/java/priv/alawn/aladmin/base/BaseEntity.java @@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; +import lombok.ToString; import org.apache.commons.lang3.builder.ToStringBuilder; import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp; @@ -42,6 +43,7 @@ import java.sql.Timestamp; @Setter @MappedSuperclass @EntityListeners(AuditingEntityListener.class) +@ToString public class BaseEntity implements Serializable { @CreatedBy @@ -74,18 +76,18 @@ public class BaseEntity implements Serializable { /* 分组校验 */ public @interface Update {} - @Override - public String toString() { - ToStringBuilder builder = new ToStringBuilder(this); - Field[] fields = this.getClass().getDeclaredFields(); - try { - for (Field f : fields) { - f.setAccessible(true); - builder.append(f.getName(), f.get(this)).append("\n"); - } - } catch (Exception e) { - builder.append("toString builder encounter an error"); - } - return builder.toString(); - } +// @Override +// public String toString() { +// ToStringBuilder builder = new ToStringBuilder(this); +// Field[] fields = this.getClass().getDeclaredFields(); +// try { +// for (Field f : fields) { +// f.setAccessible(true); +// builder.append(f.getName(), f.get(this)).append("\n"); +// } +// } catch (Exception e) { +// builder.append("toString builder encounter an error"); +// } +// return builder.toString(); +// } } diff --git a/aladmin-common/src/main/java/priv/alawn/aladmin/config/mybatisplus/MyMetaObjectHandler.java b/aladmin-common/src/main/java/priv/alawn/aladmin/config/mybatisplus/MyMetaObjectHandler.java index 28758b3..a0d676e 100644 --- a/aladmin-common/src/main/java/priv/alawn/aladmin/config/mybatisplus/MyMetaObjectHandler.java +++ b/aladmin-common/src/main/java/priv/alawn/aladmin/config/mybatisplus/MyMetaObjectHandler.java @@ -5,6 +5,7 @@ import org.apache.ibatis.reflection.MetaObject; import org.springframework.stereotype.Component; import priv.alawn.aladmin.utils.SecurityUtils; +import java.sql.Timestamp; import java.time.LocalDateTime; @Component @@ -12,8 +13,8 @@ public class MyMetaObjectHandler implements MetaObjectHandler { @Override public void insertFill(MetaObject metaObject) { - this.strictInsertFill(metaObject, "createTime", () -> LocalDateTime.now(), LocalDateTime.class); - this.strictInsertFill(metaObject, "updateTime", () -> LocalDateTime.now(), LocalDateTime.class); + this.strictInsertFill(metaObject, "createTime", () -> Timestamp.valueOf(LocalDateTime.now()), Timestamp.class); + this.strictInsertFill(metaObject, "updateTime", () -> Timestamp.valueOf(LocalDateTime.now()), Timestamp.class); this.strictInsertFill(metaObject, "updateBy", () -> SecurityUtils.getCurrentUsername(), String.class); this.strictInsertFill(metaObject, "createBy", () -> SecurityUtils.getCurrentUsername(), String.class); } @@ -21,7 +22,7 @@ public class MyMetaObjectHandler implements MetaObjectHandler { @Override public void updateFill(MetaObject metaObject) { - this.strictInsertFill(metaObject, "updateTime", () -> LocalDateTime.now(), LocalDateTime.class); + this.strictInsertFill(metaObject, "updateTime", () -> Timestamp.valueOf(LocalDateTime.now()), Timestamp.class); this.strictInsertFill(metaObject, "updateBy", () -> SecurityUtils.getCurrentUsername(), String.class); } } diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/Dimension.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/Dimension.java similarity index 94% rename from aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/Dimension.java rename to aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/Dimension.java index 3d60985..5d44b0c 100644 --- a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/Dimension.java +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/Dimension.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package priv.alawn.aladmin.modules.idx.domain; +package priv.alawn.aladmin.modules.idx.entity.domain; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; @@ -26,7 +26,6 @@ import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.List; import java.util.Objects; -import java.util.Set; /** * @author Alawn @@ -51,7 +50,7 @@ public class Dimension extends BaseEntity implements Serializable { private Boolean indexDimension; private Boolean timeDimension; - @OneToMany(mappedBy = "dimension") + @OneToMany(mappedBy = "dimension",fetch = FetchType.LAZY,cascade = CascadeType.ALL) private List attributes; @Override diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/DimensionAttribute.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/DimensionAttribute.java similarity index 65% rename from aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/DimensionAttribute.java rename to aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/DimensionAttribute.java index f2488ce..ce17eb4 100644 --- a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/DimensionAttribute.java +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/DimensionAttribute.java @@ -13,9 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package priv.alawn.aladmin.modules.idx.domain; +package priv.alawn.aladmin.modules.idx.entity.domain; -import com.fasterxml.jackson.annotation.JsonBackReference; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; @@ -44,15 +43,20 @@ public class DimensionAttribute extends BaseEntity implements Serializable { @ApiModelProperty(value = "ID", hidden = true) private Long id; + // @JsonBackReference @ManyToOne @JoinColumn(name = "dimension_id") -// @JsonBackReference private Dimension dimension; - private String attributeCode; - private String attributeName; - private String attributeDescription; + @ApiModelProperty(value = "属性代码") + protected String attributeCode; + @ApiModelProperty(value = "属性名称") + protected String attributeName; + @ApiModelProperty(value = "属性描述") + protected String description; + @ApiModelProperty(value = "键值属性") private Boolean keyAttribute; + @ApiModelProperty(value = "代码属性") private Boolean codeAttribute = false; @Override @@ -72,12 +76,16 @@ public class DimensionAttribute extends BaseEntity implements Serializable { @Override public String toString() { return getClass().getSimpleName() + "(" + - "id = " + id + ", " + - "dimension = " + dimension + ", " + - "attributeCode = " + attributeCode + ", " + - "attributeName = " + attributeName + ", " + - "attributeDescription = " + attributeDescription + ", " + - "keyAttribute = " + keyAttribute + ", " + - "codeAttribute = " + codeAttribute + ")"; + "id = " + getId() + ", " + + "createBy = " + getCreateBy() + ", " + + "updateBy = " + getUpdateBy() + ", " + + "createTime = " + getCreateTime() + ", " + + "updateTime = " + getUpdateTime() + ", " + + "dimension = " + getDimension() + ", " + + "attributeCode = " + getAttributeCode() + ", " + + "attributeName = " + getAttributeName() + ", " + + "description = " + getDescription() + ", " + + "keyAttribute = " + getKeyAttribute() + ", " + + "codeAttribute = " + getCodeAttribute() + ")"; } } \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/Fact.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/Fact.java similarity index 70% rename from aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/Fact.java rename to aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/Fact.java index 9fe69a9..9d593cd 100644 --- a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/Fact.java +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/Fact.java @@ -13,16 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package priv.alawn.aladmin.modules.idx.domain; +package priv.alawn.aladmin.modules.idx.entity.domain; -//import com.baomidou.mybatisplus.annotation.IdType; -//import com.baomidou.mybatisplus.annotation.TableField; -//import com.baomidou.mybatisplus.annotation.TableId; -//import com.baomidou.mybatisplus.annotation.TableName; -//import com.fasterxml.jackson.annotation.JsonBackReference; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; @@ -50,26 +42,30 @@ import java.util.Objects; public class Fact extends BaseEntity implements Serializable { @Id -// @ApiModelProperty(value = "ID", hidden = true) -// @TableField("fact_id") @Column(name = "fact_id") - @TableId(value = "fact_id",type = IdType.ASSIGN_ID) @NotNull(groups = Update.class) @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "ID", hidden = true) private Long id; // @TableField("fact_code") + @ApiModelProperty(value = "事实代码") private String factCode; + @ApiModelProperty(value = "事实名称") private String factName; - private String factDescription; + @ApiModelProperty(value = "描述") + private String description; + + @ApiModelProperty(value = "度量",hidden = true) // @JsonBackReference -// @OneToMany(mappedBy = "fact") -// private List measures; + @OneToMany(mappedBy = "fact",fetch = FetchType.LAZY,cascade = CascadeType.ALL) + private List measures; // + @ApiModelProperty(value = "属性",hidden = true) // @JsonBackReference -// @OneToMany(mappedBy = "fact") -// private List attributes; + @OneToMany(mappedBy = "fact",fetch = FetchType.LAZY,cascade = CascadeType.ALL) + private List attributes; @Override public boolean equals(Object o) { diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/FactAttribute.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/FactAttribute.java similarity index 82% rename from aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/FactAttribute.java rename to aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/FactAttribute.java index 961516c..9e4776a 100644 --- a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/FactAttribute.java +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/FactAttribute.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package priv.alawn.aladmin.modules.idx.domain; +package priv.alawn.aladmin.modules.idx.entity.domain; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; @@ -42,15 +42,20 @@ public class FactAttribute extends BaseEntity implements Serializable { @GeneratedValue(strategy = GenerationType.IDENTITY) @ApiModelProperty(value = "ID", hidden = true) private Long id; - private String attributeCode; - private String attributeName; - private String attributeDescription; + @ApiModelProperty(value = "属性代码") + protected String attributeCode; + @ApiModelProperty(value = "属性名称") + protected String attributeName; + @ApiModelProperty(value = "属性描述") + protected String description; + + @ApiModelProperty(value="factId",hidden = true) +// @JsonBackReference @ManyToOne @JoinColumn(name = "fact_id") private Fact fact; - @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/Measure.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/FactMeasure.java similarity index 80% rename from aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/Measure.java rename to aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/FactMeasure.java index ed07457..f394b98 100644 --- a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/Measure.java +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/FactMeasure.java @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package priv.alawn.aladmin.modules.idx.domain; +package priv.alawn.aladmin.modules.idx.entity.domain; +import com.fasterxml.jackson.annotation.JsonBackReference; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; @@ -32,20 +33,24 @@ import java.util.Objects; @Entity @Getter @Setter -@Table(name="idx_measure") -public class Measure extends BaseEntity implements Serializable { +@Table(name="idx_fact_measure") +public class FactMeasure extends BaseEntity implements Serializable { @Id - @Column(name = "measure_id") + @Column(name = "fact_measure_id") @NotNull(groups = Update.class) @GeneratedValue(strategy = GenerationType.IDENTITY) @ApiModelProperty(value = "ID", hidden = true) private Long id; + private String measureCode; private String measureName; - private String measureDescription; + private String description; private String measureType; + + @JsonBackReference + @ApiModelProperty(value="factId",hidden = true) @ManyToOne @JoinColumn(name = "fact_id") private Fact fact; @@ -58,7 +63,7 @@ public class Measure extends BaseEntity implements Serializable { if (o == null || getClass() != o.getClass()) { return false; } - Measure obj = (Measure) o; + FactMeasure obj = (FactMeasure) o; return Objects.equals(id, obj.id) && Objects.equals(measureCode, obj.measureCode) ; } diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/Index.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/Index.java similarity index 97% rename from aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/Index.java rename to aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/Index.java index 615fda9..ac28f9d 100644 --- a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/Index.java +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/Index.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package priv.alawn.aladmin.modules.idx.domain; +package priv.alawn.aladmin.modules.idx.entity.domain; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; @@ -42,6 +42,7 @@ public class Index extends BaseEntity implements Serializable { @GeneratedValue(strategy = GenerationType.IDENTITY) @ApiModelProperty(value = "ID", hidden = true) private Long id; + private String indexCode; private String indexName; private String indexType; diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/Model.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/LogicModel.java similarity index 62% rename from aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/Model.java rename to aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/LogicModel.java index 5baa074..4b54415 100644 --- a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/domain/Model.java +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/LogicModel.java @@ -13,11 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package priv.alawn.aladmin.modules.idx.domain; +package priv.alawn.aladmin.modules.idx.entity.domain; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; import lombok.Setter; +import org.hibernate.Hibernate; import priv.alawn.aladmin.base.BaseEntity; import javax.persistence.*; @@ -32,36 +33,37 @@ import java.util.Objects; @Entity @Getter @Setter -@Table(name="idx_model") -public class Model extends BaseEntity implements Serializable { +@Table(name="idx_logic_model") +public class LogicModel extends BaseEntity implements Serializable { @Id - @Column(name = "dimension_id") + @Column(name = "logic_model_id") @NotNull(groups = Update.class) @GeneratedValue(strategy = GenerationType.IDENTITY) @ApiModelProperty(value = "ID", hidden = true) private Long id; - private String dimensionCode; - private String dimensionName; - private String dimensionDescription; - private Boolean indexDimension; - private Boolean timeDimension; + private String modelName; + private String description; + + @ManyToOne + @JoinColumn(name = "fact_id") + private Fact fact; + + @ManyToOne + @JoinColumn(name = "table_definition_id") + private TableDefinition tableDefinition; @Override public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Model obj = (Model) o; - return Objects.equals(id, obj.id) && Objects.equals(dimensionCode, obj.dimensionCode) ; + if (this == o) return true; + if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false; + LogicModel that = (LogicModel) o; + return id != null && Objects.equals(id, that.id); } @Override public int hashCode() { - return Objects.hash(id, dimensionCode); + return getClass().hashCode(); } } \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/TableDefinition.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/TableDefinition.java new file mode 100644 index 0000000..7e57140 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/domain/TableDefinition.java @@ -0,0 +1,67 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.Hibernate; +import priv.alawn.aladmin.base.BaseEntity; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Objects; + +/** + * @author Alawn + * @date 2018-11-22 + */ +@Entity +@Getter +@Setter +@Table(name="idx_table_definition") +public class TableDefinition extends BaseEntity implements Serializable { + + @Id + @Column(name = "table_definition_id") + @NotNull(groups = Update.class) + @GeneratedValue(strategy = GenerationType.IDENTITY) + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + private String tableName; + private String tableDescription; + private String remark; + private String enabled; + private Long dsId; + private String sourceSystem; + private String definitionType; + private Boolean created; + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false; + TableDefinition that = (TableDefinition) o; + return id != null && Objects.equals(id, that.id); + } + + @Override + public int hashCode() { + return getClass().hashCode(); + } +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/DimensionAttributeDto.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/DimensionAttributeDto.java new file mode 100644 index 0000000..0a68c3d --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/DimensionAttributeDto.java @@ -0,0 +1,61 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import priv.alawn.aladmin.base.BaseEntity; + +import java.io.Serializable; + +/** + * @author Alawn + * @date 2018-11-22 + */ + +@ApiModel +@Getter +@Setter +@ToString(callSuper = true) +public class DimensionAttributeDto extends BaseEntity implements Serializable { + + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + private Long dimensionId; + + @ApiModelProperty(value = "属性代码") + protected String attributeCode; + + @ApiModelProperty(value = "属性名称") + protected String attributeName; + + @ApiModelProperty(value = "属性描述") + protected String description; + + @ApiModelProperty(value = "键值属性") + private Boolean keyAttribute; + + @ApiModelProperty(value = "代码属性") + private Boolean codeAttribute; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/DimensionDto.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/DimensionDto.java new file mode 100644 index 0000000..3ce889b --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/DimensionDto.java @@ -0,0 +1,49 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import priv.alawn.aladmin.base.BaseEntity; + +import java.io.Serializable; + +/** + * @author Alawn + * @date 2018-11-22 + */ + +@ApiModel +@Getter +@Setter +@ToString(callSuper = true) +public class DimensionDto extends BaseEntity implements Serializable { + + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + private String dimensionCode; + private String dimensionName; + private String dimensionDescription; + private Boolean indexDimension; + private Boolean timeDimension; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/FactAttributeDto.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/FactAttributeDto.java new file mode 100644 index 0000000..c5f4b54 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/FactAttributeDto.java @@ -0,0 +1,52 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import priv.alawn.aladmin.base.BaseEntity; + +import java.io.Serializable; + +/** + * @author Alawn + * @date 2018-11-22 + */ + +@ApiModel +@Getter +@Setter +@ToString(callSuper = true) +public class FactAttributeDto extends BaseEntity implements Serializable { + + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + @ApiModelProperty(value = "属性代码") + protected String attributeCode; + + @ApiModelProperty(value = "属性名称") + protected String attributeName; + + @ApiModelProperty(value = "属性描述") + protected String description; + + @ApiModelProperty(value="事实ID") + private Long factId; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/FactDto.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/FactDto.java new file mode 100644 index 0000000..58dc29a --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/FactDto.java @@ -0,0 +1,53 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import priv.alawn.aladmin.base.BaseEntity; + +import java.io.Serializable; + +/** + * @author Alawn + * @date 2018-11-22 + */ + +@ApiModel +@Getter +@Setter +@ToString(callSuper = true) +public class FactDto extends BaseEntity implements Serializable { + + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + @ApiModelProperty(value = "事实代码") + private String factCode; + + @ApiModelProperty(value = "事实名称") + private String factName; + + @ApiModelProperty(value = "事实描述") + private String description; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/FactMeasureDto.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/FactMeasureDto.java new file mode 100644 index 0000000..c4ae8be --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/FactMeasureDto.java @@ -0,0 +1,54 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import priv.alawn.aladmin.base.BaseEntity; + +import java.io.Serializable; + +/** + * @author Alawn + * @date 2018-11-22 + */ + +@ApiModel +@Getter +@Setter +@ToString(callSuper = true) +public class FactMeasureDto extends BaseEntity implements Serializable { + + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + @ApiModelProperty(value = "度量代码") + private String measureCode; + + @ApiModelProperty(value = "度量名称") + private String measureName; + + @ApiModelProperty(value = "度量描述") + private String description; + + @ApiModelProperty(value = "度量类型") + private String measureType; + + private Long factId; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/LogicModelDto.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/LogicModelDto.java new file mode 100644 index 0000000..8420962 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/dto/LogicModelDto.java @@ -0,0 +1,46 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import priv.alawn.aladmin.base.BaseDTO; +import priv.alawn.aladmin.base.BaseEntity; + +import java.io.Serializable; + +/** + * @author Alawn + * @date 2018-11-22 + */ +@Getter +@Setter +@ToString(callSuper = true) +public class LogicModelDto extends BaseDTO implements Serializable { + + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + private String modelName; + private String description; + private Long factId; + private Long tableDefinitionId; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/Dimension.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/Dimension.java new file mode 100644 index 0000000..4854201 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/Dimension.java @@ -0,0 +1,57 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.po; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.hibernate.Hibernate; +import priv.alawn.aladmin.base.BaseEntity; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Objects; + +/** + * @author Alawn + * @date 2018-11-22 + */ +@Getter +@Setter +@TableName("idx_dimension") +@ToString(callSuper = true) +public class Dimension extends BaseEntity implements Serializable { + + @TableId(value = "dimension_id",type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + @TableField + private String dimensionCode; + @TableField + private String dimensionName; + @TableField + private String dimensionDescription; + @TableField + private Boolean indexDimension; + @TableField + private Boolean timeDimension; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/DimensionAttribute.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/DimensionAttribute.java new file mode 100644 index 0000000..3d0c1fe --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/DimensionAttribute.java @@ -0,0 +1,67 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.po; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import priv.alawn.aladmin.base.BaseEntity; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @author Alawn + * @date 2018-11-22 + */ +@Getter +@Setter +@TableName("idx_dimension_attribute") +@ToString(callSuper = true) +public class DimensionAttribute extends BaseEntity implements Serializable { + + @TableId(value = "dimension_attribute_id",type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + @TableField + private Long dimensionId; + + @TableField + @ApiModelProperty(value = "属性代码") + protected String attributeCode; + + @TableField + @ApiModelProperty(value = "属性名称") + protected String attributeName; + + @TableField + @ApiModelProperty(value = "属性描述") + protected String description; + + @TableField + @ApiModelProperty(value = "键值属性") + private Boolean keyAttribute; + + @TableField + @ApiModelProperty(value = "代码属性") + private Boolean codeAttribute = false; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/Fact.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/Fact.java new file mode 100644 index 0000000..cadc375 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/Fact.java @@ -0,0 +1,60 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.po; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.hibernate.Hibernate; +import priv.alawn.aladmin.base.BaseEntity; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; +import java.util.Objects; + +/** + * @author Alawn + * @date 2018-11-22 + */ +@Getter +@Setter +@TableName("idx_fact") +@ToString(callSuper = true) +public class Fact extends BaseEntity implements Serializable { + + @TableId(value = "fact_id",type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + @TableField + @ApiModelProperty(value = "事实代码") + private String factCode; + + @TableField + @ApiModelProperty(value = "事实名称") + private String factName; + + @TableField + @ApiModelProperty(value = "描述") + private String description; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/FactAttribute.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/FactAttribute.java new file mode 100644 index 0000000..82d60d1 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/FactAttribute.java @@ -0,0 +1,62 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.po; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.hibernate.Hibernate; +import priv.alawn.aladmin.base.BaseEntity; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Objects; + +/** + * @author Alawn + * @date 2018-11-22 + */ +@Getter +@Setter +@TableName("idx_fact_attribute") +@ToString(callSuper = true) +public class FactAttribute extends BaseEntity implements Serializable { + + @TableId(value = "fact_attribute_id",type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + @TableField + @ApiModelProperty(value = "属性代码") + protected String attributeCode; + + @TableField + @ApiModelProperty(value = "属性名称") + protected String attributeName; + + @TableField + @ApiModelProperty(value = "属性描述") + protected String description; + + @ApiModelProperty(value="factId",hidden = true) + private Long factId; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/FactMeasure.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/FactMeasure.java new file mode 100644 index 0000000..00e0077 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/FactMeasure.java @@ -0,0 +1,60 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.po; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.hibernate.annotations.UpdateTimestamp; +import org.springframework.data.annotation.CreatedBy; +import org.springframework.data.annotation.LastModifiedBy; +import priv.alawn.aladmin.base.BaseEntity; + +import javax.persistence.Column; +import java.io.Serializable; +import java.sql.Timestamp; + +/** + * @author Alawn + * @date 2018-11-22 + */ +@Getter +@Setter +@TableName("idx_fact_measure") +@ToString(callSuper = true) +public class FactMeasure extends BaseEntity implements Serializable { + + @TableId(value = "fact_measure_id",type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + @TableField + private String measureCode; + + @TableField + private String measureName; + + @TableField + private String description; + + @TableField + private String measureType; + + @ApiModelProperty(value="factId",hidden = true) + private Long factId; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/Index.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/Index.java new file mode 100644 index 0000000..3a48616 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/Index.java @@ -0,0 +1,74 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.po; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.hibernate.Hibernate; +import priv.alawn.aladmin.base.BaseEntity; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Objects; + +/** + * @author Alawn + * @date 2018-11-22 + */ +@Getter +@Setter +@TableName("idx_indexes") +@ToString(callSuper = true) +public class Index extends BaseEntity implements Serializable { + + @Id + @TableField(value = "index_id",fill = FieldFill.INSERT) + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + @TableField + private String indexCode; + + @TableField + private String indexName; + + @TableField + private String indexType; + + @TableField + private String indexCategory; + + @TableField + private String indexDescription; + + @TableField + private Boolean enabled; + + @TableField + private Boolean based; + + @TableField + private String indexFolderId; + + @TableField + private String indexCalculeType; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/LogicModel.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/LogicModel.java new file mode 100644 index 0000000..ff55c12 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/LogicModel.java @@ -0,0 +1,59 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.po; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.hibernate.Hibernate; +import priv.alawn.aladmin.base.BaseEntity; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Objects; + +/** + * @author Alawn + * @date 2018-11-22 + */ +@Getter +@Setter +@TableName("idx_logic_model") +@ToString(callSuper = true) +public class LogicModel extends BaseEntity implements Serializable { + + @TableId(value = "logic_model_id",type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + @TableField + private String modelName; + + @TableField + private String description; + + @TableField + private Long factId; + + @TableField + private Long tableDefinitionId; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/TableDefinition.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/TableDefinition.java new file mode 100644 index 0000000..3ba54e0 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/po/TableDefinition.java @@ -0,0 +1,71 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.po; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.hibernate.Hibernate; +import priv.alawn.aladmin.base.BaseEntity; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Objects; + +/** + * @author Alawn + * @date 2018-11-22 + */ +@Getter +@Setter +@TableName("idx_table_definition") +@ToString(callSuper = true) +public class TableDefinition extends BaseEntity implements Serializable { + + @TableId(value = "table_definition_id",type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + @TableField + private String tableName; + + @TableField + private String tableDescription; + + @TableField + private String remark; + + @TableField + private String enabled; + + @TableField + private Long dsId; + + @TableField + private String sourceSystem; + + @TableField + private String definitionType; + + @TableField + private Boolean created; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/vo/DimensionVo.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/vo/DimensionVo.java new file mode 100644 index 0000000..0479925 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/vo/DimensionVo.java @@ -0,0 +1,49 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import priv.alawn.aladmin.base.BaseEntity; +import priv.alawn.aladmin.modules.idx.entity.dto.DimensionAttributeDto; + +import javax.persistence.Entity; +import java.io.Serializable; +import java.util.List; + +/** + * @author Alawn + * @date 2018-11-22 + */ + +@Getter +@Setter +@ToString(callSuper = true) +public class DimensionVo extends BaseEntity implements Serializable { + + @ApiModelProperty(value = "ID", hidden = true) + private Long id; + + private String dimensionCode; + private String dimensionName; + private String dimensionDescription; + private Boolean indexDimension; + private Boolean timeDimension; + + private List attributes; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/vo/FactVo.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/vo/FactVo.java new file mode 100644 index 0000000..d648454 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/vo/FactVo.java @@ -0,0 +1,55 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import priv.alawn.aladmin.base.BaseEntity; +import priv.alawn.aladmin.modules.idx.entity.dto.FactAttributeDto; +import priv.alawn.aladmin.modules.idx.entity.dto.FactMeasureDto; + +import java.io.Serializable; +import java.util.List; + +/** + * @author Alawn + * @date 2018-11-22 + */ + +@Getter +@Setter +@ToString(callSuper = true) +public class FactVo extends BaseEntity implements Serializable { + + private Long id; + + @ApiModelProperty(value = "事实代码") + private String factCode; + + @ApiModelProperty(value = "事实名称") + private String factName; + + @ApiModelProperty(value = "事实描述") + private String description; + + @ApiModelProperty(value = "属性") + List attributes; + + @ApiModelProperty(value = "度量") + List measures; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/vo/LogicModelVo.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/vo/LogicModelVo.java new file mode 100644 index 0000000..51ab0e9 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/entity/vo/LogicModelVo.java @@ -0,0 +1,43 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import priv.alawn.aladmin.base.BaseDTO; +import priv.alawn.aladmin.modules.idx.entity.po.Fact; +import priv.alawn.aladmin.modules.idx.entity.po.TableDefinition; + +import java.io.Serializable; + +/** + * @author Alawn + * @date 2018-11-22 + */ +@Getter +@Setter +@ToString(callSuper = true) +public class LogicModelVo extends BaseDTO implements Serializable { + + @ApiModelProperty(value = "ID", hidden = true) + private Long id ; + private String modelName ; + private String description ; + private Fact fact ; + private TableDefinition tableDefinition ; +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/enums/AttributeTypeEnum.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/enums/AttributeTypeEnum.java new file mode 100644 index 0000000..1cfbd12 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/enums/AttributeTypeEnum.java @@ -0,0 +1,22 @@ +package priv.alawn.aladmin.modules.idx.enums; + + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum AttributeTypeEnum { + + /* 事实 */ + FACT_ATTRIBUTE("FACT", "事实"), + + /* 维度 */ + DIMENSION_ATTRIBUTE("DIMENSION", "维度"), + + /* 模型 */ + MODEL_ATTRIBUTE("MODEL_ATTRIBUTE", "模型"); + + private final String key; + private final String description; +} diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/DimensionAttributeMapper.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/DimensionAttributeMapper.java new file mode 100644 index 0000000..fe9a3a4 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/DimensionAttributeMapper.java @@ -0,0 +1,19 @@ +package priv.alawn.aladmin.modules.idx.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Result; +import org.apache.ibatis.annotations.Select; +import priv.alawn.aladmin.modules.idx.entity.po.Dimension; +import priv.alawn.aladmin.modules.idx.entity.po.DimensionAttribute; + +import java.util.List; + +@Mapper +public interface DimensionAttributeMapper extends BaseMapper { + String tableName = "idx_dimension_attribute"; + + @Result(property = "id",column = "dimension_attribute_id") + @Select("select * from " + tableName + " where dimension_id = #{dimensionId}") + List selectByDimensionId(Long dimensionId) ; +} diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/DimensionMapper.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/DimensionMapper.java new file mode 100644 index 0000000..4711ff8 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/DimensionMapper.java @@ -0,0 +1,9 @@ +package priv.alawn.aladmin.modules.idx.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import priv.alawn.aladmin.modules.idx.entity.po.Dimension; + +@Mapper +public interface DimensionMapper extends BaseMapper { +} diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/FactAttributeMapper.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/FactAttributeMapper.java new file mode 100644 index 0000000..90ef43a --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/FactAttributeMapper.java @@ -0,0 +1,18 @@ +package priv.alawn.aladmin.modules.idx.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.*; +import priv.alawn.aladmin.modules.idx.entity.po.FactAttribute; + +import java.util.List; + +@Mapper +public interface FactAttributeMapper extends BaseMapper { + + String tableName = "idx_fact_attribute"; + +// @Results(value = {@Result(property = "id",column = "fact_attribute_id")}) + @Result(property = "id",column = "fact_attribute_id") + @Select("select * from " + tableName + " where fact_id = #{factId}") + List selectByFactId(Long factId) ; +} diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/FactMapper.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/FactMapper.java index c44ec73..3781365 100644 --- a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/FactMapper.java +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/FactMapper.java @@ -1,29 +1,9 @@ -/* - * Copyright 2019-2020 Alawn - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ package priv.alawn.aladmin.modules.idx.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; -import priv.alawn.aladmin.modules.idx.domain.Fact; - -/** -* @author Alawn -* @date 2019-03-25 -*/ +import priv.alawn.aladmin.modules.idx.entity.po.Fact; @Mapper public interface FactMapper extends BaseMapper { -} \ No newline at end of file +} diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/FactMeasureMapper.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/FactMeasureMapper.java new file mode 100644 index 0000000..a5b228b --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapper/FactMeasureMapper.java @@ -0,0 +1,19 @@ +package priv.alawn.aladmin.modules.idx.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.*; +import priv.alawn.aladmin.modules.idx.entity.po.FactMeasure; + +import java.util.List; + +@Mapper +public interface FactMeasureMapper extends BaseMapper { + + String tableName = "idx_fact_measure"; + + +// @Results(value = {@Result(property = "id",column = "fact_measure_id")}) + @Result(property = "id",column = "fact_measure_id") + @Select("select * from " + tableName + " where fact_id = #{factId}") + List selectByFactId(Long factId) ; +} diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapstruct/DimensionMapping.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapstruct/DimensionMapping.java new file mode 100644 index 0000000..9fb25a4 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapstruct/DimensionMapping.java @@ -0,0 +1,24 @@ +package priv.alawn.aladmin.modules.idx.mapstruct; + +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; +import org.mapstruct.factory.Mappers; +import priv.alawn.aladmin.modules.idx.entity.dto.*; +import priv.alawn.aladmin.modules.idx.entity.po.*; +import priv.alawn.aladmin.modules.idx.entity.vo.DimensionVo; +import priv.alawn.aladmin.modules.idx.entity.vo.FactVo; + +import java.util.List; + +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface DimensionMapping { + DimensionMapping INSTANCE = Mappers.getMapper( DimensionMapping.class ); + + Dimension toEntity(DimensionDto dto); + DimensionAttribute toEntity(DimensionAttributeDto dto); + + List toDimensionVo(List facts) ; + List toAttributeDto(List entity); + + +} diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapstruct/FactMapping.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapstruct/FactMapping.java new file mode 100644 index 0000000..0f232a2 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapstruct/FactMapping.java @@ -0,0 +1,33 @@ +package priv.alawn.aladmin.modules.idx.mapstruct; + +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; +import org.mapstruct.factory.Mappers; +import priv.alawn.aladmin.modules.idx.entity.dto.FactAttributeDto; +import priv.alawn.aladmin.modules.idx.entity.dto.FactDto; +import priv.alawn.aladmin.modules.idx.entity.dto.FactMeasureDto; +import priv.alawn.aladmin.modules.idx.entity.po.Fact; +import priv.alawn.aladmin.modules.idx.entity.po.FactAttribute; +import priv.alawn.aladmin.modules.idx.entity.po.FactMeasure; +import priv.alawn.aladmin.modules.idx.entity.vo.FactVo; + +import java.util.List; + +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface FactMapping { + + FactMapping INSTANCE = Mappers.getMapper( FactMapping.class ); + + Fact toEntity(FactVo vo) ; + Fact toEntity(FactDto dto) ; + FactMeasure toEntity(FactMeasureDto dto) ; + FactAttribute toEntity(FactAttributeDto dto) ; + + +// FactVo toFactVo(Fact fact); + List toFactVo(List facts) ; + List toFactDto(List objs) ; + List toAttributeDto(List objs) ; + List toMeasureDto(List objs) ; + +} diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapstruct/LogicModelMapper.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapstruct/LogicModelMapper.java new file mode 100644 index 0000000..d6f75f7 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/mapstruct/LogicModelMapper.java @@ -0,0 +1,23 @@ +package priv.alawn.aladmin.modules.idx.mapstruct; + +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; +import org.mapstruct.ReportingPolicy; +import org.mapstruct.factory.Mappers; +import priv.alawn.aladmin.base.SuperMapper; +import priv.alawn.aladmin.modules.idx.entity.domain.LogicModel; +import priv.alawn.aladmin.modules.idx.entity.dto.LogicModelDto; + +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +//public interface LogicModelMapper extends SuperMapper { +public interface LogicModelMapper { + + LogicModelMapper INSTANCE = Mappers.getMapper(LogicModelMapper.class); + + @Mappings({ + @Mapping(source="factId" , target="fact.id" ), + @Mapping(source="tableDefinitionId" , target="tableDefinition.id" ) + }) + LogicModel toEntity(LogicModelDto dto); +} diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/DimensionAttributeRepository.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/DimensionAttributeRepository.java new file mode 100644 index 0000000..d9adf7d --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/DimensionAttributeRepository.java @@ -0,0 +1,27 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import priv.alawn.aladmin.modules.idx.entity.domain.DimensionAttribute; + +/** +* @author Alawn +* @date 2019-03-25 +*/ +public interface DimensionAttributeRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/service/FactService.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/DimensionRepository.java similarity index 63% rename from aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/service/FactService.java rename to aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/DimensionRepository.java index 630a4c1..7fe0b6c 100644 --- a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/service/FactService.java +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/DimensionRepository.java @@ -13,25 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package priv.alawn.aladmin.modules.idx.service; +package priv.alawn.aladmin.modules.idx.repository; -import priv.alawn.aladmin.modules.idx.domain.Fact; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import priv.alawn.aladmin.modules.idx.entity.domain.Dimension; /** * @author Alawn * @date 2019-03-25 */ -public interface FactService { - - /** - * 创建 - * @param resources / - */ - void create(Fact resources); - - /** - * 编辑 - * @param resources / - */ - void update(Fact resources); +public interface DimensionRepository extends JpaRepository, JpaSpecificationExecutor { } \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/FactAttributeRepository.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/FactAttributeRepository.java new file mode 100644 index 0000000..0262eba --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/FactAttributeRepository.java @@ -0,0 +1,29 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import priv.alawn.aladmin.modules.idx.entity.domain.FactAttribute; + +/** +* @author Alawn +* @date 2019-03-25 +*/ +public interface FactAttributeRepository extends JpaRepository, JpaSpecificationExecutor { + + FactAttribute findByAttributeCode(String attributeCode); +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/FactMeasureRepository.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/FactMeasureRepository.java new file mode 100644 index 0000000..240247e --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/FactMeasureRepository.java @@ -0,0 +1,29 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import priv.alawn.aladmin.modules.idx.entity.domain.FactMeasure; + +/** +* @author Alawn +* @date 2019-03-25 +*/ +public interface FactMeasureRepository extends JpaRepository, JpaSpecificationExecutor { + + FactMeasure findByMeasureCode(String measureCode); +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/FactRepository.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/FactRepository.java index d548aac..84dfc8b 100644 --- a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/FactRepository.java +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/FactRepository.java @@ -17,7 +17,7 @@ package priv.alawn.aladmin.modules.idx.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; -import priv.alawn.aladmin.modules.idx.domain.Fact; +import priv.alawn.aladmin.modules.idx.entity.domain.Fact; /** * @author Alawn diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/LogicModelRepository.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/LogicModelRepository.java new file mode 100644 index 0000000..c66c0e0 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/repository/LogicModelRepository.java @@ -0,0 +1,27 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import priv.alawn.aladmin.modules.idx.entity.domain.LogicModel; + +/** +* @author Alawn +* @date 2019-03-25 +*/ +public interface LogicModelRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/rest/DimensionController.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/rest/DimensionController.java index d983e47..45c8f36 100644 --- a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/rest/DimensionController.java +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/rest/DimensionController.java @@ -21,14 +21,15 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import priv.alawn.aladmin.annotation.Log; import priv.alawn.aladmin.exception.BadRequestException; -import priv.alawn.aladmin.modules.idx.domain.Fact; -import priv.alawn.aladmin.modules.idx.service.FactService; +import priv.alawn.aladmin.modules.idx.entity.dto.DimensionAttributeDto; +import priv.alawn.aladmin.modules.idx.entity.dto.DimensionDto; +import priv.alawn.aladmin.modules.idx.entity.vo.DimensionVo; +import priv.alawn.aladmin.modules.idx.service.impl.DimensionServiceImpl; + +import java.util.List; /** * @author Alawn @@ -37,21 +38,40 @@ import priv.alawn.aladmin.modules.idx.service.FactService; @RestController @RequiredArgsConstructor @Api(tags = "指标:维度") -@RequestMapping("/api/idx/dim") +@RequestMapping("/api/idx/dimension") public class DimensionController { + private final DimensionServiceImpl dimensionService; +// private static final String ENTITY_NAME = "dept"; - private final FactService factService; - private static final String ENTITY_NAME = "dept"; - - @Log("新增事实") - @ApiOperation("新增事实") + @Log("新增维度") + @ApiOperation("新增维度") @PostMapping // @PreAuthorize("@perm.check('dept:add')") - public ResponseEntity createFact(@Validated @RequestBody Fact resources){ + public ResponseEntity createDimension(@Validated @RequestBody DimensionDto resources){ if (resources.getId() != null) { - throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + throw new BadRequestException("A new dimension cannot already have an ID"); } - factService.create(resources); + dimensionService.createDimension(resources); return new ResponseEntity<>(HttpStatus.CREATED); } + + @Log("新增属性") + @ApiOperation("新增属性") + @PostMapping("/attribute") +// @PreAuthorize("@perm.check('dept:add')") + public ResponseEntity createAttribute(@Validated @RequestBody DimensionAttributeDto resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new dimensionAttribute cannot already have an ID"); + } + dimensionService.createAttribute(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @Log("完整维度清单") + @ApiOperation("完整维度清单") + @GetMapping +// @PreAuthorize("@perm.check('dept:add')") + public ResponseEntity> wholeDimensions(){ + return ResponseEntity.ok(dimensionService.queryWholeDimensions()); + } } \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/rest/FactController.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/rest/FactController.java index c3f36f4..b37e57b 100644 --- a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/rest/FactController.java +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/rest/FactController.java @@ -21,14 +21,20 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import priv.alawn.aladmin.annotation.Log; import priv.alawn.aladmin.exception.BadRequestException; -import priv.alawn.aladmin.modules.idx.domain.Fact; -import priv.alawn.aladmin.modules.idx.service.FactService; +import priv.alawn.aladmin.exception.EntityNotFoundException; +import priv.alawn.aladmin.modules.idx.entity.dto.FactAttributeDto; +import priv.alawn.aladmin.modules.idx.entity.dto.FactDto; +import priv.alawn.aladmin.modules.idx.entity.dto.FactMeasureDto; +import priv.alawn.aladmin.modules.idx.entity.po.Fact; +import priv.alawn.aladmin.modules.idx.entity.vo.FactVo; +import priv.alawn.aladmin.modules.idx.service.impl.FactServiceImpl; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; /** * @author Alawn @@ -37,21 +43,91 @@ import priv.alawn.aladmin.modules.idx.service.FactService; @RestController @RequiredArgsConstructor @Api(tags = "指标:事实") -@RequestMapping("/api/idx/fact") +@RequestMapping("/api/index/fact") public class FactController { - private final FactService factService; - private static final String ENTITY_NAME = "dept"; + private final FactServiceImpl factService; + private static final String ENTITY_NAME = "Fact"; @Log("新增事实") @ApiOperation("新增事实") @PostMapping // @PreAuthorize("@perm.check('dept:add')") - public ResponseEntity createFact(@Validated @RequestBody Fact resources){ + public ResponseEntity createFact(@Validated @RequestBody FactDto resources){ if (resources.getId() != null) { throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); } - factService.create(resources); + factService.createFact(resources); return new ResponseEntity<>(HttpStatus.CREATED); } + + + @Log("删除事实") + @ApiOperation("删除事实") + @DeleteMapping("/{id}") +// @PreAuthorize("@perm.check('dept:add')") + public ResponseEntity deleteFact(@PathVariable Long id){ + if (factService.findFactById(id) == null) { + throw new EntityNotFoundException(Fact.class, "id", id.toString()); + } + factService.deleteFact(id); + return new ResponseEntity<>(HttpStatus.OK); + } + + @Log("修改事实") + @ApiOperation("修改事实") + @PutMapping +// @PreAuthorize("@perm.check('dept:add')") + public ResponseEntity updateFact(@RequestBody Fact resources){ + + if (resources.getId() == null) { + throw new BadRequestException(ENTITY_NAME +" id cannot empty"); + } + + if (factService.findFactById(resources.getId()) == null) { + throw new EntityNotFoundException( Fact.class,"id",resources.getId().toString()); + } + + factService.updateFact(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + + @Log("新增度量") + @ApiOperation("新增度量") + @PostMapping("/measure") +// @PreAuthorize("@perm.check('dept:add')") + public ResponseEntity createMeasure(@Validated @RequestBody FactMeasureDto resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + factService.createMeasure(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @Log("新增属性") + @ApiOperation("新增属性") + @PostMapping("/attribute") +// @PreAuthorize("@perm.check('dept:add')") + public ResponseEntity createAttribute(@Validated @RequestBody FactAttributeDto resources){ + if (resources.getId() != null) { + throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); + } + factService.createAttribute(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @ApiOperation("完整事实清单") + @GetMapping +// @PreAuthorize("@perm.check('dept:add')") + public ResponseEntity> wholeFacts(){ + return ResponseEntity.ok(factService.queryWholeFacts()); + } + + @ApiOperation("查询事实") + @GetMapping("/list") +// @PreAuthorize("@perm.check('dept:add')") + public ResponseEntity> queryFactList() { + return ResponseEntity.ok(factService.queryAllFacts()); + } } \ No newline at end of file diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/service/impl/DimensionServiceImpl.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/service/impl/DimensionServiceImpl.java new file mode 100644 index 0000000..2f7c7e0 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/service/impl/DimensionServiceImpl.java @@ -0,0 +1,99 @@ +/* + * Copyright 2019-2020 Alawn + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package priv.alawn.aladmin.modules.idx.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.stereotype.Service; +import priv.alawn.aladmin.exception.EntityExistException; +import priv.alawn.aladmin.exception.EntityNotFoundException; +import priv.alawn.aladmin.modules.idx.entity.dto.*; +import priv.alawn.aladmin.modules.idx.entity.po.*; +import priv.alawn.aladmin.modules.idx.entity.vo.DimensionVo; +import priv.alawn.aladmin.modules.idx.entity.vo.FactVo; +import priv.alawn.aladmin.modules.idx.mapper.DimensionAttributeMapper; +import priv.alawn.aladmin.modules.idx.mapper.DimensionMapper; +import priv.alawn.aladmin.modules.idx.mapstruct.DimensionMapping; +import priv.alawn.aladmin.modules.idx.mapstruct.FactMapping; + +import java.util.List; + +/** +* @author Alawn +* @date 2022-03-25 +*/ + +@Slf4j +@Service +@RequiredArgsConstructor +@CacheConfig(cacheNames = "dimension") +public class DimensionServiceImpl { + + private final DimensionMapper dimensionMapper; + private final DimensionAttributeMapper attributeMapper; + private final DimensionMapping mapping = DimensionMapping.INSTANCE; + + /** + * 创建维度 + * @param resources + */ + public void createDimension(DimensionDto resources) { + + if (dimensionMapper.selectOne(new QueryWrapper().lambda().eq(Dimension::getDimensionCode,resources.getDimensionCode())) != null) { + throw new EntityExistException(DimensionDto.class, "dimensionCode", resources.getDimensionCode()); + } + dimensionMapper.insert(mapping.toEntity(resources)); + } + + /** + * 创建维度属性 + * @param resources + */ + public void createAttribute(DimensionAttributeDto resources) { + + if(dimensionMapper.selectById(resources.getDimensionId()) == null) { + throw new EntityNotFoundException(DimensionAttributeDto.class, "dimensionId", resources.getDimensionId().toString()); + } + + if (attributeMapper.selectOne(new QueryWrapper().lambda().eq(DimensionAttribute::getAttributeCode,resources.getAttributeCode())) != null) { + throw new EntityExistException(DimensionAttributeDto.class, "attributeCode", resources.getAttributeCode()); + } + + attributeMapper.insert(mapping.toEntity(resources)); + } + + /** + * 查询维度 + * @return 维度列表 + */ + public List queryWholeDimensions() { + List dimensions = dimensionMapper.selectList(null); + log.info("dimensions:{}",dimensions); + + List dimensionVoList = mapping.toDimensionVo(dimensions); + log.info("dimensionVoList:{}",dimensionVoList); + + for(DimensionVo dimension:dimensionVoList) { + dimension.setAttributes(mapping.toAttributeDto(attributeMapper.selectByDimensionId(dimension.getId()))); + } + + log.info("dimensionVoList:{}",dimensionVoList); + return dimensionVoList; + } +} diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/service/impl/FactServiceImpl.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/service/impl/FactServiceImpl.java index 11fa69c..ef62ecb 100644 --- a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/service/impl/FactServiceImpl.java +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/service/impl/FactServiceImpl.java @@ -15,37 +15,141 @@ */ package priv.alawn.aladmin.modules.idx.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.cache.annotation.CacheConfig; import org.springframework.stereotype.Service; -import priv.alawn.aladmin.modules.idx.domain.Fact; +import priv.alawn.aladmin.exception.BadRequestException; +import priv.alawn.aladmin.exception.EntityExistException; +import priv.alawn.aladmin.exception.EntityNotFoundException; +import priv.alawn.aladmin.modules.idx.entity.dto.FactAttributeDto; +import priv.alawn.aladmin.modules.idx.entity.dto.FactDto; +import priv.alawn.aladmin.modules.idx.entity.dto.FactMeasureDto; +import priv.alawn.aladmin.modules.idx.entity.po.Fact; +import priv.alawn.aladmin.modules.idx.entity.po.FactAttribute; +import priv.alawn.aladmin.modules.idx.entity.po.FactMeasure; +import priv.alawn.aladmin.modules.idx.entity.vo.FactVo; +import priv.alawn.aladmin.modules.idx.mapper.FactAttributeMapper; import priv.alawn.aladmin.modules.idx.mapper.FactMapper; -import priv.alawn.aladmin.modules.idx.repository.FactRepository; -import priv.alawn.aladmin.modules.idx.service.FactService; +import priv.alawn.aladmin.modules.idx.mapper.FactMeasureMapper; +import priv.alawn.aladmin.modules.idx.mapstruct.FactMapping; + +import java.util.List; /** * @author Alawn -* @date 2019-03-25 +* @date 2022-03-25 */ @Slf4j @Service @RequiredArgsConstructor @CacheConfig(cacheNames = "fact") -public class FactServiceImpl implements FactService { - private final FactRepository factRepository; - private final FactMapper factMapper; +public class FactServiceImpl { - @Override - public void create(Fact resources) { - log.info("Creating FactService"); -// factRepository.save(resources); - factMapper.insert(resources); + private final FactMapping mapping = FactMapping.INSTANCE; + + private final FactMapper factMapper; + private final FactMeasureMapper factMeasureMapper; + private final FactAttributeMapper factAttributeMapper; + + /** + * 创建事实 + * @param resources + */ + public void createFact(FactDto resources) { + if (factMapper.selectOne(new QueryWrapper().lambda().eq(Fact::getFactCode,resources.getFactCode())) != null) { + throw new EntityExistException(FactDto.class, "factCode", resources.getFactCode()); + } + factMapper.insert(mapping.toEntity(resources)); } - @Override - public void update(Fact resources) { + /** + * 删除事实 + * @param id + */ + public void deleteFact(Long id) { + int rs = factMapper.deleteById(id); + if ( rs < 0) { + throw new EntityNotFoundException(Fact.class, "id", id.toString()); + } + } + /** + * 查找事实 + * @param id + */ + public Fact findFactById(Long id) { + return factMapper.selectById(id); + } + + /** + * 修改事实 + * @param id + */ + public void updateFact(Fact resources) { + factMapper.updateById(resources); + } + + /** + * 创建属性 + * @param resources + */ + public void createAttribute(FactAttributeDto resources) { + // 判重 + if (factAttributeMapper.selectOne(new QueryWrapper().lambda().eq(FactAttribute::getAttributeCode,resources.getAttributeCode())) != null) { + throw new EntityExistException(Fact.class, "attributeCode", resources.getAttributeCode()); + } + + // 判断FactId是否存在 + if (factMapper.selectById(resources.getFactId()) == null) { + throw new EntityNotFoundException(FactMeasureDto.class, "factId", resources.getFactId().toString()); + } + factAttributeMapper.insert(mapping.toEntity(resources)); + } + + + /** + * 创建度量 + * @param resources + */ + public void createMeasure(FactMeasureDto resources) { + + QueryWrapper wp = new QueryWrapper().eq("measure_code",resources.getMeasureCode()); + + /** 判重 **/ +// User user = new User().selectOne(new QueryWrapper().lambda().eq(User::getId, 2)); + + if (factMeasureMapper.selectOne(wp) != null) { + throw new EntityExistException(FactMeasureDto.class, "measureCode", resources.getMeasureCode()); + } + + // 判断FactId是否存在 + if (factMapper.selectById(resources.getFactId()) == null) { + throw new EntityNotFoundException(FactMeasureDto.class, "faceId", resources.getFactId().toString()); + } + factMeasureMapper.insert(mapping.toEntity(resources)); + } + + public List queryWholeFacts(){ + List facts = factMapper.selectList(null); + log.info("facts:{}",facts); + + List factVoList = mapping.toFactVo(facts); + log.info("factVoList:{}",factVoList); + + for(FactVo fact:factVoList) { + fact.setMeasures(mapping.toMeasureDto(factMeasureMapper.selectByFactId(fact.getId()))); + fact.setAttributes(mapping.toAttributeDto(factAttributeMapper.selectByFactId(fact.getId()))); + } + + log.info("factVoList:{}",factVoList); + + return factVoList; + } + + public List queryAllFacts(){ + return mapping.toFactDto(factMapper.selectList(null)); } } diff --git a/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/service/impl/LogicModelServiceImpl.java b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/service/impl/LogicModelServiceImpl.java new file mode 100644 index 0000000..f5e6e31 --- /dev/null +++ b/aladmin-index/src/main/java/priv/alawn/aladmin/modules/idx/service/impl/LogicModelServiceImpl.java @@ -0,0 +1,22 @@ +package priv.alawn.aladmin.modules.idx.service.impl; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.stereotype.Service; +import priv.alawn.aladmin.modules.idx.repository.LogicModelRepository; + +@Slf4j +@Service +@RequiredArgsConstructor +@CacheConfig(cacheNames = "logicModel") +public class LogicModelServiceImpl { + +// @Autowired +// private LogicModelRepository logicModelRepository; +// +// public void createLogicModel(LogicModelDto dto){ +// logicModelRepository.save(LogicModelMapper.INSTANCE.toEntity(dto)); +// } +} diff --git a/aladmin-system/application.pid b/aladmin-system/application.pid new file mode 100644 index 0000000..093397b --- /dev/null +++ b/aladmin-system/application.pid @@ -0,0 +1 @@ +14239 \ No newline at end of file diff --git a/aladmin-system/pom.xml b/aladmin-system/pom.xml index a6e3734..79f38c3 100644 --- a/aladmin-system/pom.xml +++ b/aladmin-system/pom.xml @@ -102,6 +102,10 @@ org.springframework.boot spring-boot-maven-plugin + + priv.alawn.aladmin.Application + + diff --git a/aladmin-system/src/main/java/priv/alawn/aladmin/modules/system/domain/Dept.java b/aladmin-system/src/main/java/priv/alawn/aladmin/modules/system/domain/Dept.java index 66de077..21d52c7 100644 --- a/aladmin-system/src/main/java/priv/alawn/aladmin/modules/system/domain/Dept.java +++ b/aladmin-system/src/main/java/priv/alawn/aladmin/modules/system/domain/Dept.java @@ -83,4 +83,20 @@ public class Dept extends BaseEntity implements Serializable { public int hashCode() { return Objects.hash(id, name); } + + + @Override + public String toString() { + return getClass().getSimpleName() + "(" + + "id = " + getId() + ", " + + "createBy = " + getCreateBy() + ", " + + "updateBy = " + getUpdateBy() + ", " + + "createTime = " + getCreateTime() + ", " + + "updateTime = " + getUpdateTime() + ", " + + "deptSort = " + getDeptSort() + ", " + + "name = " + getName() + ", " + + "enabled = " + getEnabled() + ", " + + "pid = " + getPid() + ", " + + "subCount = " + getSubCount() + ")"; + } } \ No newline at end of file diff --git a/aladmin-system/src/main/java/priv/alawn/aladmin/modules/system/domain/User.java b/aladmin-system/src/main/java/priv/alawn/aladmin/modules/system/domain/User.java index 039ae81..be64ce5 100644 --- a/aladmin-system/src/main/java/priv/alawn/aladmin/modules/system/domain/User.java +++ b/aladmin-system/src/main/java/priv/alawn/aladmin/modules/system/domain/User.java @@ -122,4 +122,26 @@ public class User extends BaseEntity implements Serializable { public int hashCode() { return Objects.hash(id, username); } + + @Override + public String toString() { + return getClass().getSimpleName() + "(" + + "id = " + getId() + ", " + + "createBy = " + getCreateBy() + ", " + + "updateBy = " + getUpdateBy() + ", " + + "createTime = " + getCreateTime() + ", " + + "updateTime = " + getUpdateTime() + ", " + + "dept = " + getDept() + ", " + + "username = " + getUsername() + ", " + + "nickName = " + getNickName() + ", " + + "email = " + getEmail() + ", " + + "phone = " + getPhone() + ", " + + "gender = " + getGender() + ", " + + "avatarName = " + getAvatarName() + ", " + + "avatarPath = " + getAvatarPath() + ", " + + "password = " + getPassword() + ", " + + "enabled = " + getEnabled() + ", " + + "isAdmin = " + getIsAdmin() + ", " + + "pwdResetTime = " + getPwdResetTime() + ")"; + } } \ No newline at end of file diff --git a/aladmin-system/src/main/java/priv/alawn/aladmin/modules/system/rest/UserController.java b/aladmin-system/src/main/java/priv/alawn/aladmin/modules/system/rest/UserController.java index b235102..232bbb9 100644 --- a/aladmin-system/src/main/java/priv/alawn/aladmin/modules/system/rest/UserController.java +++ b/aladmin-system/src/main/java/priv/alawn/aladmin/modules/system/rest/UserController.java @@ -19,6 +19,7 @@ import cn.hutool.core.collection.CollectionUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import priv.alawn.aladmin.modules.system.domain.Dept; import priv.alawn.aladmin.modules.system.domain.User; import priv.alawn.aladmin.modules.system.domain.vo.UserPassVo; @@ -60,6 +61,7 @@ import java.util.stream.Collectors; @RestController @RequestMapping("/api/users") @RequiredArgsConstructor +@Slf4j public class UserController { private final PasswordEncoder passwordEncoder; @@ -109,6 +111,7 @@ public class UserController { @PostMapping @PreAuthorize("@perm.check('user:add')") public ResponseEntity createUser(@Validated @RequestBody User resources){ + log.info("User:{}",resources); checkLevel(resources); // 默认密码 123456 resources.setPassword(passwordEncoder.encode("123456")); diff --git a/aladmin-system/src/main/resources/config/application-dev.yml b/aladmin-system/src/main/resources/config/application-dev.yml index 8c1c7b9..bf830b1 100644 --- a/aladmin-system/src/main/resources/config/application-dev.yml +++ b/aladmin-system/src/main/resources/config/application-dev.yml @@ -5,7 +5,7 @@ spring: db-type: com.alibaba.druid.pool.DruidDataSource # H2 配置 driverClassName: org.h2.Driver - url: jdbc:h2:tcp://localhost:9092/~/.h2/aladmin;NON_KEYWORDS=VALUE,USER;DATABASE_TO_LOWER=TRUE;MODE=MySQL;OLD_INFORMATION_SCHEMA=TRUE + url: jdbc:h2:tcp://localhost:9092/~/.h2/aladmin;NON_KEYWORDS=VALUE,USER;DATABASE_TO_LOWER=TRUE;MODE=MySQL;OLD_INFORMATION_SCHEMA=TRUE;DB_CLOSE_DELAY=-1;FILE_LOCK=SOCKET #;AUTO_SERVER=TRUE;DB_CLOSE_DELAY=-1 username: sa password: sa diff --git a/aladmin-system/src/main/resources/config/application.yml b/aladmin-system/src/main/resources/config/application.yml index acf048f..c558a61 100644 --- a/aladmin-system/src/main/resources/config/application.yml +++ b/aladmin-system/src/main/resources/config/application.yml @@ -31,7 +31,7 @@ spring: database: ${REDIS_DB:0} host: ${REDIS_HOST:127.0.0.1} port: ${REDIS_PORT:6379} - password: ${REDIS_PWD:} + password: ${REDIS_PWD:Newland15%} #连接超时时间 timeout: 5000 diff --git a/aladmin-system/src/test/java/priv/alawn/aladmin/IndexTests.java b/aladmin-system/src/test/java/priv/alawn/aladmin/IndexTests.java new file mode 100644 index 0000000..a0ec7f4 --- /dev/null +++ b/aladmin-system/src/test/java/priv/alawn/aladmin/IndexTests.java @@ -0,0 +1,30 @@ +package priv.alawn.aladmin; + + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import priv.alawn.aladmin.modules.idx.service.impl.LogicModelServiceImpl; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class IndexTests { + + @Autowired + LogicModelServiceImpl logicModelService; + + @Test + public void testLogicModelService() { +// LogicModelDto dto = new LogicModelDto(); +// dto.setDescription("描述"); +// dto.setModelName("模型名称"); +// dto.setFactId(1000l); +// dto.setTableDefinitionId(2l); +// +// logicModelService.createLogicModel(dto); + } + + public static void main(String[] args) { + } + + +} diff --git a/aladmin-system/src/test/java/priv/alawn/aladmin/PasswordEncoderTests.java b/aladmin-system/src/test/java/priv/alawn/aladmin/PasswordEncoderTests.java new file mode 100644 index 0000000..a75740f --- /dev/null +++ b/aladmin-system/src/test/java/priv/alawn/aladmin/PasswordEncoderTests.java @@ -0,0 +1,28 @@ +package priv.alawn.aladmin; + +import org.aspectj.lang.annotation.Before; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.crypto.password.StandardPasswordEncoder; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class PasswordEncoderTests { + +// @Autowired + private PasswordEncoder passwordEncoder; + String rawPassword = "admin1"; + String secret = "my-secret-key"; + + @Before("") + public void initPasswordEncoder(){ + System.out.println("initPasswordEncoder"); + } + + @Test + public void testPassword() { + passwordEncoder = new StandardPasswordEncoder(secret); + String encryptedPassword = passwordEncoder.encode(rawPassword); + System.out.println("Password:" + encryptedPassword); + } +} diff --git a/nohup.out b/nohup.out new file mode 100644 index 0000000..412a987 --- /dev/null +++ b/nohup.out @@ -0,0 +1,76 @@ +[INFO] Scanning for projects... +[INFO] +[INFO] ---------------------< priv.alawn:aladmin-system >---------------------- +[INFO] Building 核心模块 1.0 +[INFO] --------------------------------[ jar ]--------------------------------- +[INFO] +[INFO] --- spring-boot-maven-plugin:2.7.3:start (default-cli) @ aladmin-system --- +[INFO] Attaching agents: [] +SLF4J: Class path contains multiple SLF4J bindings. +SLF4J: Found binding in [jar:file:/Users/alawn/.m2/repository/ch/qos/logback/logback-classic/1.2.9/logback-classic-1.2.9.jar!/org/slf4j/impl/StaticLoggerBinder.class] +SLF4J: Found binding in [jar:file:/Users/alawn/.m2/repository/org/slf4j/slf4j-simple/1.7.36/slf4j-simple-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class] +SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. +SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder] + _ _ _ + | | | | (_) + ___| |______ __ _ __| |_ __ ___ _ _ __ + / _ | |______/ _` |/ _` | '_ ` _ \| | '_ \ + | __| | | (_| | (_| | | | | | | | | | | + \___|_| \__,_|\__,_|_| |_| |_|_|_| |_| + + :: Spring Boot :: (v2.6.4) +admin- 2022-10-26 10:58:05 [main] INFO  priv.alawn.aladmin.Application - Starting Application using Java 18.0.2 on mbp.local with PID 14239 (/Users/alawn/Workspace/aladmin/aladmin-system/target/classes started by alawn in /Users/alawn/Workspace/aladmin/aladmin-system) +admin- 2022-10-26 10:58:05 [main] INFO  priv.alawn.aladmin.Application - The following 1 profile is active: "dev" +admin- 2022-10-26 10:58:08 [main] INFO  o.s.d.r.c.RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode +admin- 2022-10-26 10:58:08 [main] INFO  o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data JPA repositories in DEFAULT mode. +admin- 2022-10-26 10:58:08 [main] INFO  o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 370 ms. Found 28 JPA repository interfaces. +admin- 2022-10-26 10:58:09 [main] INFO  o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port(s): 8000 (http) +admin- 2022-10-26 10:58:09 [main] INFO  o.a.coyote.http11.Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8000"] +admin- 2022-10-26 10:58:09 [main] INFO  o.a.catalina.core.StandardService - Starting service [Tomcat] +admin- 2022-10-26 10:58:09 [main] INFO  o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.65] +admin- 2022-10-26 10:58:10 [main] INFO  o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext +admin- 2022-10-26 10:58:10 [main] INFO  o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 4078 ms +admin- 2022-10-26 10:58:10 [main] INFO  c.a.d.s.b.a.DruidDataSourceAutoConfigure - Init DruidDataSource +admin- 2022-10-26 10:58:11 [main] INFO  c.alibaba.druid.pool.DruidDataSource - {dataSource-1} inited +admin- 2022-10-26 10:58:11 [main] INFO  o.h.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [name: default] +admin- 2022-10-26 10:58:11 [main] INFO  org.hibernate.Version - HHH000412: Hibernate ORM core version 5.6.10.Final +admin- 2022-10-26 10:58:11 [main] INFO  o.h.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {5.1.2.Final} +admin- 2022-10-26 10:58:11 [main] INFO  org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect +admin- 2022-10-26 10:58:13 [main] INFO  o.h.e.t.j.p.i.JtaPlatformInitiator - HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] +admin- 2022-10-26 10:58:13 [main] INFO  o.s.o.j.LocalContainerEntityManagerFactoryBean - Initialized JPA EntityManagerFactory for persistence unit 'default' +admin- 2022-10-26 10:58:14 [main] INFO  org.quartz.impl.StdSchedulerFactory - Using default implementation for ThreadExecutor +admin- 2022-10-26 10:58:14 [main] INFO  o.quartz.core.SchedulerSignalerImpl - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl +admin- 2022-10-26 10:58:14 [main] INFO  org.quartz.core.QuartzScheduler - Quartz Scheduler v.2.3.2 created. +admin- 2022-10-26 10:58:14 [main] INFO  org.quartz.simpl.RAMJobStore - RAMJobStore initialized. +admin- 2022-10-26 10:58:14 [main] INFO  org.quartz.core.QuartzScheduler - Scheduler meta-data: Quartz Scheduler (v2.3.2) 'quartzScheduler' with instanceId 'NON_CLUSTERED' + Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. + NOT STARTED. + Currently in standby mode. + Number of jobs executed: 0 + Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. + Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. + +admin- 2022-10-26 10:58:14 [main] INFO  org.quartz.impl.StdSchedulerFactory - Quartz scheduler 'quartzScheduler' initialized from an externally provided properties instance. +admin- 2022-10-26 10:58:14 [main] INFO  org.quartz.impl.StdSchedulerFactory - Quartz scheduler version: 2.3.2 +admin- 2022-10-26 10:58:14 [main] INFO  org.quartz.core.QuartzScheduler - JobFactory set to: org.springframework.scheduling.quartz.SpringBeanJobFactory@2a9eb44d + _ _ |_ _ _|_. ___ _ | _ +| | |\/|_)(_| | |_\ |_)||_|_\ + / | + 3.5.2 +admin- 2022-10-26 10:58:16 [main] INFO  o.s.s.web.DefaultSecurityFilterChain - Will secure any request with [org.springframework.security.web.session.DisableEncodeUrlFilter@5398fac2, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@37884b27, org.springframework.security.web.context.SecurityContextPersistenceFilter@7b6419dd, org.springframework.security.web.header.HeaderWriterFilter@68d21554, org.springframework.security.web.authentication.logout.LogoutFilter@53b52f30, org.springframework.web.filter.CorsFilter@774c5e5c, priv.alawn.aladmin.modules.security.security.TokenFilter@8749c08, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@776a3e76, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@54856056, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@5e56f24c, org.springframework.security.web.session.SessionManagementFilter@623c62b9, org.springframework.security.web.access.ExceptionTranslationFilter@16be6b36, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@4c93cf28] +admin- 2022-10-26 10:58:16 [main] INFO  p.alawn.aladmin.config.RedisConfig - 初始化 -> [Redis CacheErrorHandler] +admin- 2022-10-26 10:58:17 [main] INFO  o.a.coyote.http11.Http11NioProtocol - Starting ProtocolHandler ["http-nio-8000"] +admin- 2022-10-26 10:58:17 [main] INFO  o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port(s): 8000 (http) with context path '' +admin- 2022-10-26 10:58:18 [main] INFO  o.s.s.quartz.SchedulerFactoryBean - Starting Quartz Scheduler now +admin- 2022-10-26 10:58:18 [main] INFO  org.quartz.core.QuartzScheduler - Scheduler quartzScheduler_$_NON_CLUSTERED started. +admin- 2022-10-26 10:58:18 [main] INFO  priv.alawn.aladmin.Application - Started Application in 13.647 seconds (JVM running for 15.102) +admin- 2022-10-26 10:58:18 [main] INFO  p.a.a.m.quartz.config.JobRunner - Timing task injection complete +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD SUCCESS +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 18.033 s +[INFO] Finished at: 2022-10-26T10:58:19+08:00 +[INFO] ------------------------------------------------------------------------ +admin- 2022-10-26 10:59:15 [http-nio-8000-exec-1] INFO  o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring DispatcherServlet 'dispatcherServlet' +admin- 2022-10-26 10:59:15 [http-nio-8000-exec-1] INFO  o.s.web.servlet.DispatcherServlet - Initializing Servlet 'dispatcherServlet' +admin- 2022-10-26 10:59:15 [http-nio-8000-exec-1] INFO  o.s.web.servlet.DispatcherServlet - Completed initialization in 2 ms diff --git a/pom.xml b/pom.xml index 60740c9..7350e87 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ 1.2.83 1.2.9 2.11.1 - 1.4.2.Final + 1.5.2.Final 2.1.214 3.5.2 4.5 @@ -48,7 +48,7 @@ com.baomidou mybatis-plus-boot-starter - ${mybatis-plus.version}> + ${mybatis-plus.version} javax.persistence diff --git a/sql/aladmin.index.h2.sql b/sql/aladmin.index.h2.sql index fba8ab9..3af83b0 100644 --- a/sql/aladmin.index.h2.sql +++ b/sql/aladmin.index.h2.sql @@ -1,125 +1,150 @@ -SET MODE MYSQL; -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; +set mode mysql; +set names utf8mb4; +set foreign_key_checks = 0; -- auto-generated definition -create table IDX_DIMENSION +drop table if exists idx_dimension; +create table if not exists idx_dimension ( - DIMENSION_ID BIGINT auto_increment - primary key, - CREATE_BY CHARACTER, - CREATE_TIME TIMESTAMP, - UPDATE_BY CHARACTER, - UPDATE_TIME TIMESTAMP, - DIMENSION_CODE CHARACTER, - DIMENSION_DESCRIPTION CHARACTER, - DIMENSION_NAME CHARACTER, - INDEX_DIMENSION BOOLEAN, - TIME_DIMENSION BOOLEAN + dimension_id bigint auto_increment primary key, + create_by varchar(500), + create_time timestamp, + update_by varchar(500), + update_time timestamp, + dimension_code varchar(500), + dimension_description varchar(500), + dimension_name varchar(500), + index_dimension boolean, + time_dimension boolean ); -create table IDX_DIMENSION_ATTRIBUTE +drop table if exists idx_dimension_attribute; +create table if not exists idx_dimension_attribute ( - DIMENSION_ATTRIBUTE_ID BIGINT auto_increment - primary key, - CREATE_BY CHARACTER, - CREATE_TIME TIMESTAMP, - UPDATE_BY CHARACTER, - UPDATE_TIME TIMESTAMP, - ATTRIBUTE_CODE CHARACTER, - ATTRIBUTE_DESCRIPTION CHARACTER, - ATTRIBUTE_NAME CHARACTER, - CODE_ATTRIBUTE BOOLEAN, - KEY_ATTRIBUTE BOOLEAN, - DIMENSION_ID BIGINT, - constraint FK3PC4BATJ2JBLUJNRUHGFIV63G - foreign key (DIMENSION_ID) references IDX_DIMENSION + dimension_attribute_id bigint auto_increment primary key, + create_by varchar(500), + create_time timestamp, + update_by varchar(500), + update_time timestamp, + attribute_code varchar(500), + attribute_name varchar(500), + description varchar(500), + code_attribute boolean, + key_attribute boolean, + dimension_id bigint ); -create table IDX_FACT +drop table if exists idx_fact; +create table if not exists idx_fact ( - FACT_ID BIGINT auto_increment - primary key, - CREATE_BY CHARACTER, - CREATE_TIME TIMESTAMP, - UPDATE_BY CHARACTER, - UPDATE_TIME TIMESTAMP, - FACT_CODE CHARACTER, - FACT_DESCRIPTION CHARACTER, - FACT_NAME CHARACTER + fact_id bigint auto_increment primary key, + create_by varchar(500), + create_time timestamp, + update_by varchar(500), + update_time timestamp, + fact_code varchar(500), + description varchar(500), + fact_name varchar(500) ); -create table IDX_FACT_ATTRIBUTE +drop table if exists idx_fact_attribute; +create table if not exists idx_fact_attribute ( - FACT_ATTRIBUTE_ID BIGINT auto_increment - primary key, - CREATE_BY CHARACTER, - CREATE_TIME TIMESTAMP, - UPDATE_BY CHARACTER, - UPDATE_TIME TIMESTAMP, - ATTRIBUTE_CODE CHARACTER, - ATTRIBUTE_DESCRIPTION CHARACTER, - ATTRIBUTE_NAME CHARACTER, - FACT_ID BIGINT, - constraint FKS9HIC1SGFVP7J0NTA5LIOECD3 - foreign key (FACT_ID) references IDX_FACT + fact_attribute_id bigint auto_increment primary key, + create_by varchar(500), + create_time timestamp, + update_by varchar(500), + update_time timestamp, + attribute_code varchar(500), + attribute_name varchar(500), + description varchar(500), + fact_id bigint ); -create table IDX_INDEXES +drop table if exists idx_indexes; +create table if not exists idx_indexes ( - INDEX_ID BIGINT auto_increment - primary key, - CREATE_BY CHARACTER, - CREATE_TIME TIMESTAMP, - UPDATE_BY CHARACTER, - UPDATE_TIME TIMESTAMP, - BASED BOOLEAN, - ENABLED BOOLEAN, - INDEX_CALCULE_TYPE CHARACTER, - INDEX_CATEGORY CHARACTER, - INDEX_CODE CHARACTER, - INDEX_DESCRIPTION CHARACTER, - INDEX_FOLDER_ID CHARACTER, - INDEX_NAME CHARACTER, - INDEX_TYPE CHARACTER + index_id bigint auto_increment primary key, + create_by varchar(500), + create_time timestamp, + update_by varchar(500), + update_time timestamp, + based boolean, + enabled boolean, + index_calcule_type varchar(500), + index_category varchar(500), + index_code varchar(500), + index_description varchar(500), + index_folder_id varchar(500), + index_name varchar(500), + index_type varchar(500) ); -create table IDX_MEASURE +drop table if exists idx_fact_measure; +create table if not exists idx_fact_measure ( - MEASURE_ID BIGINT auto_increment - primary key, - CREATE_BY CHARACTER, - CREATE_TIME TIMESTAMP, - UPDATE_BY CHARACTER, - UPDATE_TIME TIMESTAMP, - MEASURE_CODE CHARACTER, - MEASURE_DESCRIPTION CHARACTER, - MEASURE_NAME CHARACTER, - MEASURE_TYPE CHARACTER, - FACT_ID BIGINT, - constraint FK5LVBNRVJGJLN15PQ2C37FLEYJ - foreign key (FACT_ID) references IDX_FACT + fact_measure_id bigint auto_increment primary key, + measure_code varchar(10), + measure_name varchar(1000), + description varchar(1000), + measure_type varchar(10), + fact_id bigint, + create_by varchar(100), + create_time timestamp, + update_by varchar(100), + update_time timestamp ); -create table IDX_MODEL +drop table if exists idx_logic_model; +create table if not exists idx_logic_model ( - DIMENSION_ID BIGINT auto_increment - primary key, - CREATE_BY CHARACTER, - CREATE_TIME TIMESTAMP, - UPDATE_BY CHARACTER, - UPDATE_TIME TIMESTAMP, - DIMENSION_CODE CHARACTER, - DIMENSION_DESCRIPTION CHARACTER, - DIMENSION_NAME CHARACTER, - INDEX_DIMENSION BOOLEAN, - TIME_DIMENSION BOOLEAN + logic_model_id bigint auto_increment primary key comment '物理主键', + model_name varchar(255) null, + description varchar(255) null, + fact_id bigint(30) null, + table_definition_id bigint(30) null, + create_by varchar(255) null, + create_time timestamp, + update_by varchar(255) null, + update_time timestamp +); + +drop table if exists idx_table_definition; +create table if not exists idx_table_definition +( + table_definition_id bigint auto_increment primary key comment '物理主键', + table_name varchar(255) null, + table_description varchar(255) null, + remark varchar(255) null, + enabled varchar(255) null, + ds_id bigint(30) null, + source_system varchar(255) null, + difinition_type varchar(255) null, + created tinyint(1) null, + create_by varchar(255) null, + create_time timestamp, + update_by varchar(255) null, + update_time timestamp ); -BEGIN; -COMMIT; -SET FOREIGN_KEY_CHECKS = 1; +begin; +commit; +set foreign_key_checks = 1; + + +-- insert into public.idx_dimension (dimension_id, create_by, create_time, update_by, update_time, dimension_code, dimension_description, dimension_name, index_dimension, time_dimension) values (1, 'admin', null, null, null, 'RPT_BUS_ORG_CD_D', '机构', '机构', false, false); +-- insert into public.idx_dimension (dimension_id, create_by, create_time, update_by, update_time, dimension_code, dimension_description, dimension_name, index_dimension, time_dimension) values (2, 'admin', null, null, null, 'RPT_BUSINESS_LINE_ID_D', '条线', '条线', false, false); +-- insert into public.idx_dimension (dimension_id, create_by, create_time, update_by, update_time, dimension_code, dimension_description, dimension_name, index_dimension, time_dimension) values (3, 'admin', null, null, null, 'RPT_MIS_PROD_ID_D', '产品', '产品', false, false); +-- insert into public.idx_dimension (dimension_id, create_by, create_time, update_by, update_time, dimension_code, dimension_description, dimension_name, index_dimension, time_dimension) values (4, 'admin', null, null, null, 'RPT_ADJ_TYPE_D', '调整类型', '调整类型', false, false); +-- insert into public.idx_dimension (dimension_id, create_by, create_time, update_by, update_time, dimension_code, dimension_description, dimension_name, index_dimension, time_dimension) values (5, 'admin', null, null, null, 'RPT_BUS_ORG_CD_d', '机构', '机构', false, false); +-- insert into public.idx_dimension (dimension_id, create_by, create_time, update_by, update_time, dimension_code, dimension_description, dimension_name, index_dimension, time_dimension) values (6, 'admin', null, null, null, 'RPT_CCY_CD_D', '币种', '币种', false, false); +-- insert into public.idx_dimension (dimension_id, create_by, create_time, update_by, update_time, dimension_code, dimension_description, dimension_name, index_dimension, time_dimension) values (7, 'admin', null, null, null, 'RPT_PERIOD_CODe_d', '期间', '期间', false, false); +-- insert into public.idx_dimension (dimension_id, create_by, create_time, update_by, update_time, dimension_code, dimension_description, dimension_name, index_dimension, time_dimension) values (8, 'admin', null, null, null, 'RPT_INDEX_D', '指标', '指标', false, false); +-- insert into public.idx_dimension (dimension_id, create_by, create_time, update_by, update_time, dimension_code, dimension_description, dimension_name, index_dimension, time_dimension) values (9, 'admin', null, null, null, 'RPT_BUS_ORG_CD_ori_d', '原始机构', '原始机构', false, false); +-- insert into public.idx_dimension (dimension_id, create_by, create_time, update_by, update_time, dimension_code, dimension_description, dimension_name, index_dimension, time_dimension) values (10, 'admin', null, null, null, 'RPT_DESK_D', 'DESK', 'DESK', false, false); +-- insert into public.idx_dimension (dimension_id, create_by, create_time, update_by, update_time, dimension_code, dimension_description, dimension_name, index_dimension, time_dimension) values (11, 'admin', null, null, null, 'GRM_ORG_CODE', 'GRM机构', 'GRM机构', false, false); +-- insert into public.idx_dimension (dimension_id, create_by, create_time, update_by, update_time, dimension_code, dimension_description, dimension_name, index_dimension, time_dimension) values (12, 'admin', null, null, null, 'RPT_DATE_D', '日期', '日期', false, false); diff --git a/startApp.sh b/startApp.sh new file mode 100755 index 0000000..67cbb02 --- /dev/null +++ b/startApp.sh @@ -0,0 +1,13 @@ +#. ./startKit.sh + +pid=`lsof -i tcp:8000 | sed -n '2,2p' | awk '{print $2}'` + +if [ "$pid" != "" ];then + kill -9 $pid + echo $pid has been killed +fi + +cd aladmin-system && mvn spring-boot:start > ../nohup.out + + + diff --git a/stopApp.sh b/stopApp.sh new file mode 100755 index 0000000..c84d07f --- /dev/null +++ b/stopApp.sh @@ -0,0 +1,32 @@ +#pid=$(ps -ef | grep h2.sh | grep -v ag | grep -v grep | awk '{print $2}') +# +# +#if [ "$pid" != "" ]; then +# echo "\n\033[1;31mh2.sh($pid) has been killed\033[0m" +# kill -9 $pid +#fi +# +#pid=$(ps -ef | grep org.h2.tools.Console | grep -v ag | grep -v grep | awk '{print $2}') +#if [ "$pid" != "" ]; then +# echo "\033[1;31mh2.console($pid) has been killed\033[0m" +# kill -9 $pid +#fi +# +#pid=$(ps -ef | grep redis-server | grep -v ag | grep -v grep | awk '{print $2}') +# +# +#if [ "$pid" != "" ]; then +# echo "\033[1;31mredis-server($pid) has been killed\033[0m" +# kill -9 $pid +#fi + + + + +pid=`lsof -i tcp:8000 | sed -n '2,2p' | awk '{print $2}'` + +if [ "$pid" != "" ];then + kill -9 $pid + echo $pid has been killed +fi + diff --git a/stopKit.sh b/stopKit.sh new file mode 100755 index 0000000..19e28fe --- /dev/null +++ b/stopKit.sh @@ -0,0 +1,35 @@ +pid=$(ps -ef | grep h2.sh | grep -v ag | grep -v grep | awk '{print $2}') + +if [ "$pid" != "" ]; then + echo "\n\033[1;32mh2.sh($pid) has been killed\033[0m" + kill -9 $pid +fi + +pid=$(ps -ef | grep org.h2.tools.Console | grep -v ag | grep -v grep | awk '{print $2}') +if [ "$pid" != "" ]; then + echo "\033[1;32mh2.console($pid) has been killed\033[0m" + kill -9 $pid +fi + +# h2 > /dev/null & + +# pid=$(ps -ef | grep h2.sh | grep -v ag | grep -v grep | awk '{print $2}') + +# echo "\033[1;32mh2($pid) started \033[0m\n" + +pid=$(ps -ef | grep redis-server | grep -v ag | grep -v grep | awk '{print $2}') + + +if [ "$pid" != "" ]; then + echo "\033[1;32mredis-server($pid) has been killed\033[0m" + kill -9 $pid +fi + +echo "" + +# redis-server /usr/local/etc/redis.conf > /dev/null & + +# pid=$(ps -ef | grep redis-server | grep -v ag | grep -v grep | awk '{print $2}') +# echo "\033[1;32mredis-server($pid) started \033[0m\n" + +