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

ibizdev提交

上级 a75527e8
......@@ -33,7 +33,7 @@
<template v-if="getColumnState('updatedate')">
<el-table-column show-overflow-tooltip :prop="'updatedate'" :label="$t('ibzdict.main_grid.columns.updatedate')" :width="250" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<app-format-data format="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS" :data="row.updatedate"></app-format-data>
<app-format-data format="YYYY-MM-DD hh:mm:ss" :data="row.updatedate"></app-format-data>
</template>
</el-table-column>
</template>
......
......@@ -68,7 +68,7 @@
<template v-if="getColumnState('updatedate')">
<el-table-column show-overflow-tooltip :prop="'updatedate'" :label="$t('ibzdictitem.main_grid.columns.updatedate')" :width="250" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<app-format-data format="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS" :data="row.updatedate"></app-format-data>
<app-format-data format="YYYY-MM-DD hh:mm:ss" :data="row.updatedate"></app-format-data>
</template>
</el-table-column>
</template>
......
......@@ -19,69 +19,59 @@ import java.io.Serializable;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.*;
import org.springframework.data.mongodb.core.mapping.Document;
/**
* 实体[数据字典]
* 大数据 [数据字典] 对象
*/
@Data
@TableName(value = "IBZDICT",resultMap = "IBZDictResultMap")
public class IBZDict extends EntityBase implements Serializable {
private static final long serialVersionUID = 1L;
@Document(collection = "ibzdict")
public class IBZDict implements Serializable {
/**
* 字典标识
*/
@DEField(isKeyField=true)
@TableId(value= "ibzdictid",type=IdType.UUID)
private String dictid;
private String dictId;
/**
* 字典名称
*/
@TableField(value = "ibzdictname")
private String dictname;
private String dictName;
/**
* 逻辑有效标志
*/
@DEField(preType = DEPredefinedFieldType.LOGICVALID)
@TableLogic(value= "1",delval="0")
@TableField(value = "enable")
private Integer enable;
/**
* 建立时间
*/
@DEField(preType = DEPredefinedFieldType.CREATEDATE)
@TableField(value = "createdate" , fill = FieldFill.INSERT)
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Timestamp createdate;
private Timestamp createDate;
/**
* 更新时间
*/
@DEField(preType = DEPredefinedFieldType.UPDATEDATE)
@TableField(value = "updatedate")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Timestamp updatedate;
private Timestamp updateDate;
/**
* 建立人
*/
@DEField(preType = DEPredefinedFieldType.CREATEMAN)
@TableField(value = "createman" , fill = FieldFill.INSERT)
private String createman;
private String createMan;
/**
* 更新人
*/
@DEField(preType = DEPredefinedFieldType.UPDATEMAN)
@TableField(value = "updateman")
private String updateman;
private String updateMan;
......@@ -90,16 +80,10 @@ public class IBZDict extends EntityBase implements Serializable {
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private List<cn.ibizlab.core.dict.domain.IBZDictItem> items;
/**
* 设置 [字典名称]
*/
public void setDictname(String dictname){
this.dictname = dictname ;
this.modify("ibzdictname",dictname);
}
}
......@@ -19,172 +19,3 @@ import java.io.Serializable;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.*;
/**
* 实体[字典项目]
*/
@Data
@TableName(value = "IBZDICTITEM",resultMap = "IBZDictItemResultMap")
public class IBZDictItem extends EntityBase implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 字典项目标识
*/
@DEField(isKeyField=true)
@TableId(value= "ibzdictitemid",type=IdType.UUID)
private String itemid;
/**
* 栏目显示值
*/
@TableField(value = "ibzdictitemname")
private String itemname;
/**
* 栏目值
*/
@TableField(value = "dictitemval")
private String itemval;
/**
* 字典标识
*/
@TableField(value = "dictid")
private String dictid;
/**
* 父栏目值
*/
@TableField(value = "pitemval")
private String pitemval;
/**
* 过滤项
*/
@TableField(value = "itemfilter")
private String itemfilter;
/**
* 栏目样式
*/
@DEField(defaultValue = "itemcls" , defaultValueType = DEFieldDefaultValueType.PARAM)
@TableField(value = "itemcls")
private String itemcls;
/**
* 图标
*/
@DEField(defaultValue = "no,png")
@TableField(value = "itemicon")
private String itemicon;
/**
* 排序
*/
@TableField(value = "showorder")
private Integer showorder;
/**
* 建立时间
*/
@DEField(preType = DEPredefinedFieldType.CREATEDATE)
@TableField(value = "createdate" , fill = FieldFill.INSERT)
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Timestamp createdate;
/**
* 更新时间
*/
@DEField(defaultValueType = DEFieldDefaultValueType.CURTIME , preType = DEPredefinedFieldType.UPDATEDATE)
@TableField(value = "updatedate")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Timestamp updatedate;
/**
* 建立人
*/
@DEField(preType = DEPredefinedFieldType.CREATEMAN)
@TableField(value = "createman" , fill = FieldFill.INSERT)
private String createman;
/**
* 更新人
*/
@DEField(defaultValue = "SRFPERSONID" , defaultValueType = DEFieldDefaultValueType.SESSION , preType = DEPredefinedFieldType.UPDATEMAN)
@TableField(value = "updateman")
private String updateman;
/**
* 字典
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
private 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);
}
}
......@@ -20,52 +20,5 @@ import org.springframework.util.StringUtils;
import cn.ibizlab.util.service.MybatisSearchContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.core.dict.domain.IBZDictItem;
/**
* 关系型数据实体[IBZDictItem] 查询条件对象
*/
@Slf4j
@Data
public class IBZDictItemSearchContext extends MybatisSearchContext {
private QueryWrapper<IBZDictItem> selectCond=new QueryWrapper();
private String n_ibzdictitemname_like;//[栏目显示值]
public void setN_ibzdictitemname_like(String n_ibzdictitemname_like) {
this.n_ibzdictitemname_like = n_ibzdictitemname_like;
if(!StringUtils.isEmpty(this.n_ibzdictitemname_like)){
this.selectCond.like("ibzdictitemname", n_ibzdictitemname_like);
}
}
private String n_dictitemval_like;//[栏目值]
public void setN_dictitemval_like(String n_dictitemval_like) {
this.n_dictitemval_like = n_dictitemval_like;
if(!StringUtils.isEmpty(this.n_dictitemval_like)){
this.selectCond.like("dictitemval", n_dictitemval_like);
}
}
private String n_dictid_eq;//[字典标识]
public void setN_dictid_eq(String n_dictid_eq) {
this.n_dictid_eq = n_dictid_eq;
if(!StringUtils.isEmpty(this.n_dictid_eq)){
this.selectCond.eq("dictid", n_dictid_eq);
}
}
/**
* 启用快速搜索
*/
public void setQuery(String query)
{
this.query=query;
if(!StringUtils.isEmpty(query)){
this.selectCond.or().like("ibzdictitemname",query);
}
}
}
......@@ -20,45 +20,16 @@ import org.springframework.util.StringUtils;
import cn.ibizlab.util.service.MybatisSearchContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.core.dict.domain.IBZDict;
import cn.ibizlab.util.service.SearchContextBase;
/**
* 关系型数据实体[IBZDict] 查询条件对象
* NoSQL数据实体[IBZDict] 查询条件对象
*/
@Slf4j
@Data
public class IBZDictSearchContext extends MybatisSearchContext {
private QueryWrapper<IBZDict> selectCond=new QueryWrapper();
private String n_ibzdictid_like;//[字典标识]
public void setN_ibzdictid_like(String n_ibzdictid_like) {
this.n_ibzdictid_like = n_ibzdictid_like;
if(!StringUtils.isEmpty(this.n_ibzdictid_like)){
this.selectCond.like("ibzdictid", n_ibzdictid_like);
}
}
private String n_ibzdictname_like;//[字典名称]
public void setN_ibzdictname_like(String n_ibzdictname_like) {
this.n_ibzdictname_like = n_ibzdictname_like;
if(!StringUtils.isEmpty(this.n_ibzdictname_like)){
this.selectCond.like("ibzdictname", n_ibzdictname_like);
}
}
public class IBZDictSearchContext extends SearchContextBase {
/**
* 启用快速搜索
*/
public void setQuery(String query)
{
this.query=query;
if(!StringUtils.isEmpty(query)){
this.selectCond.or().like("ibzdictname",query);
}
}
}
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,31 +16,3 @@ import cn.ibizlab.core.dict.domain.IBZDictItem;
import cn.ibizlab.core.dict.filter.IBZDictItemSearchContext;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 实体[IBZDictItem] 服务对象接口
*/
public interface IIBZDictItemService extends IService<IBZDictItem>{
IBZDictItem get(String key) ;
IBZDictItem getDraft(IBZDictItem et) ;
boolean save(IBZDictItem et) ;
void saveBatch(List<IBZDictItem> list, int batchSize) ;
boolean checkKey(IBZDictItem et) ;
boolean remove(String key) ;
void removeBatch(Collection<String> idList, int batchSize) ;
boolean create(IBZDictItem et) ;
void createBatch(List<IBZDictItem> list, int batchSize) ;
boolean update(IBZDictItem et) ;
void updateBatch(List<IBZDictItem> list, int batchSize) ;
Page<IBZDictItem> searchDefault(IBZDictItemSearchContext context) ;
List<IBZDictItem> selectByDictid(String dictid) ;
void saveByDictid(String dictid,List<IBZDictItem> list) ;
void removeByDictid(String dictid) ;
}
......@@ -16,12 +16,10 @@ import cn.ibizlab.core.dict.domain.IBZDict;
import cn.ibizlab.core.dict.filter.IBZDictSearchContext;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 实体[IBZDict] 服务对象接口
*/
public interface IIBZDictService extends IService<IBZDict>{
public interface IIBZDictService{
IBZDict get(String key) ;
boolean create(IBZDict et) ;
......@@ -40,3 +38,4 @@ public interface IIBZDictService extends IService<IBZDict>{
}
......@@ -20,7 +20,6 @@ import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.transaction.annotation.Transactional;
import cn.ibizlab.core.dict.domain.IBZDictItem;
import cn.ibizlab.core.dict.filter.IBZDictItemSearchContext;
import cn.ibizlab.core.dict.service.IIBZDictItemService;
......@@ -29,156 +28,3 @@ import cn.ibizlab.util.helper.CachedBeanCopier;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.ibizlab.core.dict.mapper.IBZDictItemMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.springframework.util.ObjectUtils;
/**
* 实体[字典项目] 服务对象接口实现
*/
@Slf4j
@Service
public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDictItem> implements IIBZDictItemService {
@Override
@Transactional
public IBZDictItem get(String key) {
IBZDictItem et = getById(key);
if(et==null){
et=new IBZDictItem();
et.setItemid(key);
}
return et;
}
@Override
public IBZDictItem getDraft(IBZDictItem et) {
return et;
}
@Override
@Transactional
public boolean save(IBZDictItem et) {
return saveOrUpdate(et) ;
}
@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
public void saveBatch(List<IBZDictItem> list, int batchSize) {
saveOrUpdateBatch(list,batchSize);
}
@Override
public boolean checkKey(IBZDictItem et) {
return (!ObjectUtils.isEmpty(et.getItemid()))&&(!Objects.isNull(this.getById(et.getItemid())));
}
@Override
@Transactional
public boolean remove(String key) {
if(!removeById(key)) return false;
return true ;
}
@Override
public void removeBatch(Collection<String> idList, int batchSize) {
removeByIds(idList);
}
@Override
@Transactional
public boolean create(IBZDictItem et) {
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy(get(et.getItemid()),et);
return true ;
}
@Override
public void createBatch(List<IBZDictItem> list, int batchSize) {
saveBatch(list,batchSize);
}
@Override
@Transactional
public boolean update(IBZDictItem et) {
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("ibzdictitemid",et.getItemid())))
return false;
CachedBeanCopier.copy(get(et.getItemid()),et);
return true ;
}
@Override
public void updateBatch(List<IBZDictItem> list, int batchSize) {
updateBatchById(list,batchSize);
}
@Override
public List<IBZDictItem> selectByDictid(String dictid) {
return baseMapper.selectByDictid(dictid);
}
@Override
public void saveByDictid(String dictid,List<IBZDictItem> list) {
if(list==null)
return;
Set<String> delIds=new HashSet<String>();
List<IBZDictItem> _update=new ArrayList<IBZDictItem>();
List<IBZDictItem> _create=new ArrayList<IBZDictItem>();
for(IBZDictItem before:selectByDictid(dictid)){
delIds.add(before.getItemid());
}
for(IBZDictItem sub:list) {
sub.setDictid(dictid);
if(ObjectUtils.isEmpty(sub.getItemid()))
sub.setItemid((String)sub.getDefaultKey(true));
if(delIds.contains(sub.getItemid())) {
delIds.remove(sub.getItemid());
_update.add(sub);
}
else
_create.add(sub);
}
if(_update.size()>0)
this.updateBatch(_update,500);
if(_create.size()>0)
this.createBatch(_create,500);
if(delIds.size()>0)
this.removeBatch(delIds,500);
}
@Override
public void removeByDictid(String dictid) {
this.remove(new QueryWrapper<IBZDictItem>().eq("ibzdictid",dictid));
}
/**
* 查询集合 DEFAULT
*/
@Override
public Page<IBZDictItem> searchDefault(IBZDictItemSearchContext context) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<IBZDictItem> pages=baseMapper.searchDefault(context.getPage(),context,context.getSelectCond());
return new PageImpl<IBZDictItem>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
}
......@@ -20,7 +20,6 @@ import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.transaction.annotation.Transactional;
import cn.ibizlab.core.dict.domain.IBZDict;
import cn.ibizlab.core.dict.filter.IBZDictSearchContext;
import cn.ibizlab.core.dict.service.IIBZDictService;
......@@ -29,120 +28,105 @@ import cn.ibizlab.util.helper.CachedBeanCopier;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.ibizlab.core.dict.mapper.IBZDictMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import org.springframework.util.ObjectUtils;
import cn.ibizlab.core.dict.repository.IBZDictRepository;
/**
* 实体[数据字典] 服务对象接口实现
*/
@Slf4j
@Service
public class IBZDictServiceImpl extends ServiceImpl<IBZDictMapper, IBZDict> implements IIBZDictService {
public class IBZDictServiceImpl implements IIBZDictService {
@Autowired
IBZDictRepository repository;
@Autowired
private cn.ibizlab.core.dict.service.IIBZDictItemService ibzdictitemService;
private cn.ibizlab.core.dict.service.IIBZDictItemService iBZDictItemService;
@Override
@Transactional
public IBZDict get(String key) {
IBZDict et = getById(key);
if(et==null){
et=new IBZDict();
et.setDictid(key);
}
return et;
public IBZDict get(String dictid) {
return repository.findById(dictid).get();
}
@Override
@Transactional
public boolean create(IBZDict et) {
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy(get(et.getDictid()),et);
return true ;
public IBZDict get(IBZDict et) {
return null ;
}
@Override
public void createBatch(List<IBZDict> list, int batchSize) {
saveBatch(list,batchSize);
public boolean create(IBZDict et) {
repository.insert(et);
return true ;
}
@Override
public boolean checkKey(IBZDict et) {
return (!ObjectUtils.isEmpty(et.getDictid()))&&(!Objects.isNull(this.getById(et.getDictid())));
return true;
}
@Override
public IBZDict getDraft(IBZDict et) {
return et;
}
@Override
@Transactional
public boolean update(IBZDict et) {
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("ibzdictid",et.getDictid())))
return false;
CachedBeanCopier.copy(get(et.getDictid()),et);
repository.save(et);
return true ;
}
@Override
public void updateBatch(List<IBZDict> list, int batchSize) {
updateBatchById(list,batchSize);
}
@Override
@Transactional
public boolean remove(String key) {
ibzdictitemService.removeByDictid(key) ;
if(!removeById(key)) return false;
public boolean remove(String dictid) {
repository.deleteById(dictid);
return true ;
}
@Override
public void removeBatch(Collection<String> idList, int batchSize) {
removeByIds(idList);
}
/**
* 查询集合 DEFAULT
*/
@Override
@Transactional
public boolean save(IBZDict et) {
return saveOrUpdate(et) ;
public Page<IBZDict> searchDefault(IBZDictSearchContext context) {
List<IBZDict> iBZDicts=repository.findAll();
return new PageImpl<IBZDict>(iBZDicts, context.getPageable(), iBZDicts.size());
}
@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);
//更新嵌套[字典项目]
private void _updateItems(IBZDict newIBZDict , IBZDict oldIBZDict){
Map<String,cn.ibizlab.core.dict.domain.IBZDictItem> oldMapItems = new HashMap<String,cn.ibizlab.core.dict.domain.IBZDictItem>() ;
List<cn.ibizlab.core.dict.domain.IBZDictItem> oldItems = oldIBZDict.getItems();
if(ObjectUtils.isEmpty(oldItems) || oldItems.size()==0){
return ;
}
for(cn.ibizlab.core.dict.domain.IBZDictItem iBZDictItem : oldItems){
oldMapItems.put(iBZDictItem.getItemId(),iBZDictItem);
}
@Override
public void saveBatch(List<IBZDict> list, int batchSize) {
saveOrUpdateBatch(list,batchSize);
Map<String,cn.ibizlab.core.dict.domain.IBZDictItem> newMapItems = new HashMap<String,cn.ibizlab.core.dict.domain.IBZDictItem>() ;
List<cn.ibizlab.core.dict.domain.IBZDictItem> newItems = newIBZDict.getItems() ;
for(cn.ibizlab.core.dict.domain.IBZDictItem iBZDictItem : newItems){
iBZDictItem.setDictId(newIBZDict.getDictId());
if(iBZDictItem.getItemId() == null ){
iBZDictItemService.create(iBZDictItem) ;
continue ;
}
newMapItems.put(iBZDictItem.getItemId(),iBZDictItem) ;
if(oldMapItems.containsKey(iBZDictItem.getItemId())) {
iBZDictItemService.update(iBZDictItem);
}else {
iBZDictItemService.create(iBZDictItem);
}
}
/**
* 查询集合 DEFAULT
*/
@Override
public Page<IBZDict> searchDefault(IBZDictSearchContext context) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<IBZDict> pages=baseMapper.searchDefault(context.getPage(),context,context.getSelectCond());
return new PageImpl<IBZDict>(pages.getRecords(), context.getPageable(), pages.getTotal());
//删除多余数据
for(String key : oldMapItems.keySet()){
if(!newMapItems.containsKey(key))
iBZDictItemService.remove(key) ;
}
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册