表单约束管理

yun-zuoyi
汪云昊 5 years ago
parent 674771de68
commit a3ecc3132f

@ -1,9 +1,6 @@
package cn.estsh.i3plus.pojo.base.enumutil;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
/**
* @Description :
@ -825,6 +822,170 @@ public class BlockFormEnumUtil {
/**
*
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ELEMENT_DELETE_WEAK_STATUS {
ON(1, "ON", "开启"),
OFF(2, "OFF", "关闭");
private int value;
private String code;
private String description;
private ELEMENT_DELETE_WEAK_STATUS(int value, String code, String description) {
this.value = value;
this.code = code;
this.description = description;
}
public int getValue() {
return value;
}
public String getCode() {
return code;
}
public String getDescription() {
return description;
}
public static String valueOfCode(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].code;
}
}
return tmp;
}
public static int codeOfValue(String code) {
int tmp = 1;
for (int i = 0; i < values().length; i++) {
if (values()[i].code.equals(code)) {
tmp = values()[i].value;
}
}
return tmp;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
public static ELEMENT_DELETE_WEAK_STATUS valueOf(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
return values()[i];
}
}
return null;
}
public static String codeOfDescription(String code) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].code.equals(code)) {
tmp = values()[i].description;
}
}
return tmp;
}
}
/**
*
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ELEMENT_VALID_STATUS {
ON(1, "ON", "开启"),
OFF(2, "OFF", "关闭");
private int value;
private String code;
private String description;
private ELEMENT_VALID_STATUS(int value, String code, String description) {
this.value = value;
this.code = code;
this.description = description;
}
public int getValue() {
return value;
}
public String getCode() {
return code;
}
public String getDescription() {
return description;
}
public static String valueOfCode(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].code;
}
}
return tmp;
}
public static int codeOfValue(String code) {
int tmp = 1;
for (int i = 0; i < values().length; i++) {
if (values()[i].code.equals(code)) {
tmp = values()[i].value;
}
}
return tmp;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
public static ELEMENT_VALID_STATUS valueOf(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
return values()[i];
}
}
return null;
}
public static String codeOfDescription(String code) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].code.equals(code)) {
tmp = values()[i].description;
}
}
return tmp;
}
}
/**
*
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@ -1925,4 +2086,51 @@ public class BlockFormEnumUtil {
}
}
/**
*
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ELEMENT_CONSTRAINT_TYPE {
UNIQUE(10, "唯一约束");
// 后续扩展联合主键
// PRIMARY_KEY(20, "主键约束")
private int value;
private String description;
private ELEMENT_CONSTRAINT_TYPE (int value, String description) {
this.value = value;
this.description = description;
}
public int getValue() {
return value;
}
public String getDescription() {
return description;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
public static ELEMENT_CONSTRAINT_TYPE valueOf(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
return values()[i];
}
}
return null;
}
}
}

@ -142,4 +142,8 @@ public class BfElement extends BaseBean {
@Transient
@ApiParam(value = "元素虚拟属性信息")
private List<BfElementPropertyVirtual> propertyVirtualList;
@Transient
@ApiParam(value = "元素约束信息")
private List<BfElementConstraint> constraintList;
}

@ -0,0 +1,61 @@
package cn.estsh.i3plus.pojo.form.bean;
import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.BlockFormEnumUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* @Description :
* @Reference :
* @Author : yunhao
* @CreateDate : 2020-03-12 13:36
* @Modify:
**/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "BF_ELEMENT_CONSTRAINT")
@Api(value = "元素约束", description = "元素约束")
public class BfElementConstraint extends BaseBean {
@Column(name = "ELEMENT_ID")
@ApiParam(value = "对象元素ID", example = "-1")
@JsonSerialize(using = ToStringSerializer.class)
private Long elementId;
@Column(name = "CONSTRAINT_NAME")
@ApiParam(value = "约束名称")
private String constraintName;
@Column(name = "CONSTRAINT_TYPE")
@ApiParam(value = "约束类型")
@AnnoOutputColumn(refClass = BlockFormEnumUtil.ELEMENT_CONSTRAINT_TYPE.class)
private Integer constraintType;
@Column(name = "CONSTRAIN_PROPERTY_NAME_RDD")
@ApiParam(value = "约束属性")
private String constrainPropertyNameRdd;
@Column(name = "CONSTRAIN_PROPERTY_IDS")
@ApiParam(value = "约束属性ids")
private String constrainPropertyIds;
// @Transient
// @ApiParam(value = "元素约束属性信息")
// private List<BfElementConstraintProperty> constraintPropertyList;
}

