package com.vci.ubcs.code.dao.impl;
|
|
|
import com.vci.ubcs.code.dao.CodeClassifyTemplateButtonDaoI;
|
import com.vci.ubcs.code.model.CodeClassifyTemplateButtonDO;
|
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.context.annotation.Lazy;
|
import org.springframework.stereotype.Repository;
|
|
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 CodeClassifyTemplateButtonDaoImpl implements CodeClassifyTemplateButtonDaoI {
|
|
/**
|
* 业务类型操作的服务
|
*/
|
@Autowired
|
@Lazy
|
private WebBoServiceI boService;
|
|
/**
|
* 生命周期的服务
|
*/
|
@Autowired
|
private OsLifeCycleServiceI lifeCycleService;
|
|
/**
|
* 使用主键删除
|
* @param oid 数据主键
|
* @return 执行结果
|
*/
|
@Override
|
public BatchCBO deleteByPrimaryKey(String oid){
|
VciBaseUtil.alertNotNull(oid,"主键");
|
CodeClassifyTemplateButtonDO codeClassifyTemplateButtonDO = selectByPrimaryKey(oid);
|
return boService.delete(codeClassifyTemplateButtonDO);
|
}
|
|
/**
|
* 添加数据
|
* @param record 主题库里模板包含的按钮数据对象
|
* @return 执行结果
|
*/
|
@Override
|
public BatchCBO insert(CodeClassifyTemplateButtonDO record){
|
VciBaseUtil.alertNotNull(record,"要添加的数据");
|
return boService.addSave(record);
|
}
|
|
/**
|
* 批量添加数据
|
* @param records 主题库里模板包含的按钮数据对象集合
|
* @return 执行结果数
|
*/
|
@Override
|
public BatchCBO batchInsert(List<CodeClassifyTemplateButtonDO> records){
|
VciBaseUtil.alertNotNull(records,"要添加的数据");
|
BatchCBO batchCBO = boService.batchAddSave(records);
|
return batchCBO;
|
}
|
|
/**
|
* 根据主键查询
|
* @param oid 数据主键
|
* @return 数据对象
|
*/
|
@Override
|
public CodeClassifyTemplateButtonDO selectByPrimaryKey(String oid){
|
VciBaseUtil.alertNotNull(oid,"主键");
|
CodeClassifyTemplateButtonDO record = boService.selectByOid(oid, CodeClassifyTemplateButtonDO.class);
|
if(record == null || StringUtils.isBlank(record.getOid())){
|
throw new VciBaseException(DATA_OID_NOT_EXIST);
|
}
|
return record;
|
}
|
|
/**
|
* 根据主键批量获取对象
|
* @param oids 主键,包含单引号,但是不能超过1000
|
* @return 数据对象列表
|
*/
|
@Override
|
public List<CodeClassifyTemplateButtonDO> selectByPrimaryKeys(String oids){
|
VciBaseUtil.alertNotNull(oids,"主键集合");
|
return boService.selectByOidCollection(VciBaseUtil.str2List(oids), CodeClassifyTemplateButtonDO.class);
|
}
|
|
/**
|
* 根据主键批量查询对象
|
* @param oids 对象主键,使用逗号分隔,但是不能超过1000
|
* @return 业务对象
|
*/
|
@Override
|
public List<CodeClassifyTemplateButtonDO> selectByPrimaryKeyCollection(Collection<String> oids){
|
VciBaseUtil.alertNotNull(oids,"主键集合");
|
return boService.selectByOidCollection(oids, CodeClassifyTemplateButtonDO.class);
|
}
|
|
/**
|
* 查询所有分类
|
* @return 查询结果
|
*/
|
@Override
|
public List<CodeClassifyTemplateButtonDO> selectAll(){
|
return boService.queryObject(CodeClassifyTemplateButtonDO.class,null);
|
}
|
|
/**
|
* 更新对象
|
* @param record 主题库里模板包含的按钮数据对象
|
* @return 执行结果
|
*/
|
@Override
|
public BatchCBO updateByPrimaryKey(CodeClassifyTemplateButtonDO record){
|
VciBaseUtil.alertNotNull(record,"要修改的对象",record.getOid(),"主键");
|
return boService.editSave(record);
|
}
|
/**
|
* 批量更新
|
* @param records 主题库里模板包含的按钮数据对象集合
|
* @return 执行结果行数
|
*/
|
@Override
|
public BatchCBO batchUpdate(List<CodeClassifyTemplateButtonDO> records){
|
VciBaseUtil.alertNotNull(records,"要修改的对象");
|
BatchCBO batchCBO = boService.batchEditSave(records);
|
return batchCBO;
|
}
|
|
/**
|
* 根据查询条件查询数据
|
* @param conditionMap 查询条件,
|
* @param pageHelper 包括分页,排序
|
* @return 数据对象列表
|
*/
|
@Override
|
public List<CodeClassifyTemplateButtonDO> selectByCondition(Map< String,String> conditionMap, PageHelper pageHelper){
|
return boService.queryObject(CodeClassifyTemplateButtonDO.class,conditionMap,pageHelper);
|
}
|
|
/**
|
* 根据查询条件来查询总数
|
* @param conditionMap 查询条件
|
* @return 总数
|
*/
|
@Override
|
public Long countByCondition(Map< String,String> conditionMap){
|
return VciBaseUtil.getLong(String.valueOf(boService.queryCount(CodeClassifyTemplateButtonDO.class,conditionMap)));
|
}
|
|
/**
|
* 根据查询封装器来查询数据
|
* @param queryWrapper 查询封装器
|
* @return 数据对象列表
|
*/
|
@Override
|
public List<CodeClassifyTemplateButtonDO> selectByWrapper(VciQueryWrapperForDO queryWrapper){
|
return boService.selectByQueryWrapper(queryWrapper,CodeClassifyTemplateButtonDO.class);
|
}
|
|
/**
|
* 根据查询封装器来查询总数
|
* @param queryWrapper 查询封装器
|
* @return 总数
|
*/
|
@Override
|
public Long countByWrapper(VciQueryWrapperForDO queryWrapper){
|
return VciBaseUtil.getLong(String.valueOf(boService.countByQueryWrapper(queryWrapper,CodeClassifyTemplateButtonDO.class)));
|
}
|
|
/**
|
* 根据主键获取名称
|
* @param oid 主键
|
* @return 中文名称
|
*/
|
@Override
|
public String selectNameByOid(String oid){
|
return selectByPrimaryKey(oid).getName();
|
}
|
|
|
|
/**
|
* 批量删除对象
|
* @param oids 对象的主键集合
|
* @return 受影响的行数
|
*/
|
@Override
|
public BatchCBO batchDeleteByOids(Collection<String> oids){
|
List<CodeClassifyTemplateButtonDO> dos = boService.selectByOidCollection(oids, CodeClassifyTemplateButtonDO.class);
|
BatchCBO batchCBO = boService.batchDelete(dos);
|
return batchCBO;
|
}
|
|
}
|