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

ibiz4j 发布系统代码

上级 d50e5ca2
...@@ -21,38 +21,33 @@ import java.io.Serializable; ...@@ -21,38 +21,33 @@ import java.io.Serializable;
import lombok.Data; import lombok.Data;
import org.springframework.data.annotation.Transient; import org.springframework.data.annotation.Transient;
import cn.ibizlab.util.domain.EntityClient;
import com.baomidou.mybatisplus.annotation.*;
import cn.ibizlab.util.domain.EntityMP;
/** /**
* 实体[系统] * ServiceApi [系统] 对象
*/ */
@Data @Data
@TableName(value = "IBZPSSYSTEM",resultMap = "WFSystemResultMap") public class WFSystem extends EntityClient implements Serializable {
public class WFSystem extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
/** /**
* 系统标识 * 系统标识
*/ */
@DEField(isKeyField=true) @DEField(isKeyField=true)
@TableId(value= "pssystemid",type=IdType.UUID) @JSONField(name = "pSSystemId")
@JSONField(name = "pssystemid") @JsonProperty("pSSystemId")
@JsonProperty("pssystemid")
private String pssystemid; private String pssystemid;
/** /**
* 系统名称 * 系统名称
*/ */
@TableField(value = "pssystemname") @JSONField(name = "pSSystemName")
@JSONField(name = "pssystemname") @JsonProperty("pSSystemName")
@JsonProperty("pssystemname")
private String pssystemname; private String pssystemname;
/** /**
* 设置 [系统名称] * 设置 [系统名称]
*/ */
......
...@@ -17,36 +17,17 @@ import org.springframework.util.ObjectUtils; ...@@ -17,36 +17,17 @@ 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.SearchContextBase;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.core.workflow.domain.WFSystem;
/** /**
* 关系型数据实体[WFSystem] 查询条件对象 * ServiceApi数据实体[WFSystem] 查询条件对象
*/ */
@Slf4j @Slf4j
@Data @Data
public class WFSystemSearchContext extends QueryWrapperContext<WFSystem> { public class WFSystemSearchContext extends SearchContextBase {
private String n_pssystemname_like;//[系统名称] private String n_pssystemname_like;//[系统名称]
public void setN_pssystemname_like(String n_pssystemname_like) {
this.n_pssystemname_like = n_pssystemname_like;
if(!ObjectUtils.isEmpty(this.n_pssystemname_like)){
this.getSelectCond().like("pssystemname", n_pssystemname_like);
}
}
/**
* 启用快速搜索
*/
public void setQuery(String query)
{
this.query=query;
if(!StringUtils.isEmpty(query)){
this.getSelectCond().or().like("pssystemname",query);
}
}
}
}
...@@ -18,12 +18,10 @@ import cn.ibizlab.core.workflow.domain.WFSystem; ...@@ -18,12 +18,10 @@ import cn.ibizlab.core.workflow.domain.WFSystem;
import cn.ibizlab.core.workflow.filter.WFSystemSearchContext; import cn.ibizlab.core.workflow.filter.WFSystemSearchContext;
import com.baomidou.mybatisplus.extension.service.IService;
/** /**
* 实体[WFSystem] 服务对象接口 * 实体[WFSystem] 服务对象接口
*/ */
public interface IWFSystemService extends IService<WFSystem>{ public interface IWFSystemService{
boolean remove(String key) ; boolean remove(String key) ;
void removeBatch(Collection<String> idList) ; void removeBatch(Collection<String> idList) ;
...@@ -37,21 +35,8 @@ public interface IWFSystemService extends IService<WFSystem>{ ...@@ -37,21 +35,8 @@ public interface IWFSystemService extends IService<WFSystem>{
boolean checkKey(WFSystem et) ; boolean checkKey(WFSystem et) ;
WFSystem get(String key) ; WFSystem get(String key) ;
Page<WFSystem> searchDefault(WFSystemSearchContext context) ; Page<WFSystem> searchDefault(WFSystemSearchContext context) ;
/**
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
* @param param 参数列表 param.put("param","1");
* @return select * from table where id = '1'
*/
List<JSONObject> select(String sql, Map param);
/**
*自定义SQL
* @param sql update table set name ='test' where id =#{et.param}
* @param param 参数列表 param.put("param","1");
* @return update table set name ='test' where id = '1'
*/
boolean execute(String sql, Map param);
} }
...@@ -30,47 +30,31 @@ import cn.ibizlab.core.workflow.service.IWFSystemService; ...@@ -30,47 +30,31 @@ import cn.ibizlab.core.workflow.service.IWFSystemService;
import cn.ibizlab.util.helper.CachedBeanCopier; import cn.ibizlab.util.helper.CachedBeanCopier;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.ibizlab.core.workflow.mapper.WFSystemMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.StringUtils;
/** /**
* 实体[系统] 服务对象接口实现 * 实体[系统] 无存储服务对象接口实现
*/ */
@Slf4j @Slf4j
@Service("WFSystemServiceImpl") @Service
public class WFSystemServiceImpl extends ServiceImpl<WFSystemMapper, WFSystem> implements IWFSystemService { public class WFSystemServiceImpl implements IWFSystemService {
private int batchSize = 500;
@Override @Override
@Transactional
public boolean remove(String key) { public boolean remove(String key) {
boolean result=removeById(key); return true;
return result ;
} }
@Override public void removeBatch(Collection<String> idList){
public void removeBatch(Collection<String> idList) {
removeByIds(idList);
} }
@Override @Override
@Transactional
public boolean update(WFSystem et) { public boolean update(WFSystem et) {
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("pssystemid",et.getPssystemid()))) //代码实现
return false;
CachedBeanCopier.copy(get(et.getPssystemid()),et);
return true; return true;
} }
@Override public void updateBatch(List<WFSystem> list){
public void updateBatch(List<WFSystem> list) {
updateBatchById(list,batchSize);
} }
@Override @Override
...@@ -81,98 +65,48 @@ public class WFSystemServiceImpl extends ServiceImpl<WFSystemMapper, WFSystem> i ...@@ -81,98 +65,48 @@ public class WFSystemServiceImpl extends ServiceImpl<WFSystemMapper, WFSystem> i
@Override @Override
@Transactional @Transactional
public boolean save(WFSystem et) { public boolean save(WFSystem et) {
if(!saveOrUpdate(et)) //代码实现
return false;
return true; return true;
} }
@Override
@Transactional(
rollbackFor = {Exception.class}
)
public boolean saveOrUpdate(WFSystem et) {
if (null == et) {
return false;
} else {
return checkKey(et) ? this.update(et) : this.create(et);
}
}
@Override @Override
public void saveBatch(List<WFSystem> list) { public void saveBatch(List<WFSystem> list) {
saveOrUpdateBatch(list,batchSize);
} }
@Override @Override
@Transactional
public boolean create(WFSystem et) { public boolean create(WFSystem et) {
if(!this.retBool(this.baseMapper.insert(et))) //代码实现
return false;
CachedBeanCopier.copy(get(et.getPssystemid()),et);
return true; return true;
} }
@Override public void createBatch(List<WFSystem> list){
public void createBatch(List<WFSystem> list) {
this.saveBatch(list,batchSize);
} }
@Override @Override
public boolean checkKey(WFSystem et) { public boolean checkKey(WFSystem et) {
return (!ObjectUtils.isEmpty(et.getPssystemid()))&&(!Objects.isNull(this.getById(et.getPssystemid()))); return false;
} }
@Override @Override
@Transactional
public WFSystem get(String key) { public WFSystem get(String key) {
WFSystem et = getById(key); WFSystem et = new WFSystem();
if(et==null){ et.setPssystemid(key);
et=new WFSystem();
et.setPssystemid(key);
}
else{
}
return et; return et;
} }
/** /**
* 查询集合 DEFAULT * 查询集合 DEFAULT
*/ */
@Override @Override
public Page<WFSystem> searchDefault(WFSystemSearchContext context) { public Page<WFSystem> searchDefault(WFSystemSearchContext context) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<WFSystem> pages=baseMapper.searchDefault(context.getPages(),context,context.getSelectCond()); return new PageImpl<WFSystem>(new ArrayList(),context.getPageable(),0);
return new PageImpl<WFSystem>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
@Override
public List<JSONObject> select(String sql, Map param){
return this.baseMapper.selectBySQL(sql,param);
} }
@Override
@Transactional
public boolean execute(String sql , Map param){
if (sql == null || sql.isEmpty()) {
return false;
}
if (sql.toLowerCase().trim().startsWith("insert")) {
return this.baseMapper.insertBySQL(sql,param);
}
if (sql.toLowerCase().trim().startsWith("update")) {
return this.baseMapper.updateBySQL(sql,param);
}
if (sql.toLowerCase().trim().startsWith("delete")) {
return this.baseMapper.deleteBySQL(sql,param);
}
log.warn("暂未支持的SQL语法");
return true;
}
} }
<?xml version="1.1" encoding="UTF-8" standalone="no"?> <?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<!--输出实体[WF_PSSYSTEM]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_pssystem-15-1">
<createTable tableName="IBZPSSYSTEM">
<column name="PSSYSTEMID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_PSSYSTEM_PSSYSTEMID"/>
</column>
<column name="PSSYSTEMNAME" remarks="" type="VARCHAR(100)">
</column>
</createTable>
</changeSet>
<!--输出实体[WF_GROUP]数据结构 --> <!--输出实体[WF_GROUP]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_group-24-2"> <changeSet author="a_A_5d9d78509" id="tab-wf_group-24-1">
<createTable tableName="IBZWFGROUP"> <createTable tableName="IBZWFGROUP">
<column name="GROUPID" remarks="" type="VARCHAR(100)"> <column name="GROUPID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_GROUP_GROUPID"/> <constraints primaryKey="true" primaryKeyName="PK_WF_GROUP_GROUPID"/>
...@@ -24,7 +14,7 @@ ...@@ -24,7 +14,7 @@
</createTable> </createTable>
</changeSet> </changeSet>
<!--输出实体[WF_DEFINITION]数据结构 --> <!--输出实体[WF_DEFINITION]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_definition-51-3"> <changeSet author="a_A_5d9d78509" id="tab-wf_definition-51-2">
<createTable tableName="IBZWFDEFINITION"> <createTable tableName="IBZWFDEFINITION">
<column name="DEFINITIONKEY" remarks="" type="VARCHAR(100)"> <column name="DEFINITIONKEY" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_DEFINITION_DEFINITIONKEY"/> <constraints primaryKey="true" primaryKeyName="PK_WF_DEFINITION_DEFINITIONKEY"/>
...@@ -48,7 +38,7 @@ ...@@ -48,7 +38,7 @@
</createTable> </createTable>
</changeSet> </changeSet>
<!--输出实体[WF_GROUP_MEMBER]数据结构 --> <!--输出实体[WF_GROUP_MEMBER]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_group_member-39-4"> <changeSet author="a_A_5d9d78509" id="tab-wf_group_member-39-3">
<createTable tableName="IBZWFMEMBER"> <createTable tableName="IBZWFMEMBER">
<column name="MEMBERID" remarks="" type="VARCHAR(100)"> <column name="MEMBERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_GROUP_MEMBER_MEMBERID"/> <constraints primaryKey="true" primaryKeyName="PK_WF_GROUP_MEMBER_MEMBERID"/>
...@@ -62,14 +52,13 @@ ...@@ -62,14 +52,13 @@
</createTable> </createTable>
</changeSet> </changeSet>
<!--输出实体[WF_PSSYSTEM]外键关系 -->
<!--输出实体[WF_GROUP]外键关系 --> <!--输出实体[WF_GROUP]外键关系 -->
<!--输出实体[WF_DEFINITION]外键关系 --> <!--输出实体[WF_DEFINITION]外键关系 -->
<!--输出实体[WF_GROUP_MEMBER]外键关系 --> <!--输出实体[WF_GROUP_MEMBER]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-wf_group_member-39-5"> <changeSet author="a_A_5d9d78509" id="fk-wf_group_member-39-4">
<addForeignKeyConstraint baseColumnNames="GROUPID" baseTableName="IBZWFMEMBER" constraintName="DER1N_WF_GROUP_MEMBER_WF_GROUP" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="GROUPID" referencedTableName="IBZWFGROUP" validate="true"/> <addForeignKeyConstraint baseColumnNames="GROUPID" baseTableName="IBZWFMEMBER" constraintName="DER1N_WF_GROUP_MEMBER_WF_GROUP" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="GROUPID" referencedTableName="IBZWFGROUP" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_A_5d9d78509" id="fk-wf_group_member-39-6"> <changeSet author="a_A_5d9d78509" id="fk-wf_group_member-39-5">
<addForeignKeyConstraint baseColumnNames="USERID" baseTableName="IBZWFMEMBER" constraintName="DER1N_WF_GROUP_MEMBER_WF_USER_" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="USERID" referencedTableName="IBZUSER" validate="true"/> <addForeignKeyConstraint baseColumnNames="USERID" baseTableName="IBZWFMEMBER" constraintName="DER1N_WF_GROUP_MEMBER_WF_USER_" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="USERID" referencedTableName="IBZUSER" validate="true"/>
</changeSet> </changeSet>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册