@ -0,0 +1,56 @@
//package cn.estsh.i3plus.pojo.form.bean;
//
//import cn.estsh.i3plus.pojo.base.bean.BaseBean;
//import com.fasterxml.jackson.databind.annotation.JsonSerialize;
//import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiParam;
//import lombok.Data;
//import lombok.EqualsAndHashCode;
//import org.hibernate.annotations.DynamicInsert;
//import org.hibernate.annotations.DynamicUpdate;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//
///**
// * @Description : 元素约束属性
// * @Reference :
// * @Author : yunhao
// * @CreateDate : 2020-03-12 13:36
// * @Modify:
// **/
//@Data
//@Entity
//@DynamicInsert
//@DynamicUpdate
//@EqualsAndHashCode(callSuper = true)
//@Table(name = "BF_ELEMENT_CONSTRAINT_PROPERTY")
//@Api(value = "元素约束属性", description = "元素约束属性")
//public class BfElementConstraintProperty extends BaseBean {
//
// @Column(name = "CONSTRAINT_ID")
// @ApiParam(value = "约束ID", example = "-1")
// @JsonSerialize(using = ToStringSerializer.class)
// private Long constraintId;
//
// @Column(name = "ELEMENT_PROPERTY_ID")
// @ApiParam(value = "元素属性ID", example = "-1")
// @JsonSerialize(using = ToStringSerializer.class)
// private Long elementPropertyId;
//
// @Column(name = "DATA_OBJECT_PROPERTY_ID")
// @ApiParam(value = "数据对象属性ID", example = "-1")
// @JsonSerialize(using = ToStringSerializer.class)
// private Long dataObjectPropertyId;
//
// @Column(name="PROPERTY_NAME")
// @ApiParam(value ="元素属性名称")
// private String propertyName;
//
// @Column(name="PROPERTY_CODE_RDD")
// @ApiParam(value ="元素属性代码")
// private String propertyCodeRdd;
//
//}

@ -0,0 +1,14 @@
//package cn.estsh.i3plus.pojo.form.repository;
//
//import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
//import cn.estsh.i3plus.pojo.form.bean.BfElementConstraintProperty;
//
///**
// * @Description : 元素约束属性
// * @Reference :
// * @Author : yunhao
// * @CreateDate : 2019-03-21 20:27
// * @Modify:
// **/
//public interface BfElementConstraintPropertyRepository extends BaseRepository<BfElementConstraintProperty, Long> {
//}

@ -0,0 +1,14 @@
package cn.estsh.i3plus.pojo.form.repository;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.form.bean.BfElementConstraint;
/**
* @Description :
* @Reference :
* @Author : yunhao
* @CreateDate : 2019-03-21 20:27
* @Modify:
**/
public interface BfElementConstraintRepository extends BaseRepository<BfElementConstraint, Long> {
}

@ -352,4 +352,35 @@ public final class FormHqlPack {
return result;
}
/**
*
* @param bfElementConstraint
* @return DdlPackBean
*/
public static DdlPackBean packHqlBfElementConstraint(BfElementConstraint bfElementConstraint){
DdlPackBean ddlPackBean = new DdlPackBean();
DdlPreparedPack.getStringLikerPack(bfElementConstraint.getConstraintName(), "constraintName", ddlPackBean);
DdlPreparedPack.getNumEqualPack(bfElementConstraint.getElementId(), "elementId", ddlPackBean);
DdlPreparedPack.getNumEqualPack(bfElementConstraint.getConstraintType(), "constraintType", ddlPackBean);
return ddlPackBean;
}
/**
*
* @param bfElementConstraint
* @return DdlPackBean
*/
public static DdlPackBean packHqlBfElementConstraintOnly(BfElementConstraint bfElementConstraint){
DdlPackBean ddlPackBean = new DdlPackBean();
DdlPreparedPack.getNumNOEqualPack(bfElementConstraint.getId(), "id", ddlPackBean);
DdlPreparedPack.getStringLikerPack(bfElementConstraint.getConstraintName(), "constraintName", ddlPackBean);
DdlPreparedPack.getNumEqualPack(bfElementConstraint.getElementId(), "elementId", ddlPackBean);
return ddlPackBean;
}
}

Loading…
Cancel
Save