提交 47eeb636 编写于 作者: ibizdev's avatar ibizdev

ibizdev提交

上级 fb3a8026
...@@ -8,28 +8,42 @@ ...@@ -8,28 +8,42 @@
type="date" type="date"
:transfer="true" :transfer="true"
:format="valFormat" :format="valFormat"
:placeholder="$t('components.appRangeEditor.placeholder')" :placeholder="$t('info.placeholder')"
:value="activeData[item]" :value="activeData[item]"
:disabled="disabled" :disabled="disabled"
@on-change="onValueChange"> @on-change="(value,type)=>{onValueChange(item,value)}">
</date-picker> </date-picker>
<time-picker <time-picker
:key="index" :key="index"
v-else-if="editorType.startsWith('DATEPICKEREX')" v-else-if="editorType.startsWith('DATEPICKEREX')"
:transfer="true" :transfer="true"
:format="valFormat" :format="valFormat"
:placeholder="$t('components.appRangeEditor.placeholder')" :placeholder="$t('info.placeholder')"
:value="activeData[item]" :value="activeData[item]"
:disabled="disabled" :disabled="disabled"
@on-change="onValueChange"> @on-change="(value)=>{onValueChange(item,value)}">
</time-picker> </time-picker>
<i-input <i-input
:key="index" :key="index"
v-else v-else-if="Object.is(editorType, 'NUMBER')"
type="number" type="number"
:value="getValue(item)" :value="getValue(item)"
:disabled="disabled" :disabled="disabled"
:placeholder="$t('components.appRangeEditor.input')" :placeholder="$t('info.input')"
@on-change="setValue">
</i-input>
<app-span
:key="index"
v-else-if="Object.is(editorType, 'SPAN')"
:value="activeData[item]"
:disabled="disabled">
</app-span>
<i-input
:key="index"
v-else
:value="getValue(item)"
:disabled="disabled"
:placeholder="$t('info.input')"
@on-change="setValue"> @on-change="setValue">
</i-input> </i-input>
</template> </template>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
text-overflow: ellipsis; text-overflow: ellipsis;
word-break: break-all; word-break: break-all;
overflow: hidden; overflow: hidden;
text-align: center; text-align: left;
.file-item{ .file-item{
color: #606266; color: #606266;
display: inline-block; display: inline-block;
......
...@@ -747,7 +747,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -747,7 +747,7 @@ export default class MainBase extends Vue implements ControlInterface {
const importDataModel:any ={ const importDataModel:any ={
} }
if(Object.keys(importDataModel).length == 0){ if(Object.keys(importDataModel).length == 0){
this.$Notice.warning({ title: this.$t("app.utilview.warning"), desc: this.$t("app.utilview.info") }); this.$Notice.warning({ 'title': (this.$t("app.utilview.warning") as string), 'desc': (this.$t("app.utilview.info") as string) });
return; return;
} }
const view:any ={ const view:any ={
......
...@@ -817,7 +817,7 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -817,7 +817,7 @@ export default class MainBase extends Vue implements ControlInterface {
const importDataModel:any ={ const importDataModel:any ={
} }
if(Object.keys(importDataModel).length == 0){ if(Object.keys(importDataModel).length == 0){
this.$Notice.warning({ title: this.$t("app.utilview.warning"), desc: this.$t("app.utilview.info") }); this.$Notice.warning({ 'title': (this.$t("app.utilview.warning") as string), 'desc': (this.$t("app.utilview.info") as string) });
return; return;
} }
const view:any ={ const view:any ={
......
...@@ -20,23 +20,23 @@ import lombok.Data; ...@@ -20,23 +20,23 @@ import lombok.Data;
import org.springframework.data.annotation.Transient; import org.springframework.data.annotation.Transient;
import com.baomidou.mybatisplus.annotation.*; import org.springframework.data.mongodb.core.mapping.Document;
import cn.ibizlab.util.domain.EntityMP; import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.FieldType;
/** /**
* 实体[数据字典] * 大数据 [数据字典] 对象
*/ */
@Data @Data
@TableName(value = "IBZDICT",resultMap = "IBZDictResultMap") @Document(collection = "ibzdict")
public class IBZDict extends EntityMP implements Serializable { public class IBZDict extends EntityBase implements Serializable {
private static final long serialVersionUID = 1L;
/** /**
* 字典标识 * 字典标识
*/ */
@Id()
@DEField(isKeyField=true) @DEField(isKeyField=true)
@TableId(value= "ibzdictid",type=IdType.UUID)
@JSONField(name = "dictid") @JSONField(name = "dictid")
@JsonProperty("dictid") @JsonProperty("dictid")
private String dictid; private String dictid;
...@@ -44,57 +44,56 @@ public class IBZDict extends EntityMP implements Serializable { ...@@ -44,57 +44,56 @@ public class IBZDict extends EntityMP implements Serializable {
/** /**
* 字典名称 * 字典名称
*/ */
@TableField(value = "ibzdictname")
@JSONField(name = "dictname") @JSONField(name = "dictname")
@JsonProperty("dictname") @JsonProperty("dictname")
@Field(name = "ibzdictname")
private String dictname; private String dictname;
/** /**
* 逻辑有效标志 * 逻辑有效标志
*/ */
@DEField(preType = DEPredefinedFieldType.LOGICVALID, logicval = "1" , logicdelval="0") @DEField(preType = DEPredefinedFieldType.LOGICVALID, logicval = "1" , logicdelval="0")
@TableLogic(value= "1",delval="0")
@TableField(value = "enable")
@JSONField(name = "enable") @JSONField(name = "enable")
@JsonProperty("enable") @JsonProperty("enable")
@Field(name = "enable")
private Integer enable; private Integer enable;
/** /**
* 建立时间 * 建立时间
*/ */
@DEField(preType = DEPredefinedFieldType.CREATEDATE) @DEField(preType = DEPredefinedFieldType.CREATEDATE)
@TableField(value = "createdate" , fill = FieldFill.INSERT)
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "createdate" , format="yyyy-MM-dd HH:mm:ss") @JSONField(name = "createdate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("createdate") @JsonProperty("createdate")
@Field(name = "createdate")
private Timestamp createdate; private Timestamp createdate;
/** /**
* 更新时间 * 更新时间
*/ */
@DEField(preType = DEPredefinedFieldType.UPDATEDATE) @DEField(preType = DEPredefinedFieldType.UPDATEDATE)
@TableField(value = "updatedate")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "updatedate" , format="yyyy-MM-dd HH:mm:ss") @JSONField(name = "updatedate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("updatedate") @JsonProperty("updatedate")
@Field(name = "updatedate")
private Timestamp updatedate; private Timestamp updatedate;
/** /**
* 建立人 * 建立人
*/ */
@DEField(preType = DEPredefinedFieldType.CREATEMAN) @DEField(preType = DEPredefinedFieldType.CREATEMAN)
@TableField(value = "createman" , fill = FieldFill.INSERT)
@JSONField(name = "createman") @JSONField(name = "createman")
@JsonProperty("createman") @JsonProperty("createman")
@Field(name = "createman")
private String createman; private String createman;
/** /**
* 更新人 * 更新人
*/ */
@DEField(preType = DEPredefinedFieldType.UPDATEMAN) @DEField(preType = DEPredefinedFieldType.UPDATEMAN)
@TableField(value = "updateman")
@JSONField(name = "updateman") @JSONField(name = "updateman")
@JsonProperty("updateman") @JsonProperty("updateman")
@Field(name = "updateman")
private String updateman; private String updateman;
...@@ -102,26 +101,12 @@ public class IBZDict extends EntityMP implements Serializable { ...@@ -102,26 +101,12 @@ public class IBZDict extends EntityMP implements Serializable {
/** /**
* 字典项目 * 字典项目
*/ */
@JsonIgnore @JSONField(name = "items")
@JSONField(serialize = false) @JsonProperty("items")
@TableField(exist = false) @Field(name = "items")
private List<cn.ibizlab.core.dict.domain.IBZDictItem> items; private List<cn.ibizlab.core.dict.domain.IBZDictItem> items;
/**
* 设置 [字典项目]
*/
public void setItems(List<cn.ibizlab.core.dict.domain.IBZDictItem> items){
this.items = items ;
this.modify("items",(items!=null)?items:(new ArrayList()));
}
/**
* 设置 [字典名称]
*/
public void setDictname(String dictname){
this.dictname = dictname ;
this.modify("ibzdictname",dictname);
}
} }
...@@ -129,3 +114,4 @@ public class IBZDict extends EntityMP implements Serializable { ...@@ -129,3 +114,4 @@ public class IBZDict extends EntityMP implements Serializable {
...@@ -20,23 +20,23 @@ import lombok.Data; ...@@ -20,23 +20,23 @@ import lombok.Data;
import org.springframework.data.annotation.Transient; import org.springframework.data.annotation.Transient;
import com.baomidou.mybatisplus.annotation.*; import org.springframework.data.mongodb.core.mapping.Document;
import cn.ibizlab.util.domain.EntityMP; import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.FieldType;
/** /**
* 实体[字典项目] * 大数据 [字典项目] 对象
*/ */
@Data @Data
@TableName(value = "IBZDICTITEM",resultMap = "IBZDictItemResultMap") @Document(collection = "ibzdictitem")
public class IBZDictItem extends EntityMP implements Serializable { public class IBZDictItem extends EntityBase implements Serializable {
private static final long serialVersionUID = 1L;
/** /**
* 字典项目标识 * 字典项目标识
*/ */
@Id()
@DEField(isKeyField=true) @DEField(isKeyField=true)
@TableId(value= "ibzdictitemid",type=IdType.UUID)
@JSONField(name = "itemid") @JSONField(name = "itemid")
@JsonProperty("itemid") @JsonProperty("itemid")
private String itemid; private String itemid;
...@@ -44,105 +44,105 @@ public class IBZDictItem extends EntityMP implements Serializable { ...@@ -44,105 +44,105 @@ public class IBZDictItem extends EntityMP implements Serializable {
/** /**
* 栏目显示值 * 栏目显示值
*/ */
@TableField(value = "ibzdictitemname")
@JSONField(name = "itemname") @JSONField(name = "itemname")
@JsonProperty("itemname") @JsonProperty("itemname")
@Field(name = "ibzdictitemname")
private String itemname; private String itemname;
/** /**
* 栏目值 * 栏目值
*/ */
@TableField(value = "dictitemval")
@JSONField(name = "itemval") @JSONField(name = "itemval")
@JsonProperty("itemval") @JsonProperty("itemval")
@Field(name = "dictitemval")
private String itemval; private String itemval;
/** /**
* 字典标识 * 字典标识
*/ */
@TableField(value = "dictid")
@JSONField(name = "dictid") @JSONField(name = "dictid")
@JsonProperty("dictid") @JsonProperty("dictid")
@Field(name = "dictid")
private String dictid; private String dictid;
/** /**
* 父栏目值 * 父栏目值
*/ */
@TableField(value = "pitemval")
@JSONField(name = "pitemval") @JSONField(name = "pitemval")
@JsonProperty("pitemval") @JsonProperty("pitemval")
@Field(name = "pitemval")
private String pitemval; private String pitemval;
/** /**
* 过滤项 * 过滤项
*/ */
@TableField(value = "itemfilter")
@JSONField(name = "itemfilter") @JSONField(name = "itemfilter")
@JsonProperty("itemfilter") @JsonProperty("itemfilter")
@Field(name = "itemfilter")
private String itemfilter; private String itemfilter;
/** /**
* 栏目样式 * 栏目样式
*/ */
@DEField(defaultValue = "itemcls" , defaultValueType = DEFieldDefaultValueType.PARAM) @DEField(defaultValue = "itemcls" , defaultValueType = DEFieldDefaultValueType.PARAM)
@TableField(value = "itemcls")
@JSONField(name = "itemcls") @JSONField(name = "itemcls")
@JsonProperty("itemcls") @JsonProperty("itemcls")
@Field(name = "itemcls")
private String itemcls; private String itemcls;
/** /**
* 图标 * 图标
*/ */
@DEField(defaultValue = "no,png") @DEField(defaultValue = "no,png")
@TableField(value = "itemicon")
@JSONField(name = "itemicon") @JSONField(name = "itemicon")
@JsonProperty("itemicon") @JsonProperty("itemicon")
@Field(name = "itemicon")
private String itemicon; private String itemicon;
/** /**
* 排序 * 排序
*/ */
@TableField(value = "showorder")
@JSONField(name = "showorder") @JSONField(name = "showorder")
@JsonProperty("showorder") @JsonProperty("showorder")
@Field(name = "showorder")
private Integer showorder; private Integer showorder;
/** /**
* 建立时间 * 建立时间
*/ */
@DEField(preType = DEPredefinedFieldType.CREATEDATE) @DEField(preType = DEPredefinedFieldType.CREATEDATE)
@TableField(value = "createdate" , fill = FieldFill.INSERT)
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "createdate" , format="yyyy-MM-dd HH:mm:ss") @JSONField(name = "createdate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("createdate") @JsonProperty("createdate")
@Field(name = "createdate")
private Timestamp createdate; private Timestamp createdate;
/** /**
* 更新时间 * 更新时间
*/ */
@DEField(defaultValueType = DEFieldDefaultValueType.CURTIME , preType = DEPredefinedFieldType.UPDATEDATE) @DEField(defaultValueType = DEFieldDefaultValueType.CURTIME , preType = DEPredefinedFieldType.UPDATEDATE)
@TableField(value = "updatedate")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8") @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "updatedate" , format="yyyy-MM-dd HH:mm:ss") @JSONField(name = "updatedate" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("updatedate") @JsonProperty("updatedate")
@Field(name = "updatedate")
private Timestamp updatedate; private Timestamp updatedate;
/** /**
* 建立人 * 建立人
*/ */
@DEField(preType = DEPredefinedFieldType.CREATEMAN) @DEField(preType = DEPredefinedFieldType.CREATEMAN)
@TableField(value = "createman" , fill = FieldFill.INSERT)
@JSONField(name = "createman") @JSONField(name = "createman")
@JsonProperty("createman") @JsonProperty("createman")
@Field(name = "createman")
private String createman; private String createman;
/** /**
* 更新人 * 更新人
*/ */
@DEField(defaultValue = "SRFPERSONID" , defaultValueType = DEFieldDefaultValueType.SESSION , preType = DEPredefinedFieldType.UPDATEMAN) @DEField(defaultValue = "SRFPERSONID" , defaultValueType = DEFieldDefaultValueType.SESSION , preType = DEPredefinedFieldType.UPDATEMAN)
@TableField(value = "updateman")
@JSONField(name = "updateman") @JSONField(name = "updateman")
@JsonProperty("updateman") @JsonProperty("updateman")
@Field(name = "updateman")
private String updateman; private String updateman;
...@@ -151,67 +151,11 @@ public class IBZDictItem extends EntityMP implements Serializable { ...@@ -151,67 +151,11 @@ public class IBZDictItem extends EntityMP implements Serializable {
*/ */
@JsonIgnore @JsonIgnore
@JSONField(serialize = false) @JSONField(serialize = false)
@TableField(exist = false) @Transient
private cn.ibizlab.core.dict.domain.IBZDict dict; private cn.ibizlab.core.dict.domain.IBZDict dict;
/**
* 设置 [栏目显示值]
*/
public void setItemname(String itemname){
this.itemname = itemname ;
this.modify("ibzdictitemname",itemname);
}
/**
* 设置 [栏目值]
*/
public void setItemval(String itemval){
this.itemval = itemval ;
this.modify("dictitemval",itemval);
}
/**
* 设置 [字典标识]
*/
public void setDictid(String dictid){
this.dictid = dictid ;
this.modify("dictid",dictid);
}
/**
* 设置 [父栏目值]
*/
public void setPitemval(String pitemval){
this.pitemval = pitemval ;
this.modify("pitemval",pitemval);
}
/**
* 设置 [过滤项]
*/
public void setItemfilter(String itemfilter){
this.itemfilter = itemfilter ;
this.modify("itemfilter",itemfilter);
}
/**
* 设置 [栏目样式]
*/
public void setItemcls(String itemcls){
this.itemcls = itemcls ;
this.modify("itemcls",itemcls);
}
/**
* 设置 [图标]
*/
public void setItemicon(String itemicon){
this.itemicon = itemicon ;
this.modify("itemicon",itemicon);
}
/**
* 设置 [排序]
*/
public void setShoworder(Integer showorder){
this.showorder = showorder ;
this.modify("showorder",showorder);
}
} }
...@@ -219,3 +163,4 @@ public class IBZDictItem extends EntityMP implements Serializable { ...@@ -219,3 +163,4 @@ public class IBZDictItem extends EntityMP implements Serializable {
...@@ -15,35 +15,39 @@ import org.springframework.util.ObjectUtils; ...@@ -15,35 +15,39 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import cn.ibizlab.util.filter.QueryWrapperContext; import cn.ibizlab.util.filter.QueryBuildContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.core.dict.domain.IBZDictItem; import cn.ibizlab.core.dict.domain.IBZDictItem;
import java.util.regex.Pattern;
import com.mongodb.BasicDBObject;
/** /**
* 关系型数据实体[IBZDictItem] 查询条件对象 * NoSQL数据实体[IBZDictItem] 查询条件对象
*/ */
@Slf4j @Slf4j
@Data @Data
public class IBZDictItemSearchContext extends QueryWrapperContext<IBZDictItem> { public class IBZDictItemSearchContext extends QueryBuildContext {
private String n_ibzdictitemname_like;//[栏目显示值] private String n_ibzdictitemname_like;//[栏目显示值]
public void setN_ibzdictitemname_like(String n_ibzdictitemname_like) { public void setN_ibzdictitemname_like(String n_ibzdictitemname_like) {
this.n_ibzdictitemname_like = n_ibzdictitemname_like; this.n_ibzdictitemname_like = n_ibzdictitemname_like;
if(!ObjectUtils.isEmpty(this.n_ibzdictitemname_like)){ if(!ObjectUtils.isEmpty(this.n_ibzdictitemname_like)){
this.getSelectCond().like("ibzdictitemname", n_ibzdictitemname_like); Pattern pattern = Pattern.compile("^.*" + n_ibzdictitemname_like + ".*$", Pattern.CASE_INSENSITIVE);
this.getSelectCond().and("ibzdictitemname").regex(pattern);
} }
} }
private String n_dictitemval_like;//[栏目值] private String n_dictitemval_like;//[栏目值]
public void setN_dictitemval_like(String n_dictitemval_like) { public void setN_dictitemval_like(String n_dictitemval_like) {
this.n_dictitemval_like = n_dictitemval_like; this.n_dictitemval_like = n_dictitemval_like;
if(!ObjectUtils.isEmpty(this.n_dictitemval_like)){ if(!ObjectUtils.isEmpty(this.n_dictitemval_like)){
this.getSelectCond().like("dictitemval", n_dictitemval_like); Pattern pattern = Pattern.compile("^.*" + n_dictitemval_like + ".*$", Pattern.CASE_INSENSITIVE);
this.getSelectCond().and("dictitemval").regex(pattern);
} }
} }
private String n_dictid_eq;//[字典标识] private String n_dictid_eq;//[字典标识]
public void setN_dictid_eq(String n_dictid_eq) { public void setN_dictid_eq(String n_dictid_eq) {
this.n_dictid_eq = n_dictid_eq; this.n_dictid_eq = n_dictid_eq;
if(!ObjectUtils.isEmpty(this.n_dictid_eq)){ if(!ObjectUtils.isEmpty(this.n_dictid_eq)){
this.getSelectCond().eq("dictid", n_dictid_eq); this.getSelectCond().and("dictid").is(n_dictid_eq);
} }
} }
...@@ -54,11 +58,11 @@ public class IBZDictItemSearchContext extends QueryWrapperContext<IBZDictItem> { ...@@ -54,11 +58,11 @@ public class IBZDictItemSearchContext extends QueryWrapperContext<IBZDictItem> {
{ {
this.query=query; this.query=query;
if(!StringUtils.isEmpty(query)){ if(!StringUtils.isEmpty(query)){
this.getSelectCond().or().like("ibzdictitemname",query); Pattern pattern = Pattern.compile("^.*" + query + ".*$", Pattern.CASE_INSENSITIVE);
this.getSelectCond().or(new BasicDBObject("ibzdictitemname",pattern));
} }
} }
} }
...@@ -15,28 +15,32 @@ import org.springframework.util.ObjectUtils; ...@@ -15,28 +15,32 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import cn.ibizlab.util.filter.QueryWrapperContext; import cn.ibizlab.util.filter.QueryBuildContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.core.dict.domain.IBZDict; import cn.ibizlab.core.dict.domain.IBZDict;
import java.util.regex.Pattern;
import com.mongodb.BasicDBObject;
/** /**
* 关系型数据实体[IBZDict] 查询条件对象 * NoSQL数据实体[IBZDict] 查询条件对象
*/ */
@Slf4j @Slf4j
@Data @Data
public class IBZDictSearchContext extends QueryWrapperContext<IBZDict> { public class IBZDictSearchContext extends QueryBuildContext {
private String n_ibzdictid_like;//[字典标识] private String n_ibzdictid_like;//[字典标识]
public void setN_ibzdictid_like(String n_ibzdictid_like) { public void setN_ibzdictid_like(String n_ibzdictid_like) {
this.n_ibzdictid_like = n_ibzdictid_like; this.n_ibzdictid_like = n_ibzdictid_like;
if(!ObjectUtils.isEmpty(this.n_ibzdictid_like)){ if(!ObjectUtils.isEmpty(this.n_ibzdictid_like)){
this.getSelectCond().like("ibzdictid", n_ibzdictid_like); Pattern pattern = Pattern.compile("^.*" + n_ibzdictid_like + ".*$", Pattern.CASE_INSENSITIVE);
this.getSelectCond().and("ibzdictid").regex(pattern);
} }
} }
private String n_ibzdictname_like;//[字典名称] private String n_ibzdictname_like;//[字典名称]
public void setN_ibzdictname_like(String n_ibzdictname_like) { public void setN_ibzdictname_like(String n_ibzdictname_like) {
this.n_ibzdictname_like = n_ibzdictname_like; this.n_ibzdictname_like = n_ibzdictname_like;
if(!ObjectUtils.isEmpty(this.n_ibzdictname_like)){ if(!ObjectUtils.isEmpty(this.n_ibzdictname_like)){
this.getSelectCond().like("ibzdictname", n_ibzdictname_like); Pattern pattern = Pattern.compile("^.*" + n_ibzdictname_like + ".*$", Pattern.CASE_INSENSITIVE);
this.getSelectCond().and("ibzdictname").regex(pattern);
} }
} }
...@@ -47,11 +51,11 @@ public class IBZDictSearchContext extends QueryWrapperContext<IBZDict> { ...@@ -47,11 +51,11 @@ public class IBZDictSearchContext extends QueryWrapperContext<IBZDict> {
{ {
this.query=query; this.query=query;
if(!StringUtils.isEmpty(query)){ if(!StringUtils.isEmpty(query)){
this.getSelectCond().or().like("ibzdictname",query); Pattern pattern = Pattern.compile("^.*" + query + ".*$", Pattern.CASE_INSENSITIVE);
this.getSelectCond().or(new BasicDBObject("ibzdictname",pattern));
} }
} }
} }
package cn.ibizlab.core.dict.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import cn.ibizlab.core.dict.domain.IBZDictItem;
import org.springframework.stereotype.Repository;
@Repository
public interface IBZDictItemRepository extends MongoRepository<IBZDictItem, String>{
}
package cn.ibizlab.core.dict.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import cn.ibizlab.core.dict.domain.IBZDict;
import org.springframework.stereotype.Repository;
@Repository
public interface IBZDictRepository extends MongoRepository<IBZDict, String>{
}
...@@ -16,12 +16,10 @@ import cn.ibizlab.core.dict.domain.IBZDictItem; ...@@ -16,12 +16,10 @@ import cn.ibizlab.core.dict.domain.IBZDictItem;
import cn.ibizlab.core.dict.filter.IBZDictItemSearchContext; import cn.ibizlab.core.dict.filter.IBZDictItemSearchContext;
import com.baomidou.mybatisplus.extension.service.IService;
/** /**
* 实体[IBZDictItem] 服务对象接口 * 实体[IBZDictItem] 服务对象接口
*/ */
public interface IIBZDictItemService extends IService<IBZDictItem>{ public interface IIBZDictItemService{
IBZDictItem get(String key) ; IBZDictItem get(String key) ;
IBZDictItem getDraft(IBZDictItem et) ; IBZDictItem getDraft(IBZDictItem et) ;
...@@ -37,11 +35,12 @@ public interface IIBZDictItemService extends IService<IBZDictItem>{ ...@@ -37,11 +35,12 @@ public interface IIBZDictItemService extends IService<IBZDictItem>{
Page<IBZDictItem> searchDefault(IBZDictItemSearchContext context) ; Page<IBZDictItem> searchDefault(IBZDictItemSearchContext context) ;
List<IBZDictItem> selectByDictid(String dictid) ; List<IBZDictItem> selectByDictid(String dictid) ;
void saveByDictid(String dictid,List<IBZDictItem> list) ;
void removeByDictid(String dictid) ; void removeByDictid(String dictid) ;
void saveByDictid(String dictid,List<IBZDictItem> list) ;
} }
...@@ -16,12 +16,10 @@ import cn.ibizlab.core.dict.domain.IBZDict; ...@@ -16,12 +16,10 @@ import cn.ibizlab.core.dict.domain.IBZDict;
import cn.ibizlab.core.dict.filter.IBZDictSearchContext; import cn.ibizlab.core.dict.filter.IBZDictSearchContext;
import com.baomidou.mybatisplus.extension.service.IService;
/** /**
* 实体[IBZDict] 服务对象接口 * 实体[IBZDict] 服务对象接口
*/ */
public interface IIBZDictService extends IService<IBZDict>{ public interface IIBZDictService{
IBZDict get(String key) ; IBZDict get(String key) ;
boolean create(IBZDict et) ; boolean create(IBZDict et) ;
...@@ -41,3 +39,4 @@ public interface IIBZDictService extends IService<IBZDict>{ ...@@ -41,3 +39,4 @@ public interface IIBZDictService extends IService<IBZDict>{
} }
...@@ -27,31 +27,32 @@ import cn.ibizlab.util.helper.CachedBeanCopier; ...@@ -27,31 +27,32 @@ import cn.ibizlab.util.helper.CachedBeanCopier;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import cn.ibizlab.core.dict.repository.IBZDictItemRepository;
import cn.ibizlab.core.dict.mapper.IBZDictItemMapper; import org.springframework.data.mongodb.core.MongoTemplate;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.data.mongodb.core.query.BasicQuery;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import org.springframework.data.mongodb.core.query.Query;
import javax.annotation.Resource;
/** /**
* 实体[字典项目] 服务对象接口实现 * 实体[字典项目] 服务对象接口实现
*/ */
@Slf4j @Slf4j
@Service @Service
public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDictItem> implements IIBZDictItemService { public class IBZDictItemServiceImpl implements IIBZDictItemService {
private int batchSize = 500;
@Autowired
private IBZDictItemRepository repository;
@Override @Override
@Transactional @Transactional
public IBZDictItem get(String key) { public IBZDictItem get(String key) {
IBZDictItem et = getById(key); Optional<IBZDictItem> result = repository.findById(key);
if(et==null){ if(!result.isPresent()){
et=new IBZDictItem(); IBZDictItem et=new IBZDictItem();
et.setItemid(key); et.setItemid(key);
return et;
} }
return et; else
return result.get();
} }
@Override @Override
...@@ -62,75 +63,75 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi ...@@ -62,75 +63,75 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi
@Override @Override
@Transactional @Transactional
public boolean save(IBZDictItem et) { public boolean save(IBZDictItem et) {
return saveOrUpdate(et) ; repository.save(et);
return true ;
} }
@Override
@Transactional(
rollbackFor = {Exception.class}
)
public boolean saveOrUpdate(IBZDictItem et) {
if (null == et) {
return false;
} else {
return checkKey(et) ? this.update(et) : this.create(et);
}
}
@Override @Override
public void saveBatch(List<IBZDictItem> list) { public void saveBatch(List<IBZDictItem> list) {
saveOrUpdateBatch(list,batchSize); repository.saveAll(list);
} }
@Override @Override
public boolean checkKey(IBZDictItem et) { public boolean checkKey(IBZDictItem et) {
return (!ObjectUtils.isEmpty(et.getItemid()))&&(!Objects.isNull(this.getById(et.getItemid()))); return repository.findById(et.getItemid()).isPresent();
} }
@Override @Override
@Transactional @Transactional
public boolean remove(String key) { public boolean remove(String key) {
if(!removeById(key)) return false; repository.deleteById(key);
return true ; return true ;
} }
@Override @Override
public void removeBatch(Collection<String> idList) { public void removeBatch(Collection<String> idList) {
removeByIds(idList); repository.deleteAll(repository.findAllById(idList));
} }
@Override @Override
@Transactional @Transactional
public boolean create(IBZDictItem et) { public boolean create(IBZDictItem et) {
if(!this.retBool(this.baseMapper.insert(et))) repository.insert(et);
return false;
CachedBeanCopier.copy(get(et.getItemid()),et);
return true ; return true ;
} }
@Override @Override
public void createBatch(List<IBZDictItem> list) { public void createBatch(List<IBZDictItem> list) {
saveBatch(list,batchSize); repository.insert(list);
} }
@Override @Override
@Transactional @Transactional
public boolean update(IBZDictItem et) { public boolean update(IBZDictItem et) {
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("ibzdictitemid",et.getItemid()))) repository.save(et);
return false;
CachedBeanCopier.copy(get(et.getItemid()),et);
return true ; return true ;
} }
@Override @Override
public void updateBatch(List<IBZDictItem> list) { public void updateBatch(List<IBZDictItem> list) {
updateBatchById(list,batchSize); repository.saveAll(list);
} }
@Override @Override
public List<IBZDictItem> selectByDictid(String dictid) { public List<IBZDictItem> selectByDictid(String dictid) {
return baseMapper.selectByDictid(dictid); IBZDictItemSearchContext context=new IBZDictItemSearchContext();
context.setN_dictid_eq(dictid);
Query query = new BasicQuery(context.getSelectCond().get().toString());
return mongoTemplate.find(query,IBZDictItem.class);
}
@Override
public void removeByDictid(String dictid) {
Set<String> delIds=new HashSet<String>();
for(IBZDictItem before:selectByDictid(dictid)){
delIds.add(before.getItemid());
}
if(delIds.size()>0)
this.removeBatch(delIds);
} }
@Override @Override
...@@ -162,22 +163,25 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi ...@@ -162,22 +163,25 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi
this.removeBatch(delIds); this.removeBatch(delIds);
} }
@Override
public void removeByDictid(String dictid) {
this.remove(new QueryWrapper<IBZDictItem>().eq("ibzdictid",dictid));
}
@Resource
private MongoTemplate mongoTemplate;
/** /**
* 查询集合 DEFAULT * 查询集合 DEFAULT
*/ */
@Override @Override
public Page<IBZDictItem> searchDefault(IBZDictItemSearchContext context) { public Page<IBZDictItem> searchDefault(IBZDictItemSearchContext context) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<IBZDictItem> pages=baseMapper.searchDefault(context.getPage(),context,context.getSelectCond()); Query query = new BasicQuery(context.getSelectCond().get().toString());
return new PageImpl<IBZDictItem>(pages.getRecords(), context.getPageable(), pages.getTotal()); long total = mongoTemplate.count(query, IBZDictItem.class);
List<IBZDictItem> list=mongoTemplate.find(query.with(context.getPageable()),IBZDictItem.class);
return new PageImpl<IBZDictItem>(list,context.getPageable(),total);
} }
} }
...@@ -27,52 +27,49 @@ import cn.ibizlab.util.helper.CachedBeanCopier; ...@@ -27,52 +27,49 @@ import cn.ibizlab.util.helper.CachedBeanCopier;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import cn.ibizlab.core.dict.repository.IBZDictRepository;
import cn.ibizlab.core.dict.mapper.IBZDictMapper; import org.springframework.data.mongodb.core.MongoTemplate;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.data.mongodb.core.query.BasicQuery;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import org.springframework.data.mongodb.core.query.Query;
import javax.annotation.Resource;
/** /**
* 实体[数据字典] 服务对象接口实现 * 实体[数据字典] 服务对象接口实现
*/ */
@Slf4j @Slf4j
@Service @Service
public class IBZDictServiceImpl extends ServiceImpl<IBZDictMapper, IBZDict> implements IIBZDictService { public class IBZDictServiceImpl implements IIBZDictService {
@Autowired @Autowired
private cn.ibizlab.core.dict.service.IIBZDictItemService ibzdictitemService; private IBZDictRepository repository;
private int batchSize = 500;
@Override @Override
@Transactional @Transactional
public IBZDict get(String key) { public IBZDict get(String key) {
IBZDict et = getById(key); Optional<IBZDict> result = repository.findById(key);
if(et==null){ if(!result.isPresent()){
et=new IBZDict(); IBZDict et=new IBZDict();
et.setDictid(key); et.setDictid(key);
return et;
} }
return et; else
return result.get();
} }
@Override @Override
@Transactional @Transactional
public boolean create(IBZDict et) { public boolean create(IBZDict et) {
if(!this.retBool(this.baseMapper.insert(et))) repository.insert(et);
return false;
CachedBeanCopier.copy(get(et.getDictid()),et);
return true ; return true ;
} }
@Override @Override
public void createBatch(List<IBZDict> list) { public void createBatch(List<IBZDict> list) {
saveBatch(list,batchSize); repository.insert(list);
} }
@Override @Override
public boolean checkKey(IBZDict et) { public boolean checkKey(IBZDict et) {
return (!ObjectUtils.isEmpty(et.getDictid()))&&(!Objects.isNull(this.getById(et.getDictid()))); return repository.findById(et.getDictid()).isPresent();
} }
@Override @Override
...@@ -83,65 +80,61 @@ public class IBZDictServiceImpl extends ServiceImpl<IBZDictMapper, IBZDict> impl ...@@ -83,65 +80,61 @@ public class IBZDictServiceImpl extends ServiceImpl<IBZDictMapper, IBZDict> impl
@Override @Override
@Transactional @Transactional
public boolean update(IBZDict et) { public boolean update(IBZDict et) {
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("ibzdictid",et.getDictid()))) repository.save(et);
return false;
CachedBeanCopier.copy(get(et.getDictid()),et);
return true ; return true ;
} }
@Override @Override
public void updateBatch(List<IBZDict> list) { public void updateBatch(List<IBZDict> list) {
updateBatchById(list,batchSize); repository.saveAll(list);
} }
@Override @Override
@Transactional @Transactional
public boolean remove(String key) { public boolean remove(String key) {
ibzdictitemService.removeByDictid(key) ; repository.deleteById(key);
if(!removeById(key)) return false;
return true ; return true ;
} }
@Override @Override
public void removeBatch(Collection<String> idList) { public void removeBatch(Collection<String> idList) {
removeByIds(idList); repository.deleteAll(repository.findAllById(idList));
} }
@Override @Override
@Transactional @Transactional
public boolean save(IBZDict et) { public boolean save(IBZDict et) {
return saveOrUpdate(et) ; repository.save(et);
return true ;
} }
@Override
@Transactional(
rollbackFor = {Exception.class}
)
public boolean saveOrUpdate(IBZDict et) {
if (null == et) {
return false;
} else {
return checkKey(et) ? this.update(et) : this.create(et);
}
}
@Override @Override
public void saveBatch(List<IBZDict> list) { public void saveBatch(List<IBZDict> list) {
saveOrUpdateBatch(list,batchSize); repository.saveAll(list);
} }
@Resource
private MongoTemplate mongoTemplate;
/** /**
* 查询集合 DEFAULT * 查询集合 DEFAULT
*/ */
@Override @Override
public Page<IBZDict> searchDefault(IBZDictSearchContext context) { public Page<IBZDict> searchDefault(IBZDictSearchContext context) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<IBZDict> pages=baseMapper.searchDefault(context.getPage(),context,context.getSelectCond()); Query query = new BasicQuery(context.getSelectCond().get().toString());
return new PageImpl<IBZDict>(pages.getRecords(), context.getPageable(), pages.getTotal()); long total = mongoTemplate.count(query, IBZDict.class);
List<IBZDict> list=mongoTemplate.find(query.with(context.getPageable()),IBZDict.class);
return new PageImpl<IBZDict>(list,context.getPageable(),total);
} }
} }
...@@ -27,13 +27,13 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch ...@@ -27,13 +27,13 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
*/ */
@JsonIgnore @JsonIgnore
@JSONField(serialize = false) @JSONField(serialize = false)
public Page getPage(){ public Page getPages(){
Page page; Page page;
List<String> asc_fieldList = new ArrayList<>(); List<String> asc_fieldList = new ArrayList<>();
List<String> desc_fieldList = new ArrayList<>(); List<String> desc_fieldList = new ArrayList<>();
int currentPage=pageable.getPageNumber(); int currentPage=getPageable().getPageNumber();
int pageSize=pageable.getPageSize(); int pageSize=getPageable().getPageSize();
//构造mybatis-plus分页 //构造mybatis-plus分页
if(StringUtils.isEmpty(currentPage) || StringUtils.isEmpty(pageSize)) if(StringUtils.isEmpty(currentPage) || StringUtils.isEmpty(pageSize))
...@@ -42,7 +42,7 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch ...@@ -42,7 +42,7 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
page=new Page(currentPage+1,pageSize); page=new Page(currentPage+1,pageSize);
//构造mybatis-plus排序 //构造mybatis-plus排序
Sort sort = pageable.getSort(); Sort sort = getPageable().getSort();
Iterator<Sort.Order> it_sort = sort.iterator(); Iterator<Sort.Order> it_sort = sort.iterator();
if(ObjectUtils.isEmpty(it_sort)) if(ObjectUtils.isEmpty(it_sort))
......
...@@ -8,6 +8,8 @@ import lombok.Data; ...@@ -8,6 +8,8 @@ import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.util.StringUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -36,15 +38,55 @@ public class SearchContextBase implements ISearchContext{ ...@@ -36,15 +38,55 @@ public class SearchContextBase implements ISearchContext{
* 数据查询 * 数据查询
*/ */
public List dataQueryList; public List dataQueryList;
/**
* 当前页数
*/
public int page=0;
/**
* 每页显示条数
*/
public int size=20;
/**
* 排序
*/
public String sort;
/**
* 排序对象
*/
public Sort pageSort;
/**
* 获取分页参数
* @return
*/
public Pageable getPageable() {
Pageable pageable = PageRequest.of(page,size,pageSort);
return pageable;
}
/**
* 设置排序值
* @param strSort
*/
public void setSort(String strSort) {
this.sort=strSort;
if(!StringUtils.isEmpty(strSort)){
String arrSort[]=strSort.split(",");
String field=arrSort[0];
String order=arrSort[1];
if(order.equalsIgnoreCase("asc")){
this.pageSort=Sort.by(Sort.Direction.ASC,field);
}
else if(order.equalsIgnoreCase("desc")){
this.pageSort=Sort.by(Sort.Direction.DESC,field);
}
}
}
/** /**
* 上下文参数 * 上下文参数
*/ */
Map<String,Object> params = new HashMap<String,Object>() ; Map<String,Object> params = new HashMap<String,Object>() ;
@JsonIgnore
Pageable pageable = PageRequest.of(0, 20);
/** /**
* 获取数据上下文 * 获取数据上下文
* @return * @return
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册