package org.springblade.code.dao.impl;
|
|
import com.vci.mdm.dao.CodeClassifyProcessTempDaoI;
|
import com.vci.mdm.model.CodeClassifyProcessTempDO;
|
import com.vci.starter.web.exception.VciBaseException;
|
import com.vci.starter.web.pagemodel.PageHelper;
|
import com.vci.starter.web.util.VciBaseUtil;
|
import com.vci.starter.web.wrapper.VciQueryWrapperForDO;
|
import com.vci.web.pageModel.BatchCBO;
|
import com.vci.web.service.OsLifeCycleServiceI;
|
import com.vci.web.service.WebBoServiceI;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Repository;
|
import org.springframework.util.CollectionUtils;
|
import plm.bs.bom.clientobject.ClientBusinessObject;
|
|
import java.util.Collection;
|
import java.util.List;
|
import java.util.Map;
|
|
import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST;
|
|
|
/**
|
* 分类使用的流程模板数据操作层实现类
|
*
|
* @author weidy
|
* @date 2022-01-24
|
*/
|
@Repository
|
public class CodeClassifyProcessTempDaoImpl implements CodeClassifyProcessTempDaoI{
|
|
/**
|
* 业务类型操作的服务
|
*/
|
@Autowired
|
private WebBoServiceI boService;
|
|
/**
|
* 生命周期的服务
|
*/
|
@Autowired
|
private OsLifeCycleServiceI lifeCycleService;
|
|
/**
|
* 使用主键删除
|
* @param oid 数据主键
|
* @return 执行结果
|
*/
|
@Override
|
public BatchCBO deleteByPrimaryKey(String oid){
|
VciBaseUtil.alertNotNull(oid,"主键");
|
CodeClassifyProcessTempDO codeClassifyProcessTempDO = selectByPrimaryKey(oid);
|
return boService.delete(codeClassifyProcessTempDO);
|
}
|
|
/**
|
* 添加数据
|
* @param record 分类使用的流程模板数据对象
|
* @return 执行结果
|
*/
|
@Override
|
public BatchCBO insert(CodeClassifyProcessTempDO record){
|
VciBaseUtil.alertNotNull(record,"要添加的数据");
|
return boService.addSave(record);
|
}
|
|
/**
|
* 批量添加数据
|
* @param records 分类使用的流程模板数据对象集合
|
* @return 执行结果数
|
*/
|
@Override
|
public BatchCBO batchInsert(List<CodeClassifyProcessTempDO> records){
|
VciBaseUtil.alertNotNull(records,"要添加的数据");
|
BatchCBO batchCBO = boService.batchAddSave(records);
|
return batchCBO;
|
}
|
|
/**
|
* 根据主键查询
|
* @param oid 数据主键
|
* @return 数据对象
|
*/
|
@Override
|
public CodeClassifyProcessTempDO selectByPrimaryKey(String oid){
|
VciBaseUtil.alertNotNull(oid,"主键");
|
CodeClassifyProcessTempDO record = boService.selectByOid(oid, CodeClassifyProcessTempDO.class);
|
if(record == null || StringUtils.isBlank(record.getOid())){
|
throw new VciBaseException(DATA_OID_NOT_EXIST);
|
}
|
return record;
|
}
|
|
/**
|
* 根据主键批量获取对象
|
* @param oids 主键,包含单引号,但是不能超过1000
|
* @return 数据对象列表
|
*/
|
@Override
|
public List<CodeClassifyProcessTempDO> selectByPrimaryKeys(String oids){
|
VciBaseUtil.alertNotNull(oids,"主键集合");
|
return boService.selectByOidCollection(VciBaseUtil.str2List(oids), CodeClassifyProcessTempDO.class);
|
}
|
|
/**
|
* 根据主键批量查询对象
|
* @param oids 对象主键,使用逗号分隔,但是不能超过1000
|
* @return 业务对象
|
*/
|
@Override
|
public List<CodeClassifyProcessTempDO> selectByPrimaryKeyCollection(Collection<String> oids){
|
VciBaseUtil.alertNotNull(oids,"主键集合");
|
return boService.selectByOidCollection(oids, CodeClassifyProcessTempDO.class);
|
}
|
|
/**
|
* 查询所有分类
|
* @return 查询结果
|
*/
|
@Override
|
public List<CodeClassifyProcessTempDO> selectAll(){
|
return boService.queryObject(CodeClassifyProcessTempDO.class,null);
|
}
|
|
/**
|
* 更新对象
|
* @param record 分类使用的流程模板数据对象
|
* @return 执行结果
|
*/
|
@Override
|
public BatchCBO updateByPrimaryKey(CodeClassifyProcessTempDO record){
|
VciBaseUtil.alertNotNull(record,"要修改的对象",record.getOid(),"主键");
|
return boService.editSave(record);
|
}
|
/**
|
* 批量更新
|
* @param records 分类使用的流程模板数据对象集合
|
* @return 执行结果行数
|
*/
|
@Override
|
public BatchCBO batchUpdate(List<CodeClassifyProcessTempDO> records){
|
VciBaseUtil.alertNotNull(records,"要修改的对象");
|
BatchCBO batchCBO = boService.batchEditSave(records);
|
return batchCBO;
|
}
|
|
/**
|
* 根据查询条件查询数据
|
* @param conditionMap 查询条件,
|
* @param pageHelper 包括分页,排序
|
* @return 数据对象列表
|
*/
|
@Override
|
public List<CodeClassifyProcessTempDO> selectByCondition(Map< String,String> conditionMap, PageHelper pageHelper){
|
return boService.queryObject(CodeClassifyProcessTempDO.class,conditionMap,pageHelper);
|
}
|
|
/**
|
* 根据查询条件来查询总数
|
* @param conditionMap 查询条件
|
* @return 总数
|
*/
|
@Override
|
public Long countByCondition(Map< String,String> conditionMap){
|
return VciBaseUtil.getLong(String.valueOf(boService.queryCount(CodeClassifyProcessTempDO.class,conditionMap)));
|
}
|
|
/**
|
* 根据查询封装器来查询数据
|
* @param queryWrapper 查询封装器
|
* @return 数据对象列表
|
*/
|
@Override
|
public List<CodeClassifyProcessTempDO> selectByWrapper(VciQueryWrapperForDO queryWrapper){
|
return boService.selectByQueryWrapper(queryWrapper,CodeClassifyProcessTempDO.class);
|
}
|
|
/**
|
* 根据查询封装器来查询总数
|
* @param queryWrapper 查询封装器
|
* @return 总数
|
*/
|
@Override
|
public Long countByWrapper(VciQueryWrapperForDO queryWrapper){
|
return VciBaseUtil.getLong(String.valueOf(boService.countByQueryWrapper(queryWrapper,CodeClassifyProcessTempDO.class)));
|
}
|
|
/**
|
* 根据主键获取名称
|
* @param oid 主键
|
* @return 中文名称
|
*/
|
@Override
|
public String selectNameByOid(String oid){
|
return selectByPrimaryKey(oid).getName();
|
}
|
|
|
/**
|
* 批量修改生命周期的状态
|
* @param oids 主键集合,不能大于1000
|
* @param lcStatus 生命周期的值
|
* @return 执行的结果
|
*/
|
@Override
|
public long batchUpdateLcStatus(Collection<String> oids, String lcStatus){
|
List<ClientBusinessObject> cbos = boService.selectCBOByOidCollection(oids, "codeclsflowtemp");
|
if(CollectionUtils.isEmpty(cbos)){
|
return 0;
|
}
|
lifeCycleService.transCboStatus(cbos,lcStatus);
|
return cbos.size();
|
}
|
/**
|
* 根据主键更新状态
|
* @param oid 主键
|
* @param lcStatus 生命周期状态
|
* @return 受影响的行数
|
*/
|
@Override
|
public int updateLcStatus( String oid, String lcStatus){
|
ClientBusinessObject cbo = boService.selectCBOByOid(oid, "codeclsflowtemp");
|
if(cbo == null || StringUtils.isBlank(cbo.getOid())){
|
return 0;
|
}
|
lifeCycleService.transStatus(cbo.getBusinessObject(),lcStatus);
|
return 1;
|
}
|
|
/**
|
* 批量删除对象
|
* @param oids 对象的主键集合
|
* @return 受影响的行数
|
*/
|
@Override
|
public BatchCBO batchDeleteByOids(Collection<String> oids){
|
List<CodeClassifyProcessTempDO> dos = boService.selectByOidCollection(oids, CodeClassifyProcessTempDO.class);
|
BatchCBO batchCBO = boService.batchDelete(dos);
|
return batchCBO;
|
}
|
|
}
|