package com.vci.web.dao.impl;
|
|
import com.vci.starter.web.exception.VciBaseException;
|
import com.vci.starter.web.pagemodel.PageHelper;
|
import com.vci.starter.web.util.VciBaseUtil;
|
import com.vci.web.dao.OsCodeGenSchemaDaoI;
|
import com.vci.model.OsCodeGenSchemaDO;
|
import com.vci.web.service.OsLinkTypeServiceI;
|
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 java.util.List;
|
import java.util.Map;
|
|
import static com.vci.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST;
|
|
|
/**
|
* 代码生成器的内容
|
* @author weidy
|
* @date 2021/8/23
|
*/
|
@Repository
|
public class OsCodeGenSchemaDaoImpl implements OsCodeGenSchemaDaoI {
|
|
/**
|
* 业务类型操作的服务
|
*/
|
@Autowired
|
private WebBoServiceI boService;
|
|
/**
|
* 生命周期的服务
|
*/
|
@Autowired
|
private OsLinkTypeServiceI lifeCycleService;
|
/**
|
* 使用主键删除
|
*
|
* @param oid 主键
|
* @return 受影响的个数
|
*/
|
@Override
|
public int deleteByPrimaryKey(String oid) {
|
VciBaseUtil.alertNotNull(oid,"主键");
|
OsCodeGenSchemaDO osCodeGenSchemaDO = selectByPrimaryKey(oid);
|
boService.delete(osCodeGenSchemaDO);
|
return 1;
|
}
|
|
/**
|
* 插入数据
|
*
|
* @param record 数据的对象
|
* @return 受影响的个数
|
*/
|
@Override
|
public int insert(OsCodeGenSchemaDO record) {
|
VciBaseUtil.alertNotNull(record,"要添加的数据");
|
boService.addSave(record);
|
return 1;
|
}
|
|
/**
|
* 使用主键查询
|
*
|
* @param oid 主键
|
* @return 数据对象
|
*/
|
@Override
|
public OsCodeGenSchemaDO selectByPrimaryKey(String oid) {
|
VciBaseUtil.alertNotNull(oid,"主键");
|
OsCodeGenSchemaDO schemaDO = boService.selectByOid(oid, OsCodeGenSchemaDO.class);
|
if(schemaDO == null || StringUtils.isBlank(schemaDO.getOid())){
|
throw new VciBaseException(DATA_OID_NOT_EXIST);
|
}
|
return schemaDO;
|
}
|
|
/**
|
* 查询全部
|
*
|
* @return 数据对象
|
*/
|
@Override
|
public List<OsCodeGenSchemaDO> selectAll() {
|
return boService.queryObject(OsCodeGenSchemaDO.class,null);
|
}
|
|
/**
|
* 使用主键更新
|
*
|
* @param record 数据对象
|
* @return 受影响的行数
|
*/
|
@Override
|
public int updateByPrimaryKey(OsCodeGenSchemaDO record) {
|
VciBaseUtil.alertNotNull(record,"要修改的对象",record.getOid(),"主键");
|
boService.editSave(record);
|
return 1;
|
}
|
|
/**
|
* 根据查询条件查询数据
|
*
|
* @param conditionMap 查询条件
|
* @param pageHelper 分页对象
|
* @return 数据对象列表
|
*/
|
@Override
|
public List<OsCodeGenSchemaDO> selectByWrapper(Map< String, String> conditionMap, PageHelper pageHelper) {
|
return boService.queryObject(OsCodeGenSchemaDO.class,conditionMap,pageHelper);
|
}
|
|
/**
|
* 根据查询条件来查询总数
|
*
|
* @param conditionMap 查询条件
|
* @return 总数
|
*/
|
@Override
|
public Integer countByWrapper(Map<String, String> conditionMap) {
|
return boService.queryCount(OsCodeGenSchemaDO.class,conditionMap);
|
}
|
|
}
|