use of com.itrus.portal.db.EnterpriseExample in project portal by ixinportal.
the class EnterpriseServiceImpl method getEnterpriseIdsByCertification.
/**
* 根据认证等级查询企业id
*
* @param certificationIds
* @return
*/
public List<Long> getEnterpriseIdsByCertification(List<Long> certificationIds) {
EnterpriseExample enterpriseExample = new EnterpriseExample();
EnterpriseExample.Criteria criteria = enterpriseExample.or();
criteria.andAuthenticationLevelIn(certificationIds);
List<Long> enterpriseIds = sqlSession.selectList("com.itrus.portal.db.EnterpriseMapper.selectEnterpriseIdsByLevel", enterpriseExample);
return enterpriseIds;
}
use of com.itrus.portal.db.EnterpriseExample in project portal by ixinportal.
the class EnterpriseServiceImpl method addEnterPrise.
/**
* 如果根据企业名称能查询到企业,就修改 如果查不到就新建企业 szy 2016年8月22日 下午3:10:30
*
* @param enterprise
* @return Enterprise
*/
public Enterprise addEnterPrise(Enterprise enterprise) {
EnterpriseExample example = new EnterpriseExample();
EnterpriseExample.Criteria criteria = example.or();
criteria.andEnterpriseNameEqualTo(enterprise.getEnterpriseName());
Enterprise enterprise0 = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByExample", example);
if (null != enterprise0) {
enterprise0.setEnterpriseSn(enterprise.getEnterpriseSn());
enterprise0.setEnterpriseNature(enterprise.getEnterpriseNature());
enterprise0.setOrgIndustry(enterprise.getOrgIndustry());
sqlSession.update("com.itrus.portal.db.EnterpriseMapper.updateByPrimaryKey", enterprise0);
sqlSession.flushStatements();
return enterprise0;
} else {
// 新增
enterprise.setCreateTime(new Date());
// 设置企业标识
sqlSession.insert("com.itrus.portal.db.EnterpriseMapper.insert", enterprise);
sqlSession.flushStatements();
return enterprise;
}
}
use of com.itrus.portal.db.EnterpriseExample in project portal by ixinportal.
the class EnterpriseServiceImpl method getEntByEnterpriseSn.
/**
* 根据企业sn,查找企业
* @param enterpriseSn
* @return
*/
public Enterprise getEntByEnterpriseSn(String enterpriseSn) {
EnterpriseExample example = new EnterpriseExample();
EnterpriseExample.Criteria criteria = example.or();
criteria.andEnterpriseSnEqualTo(enterpriseSn);
Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByExample", example);
return enterprise;
}
use of com.itrus.portal.db.EnterpriseExample in project portal by ixinportal.
the class EnterpriseServiceImpl method saveOrUpdateEnterprise.
/**
* 根据企业名称查看企业是否已经存在,存在则修改,不存在则添加
*
* @param enterprise
* @return
*/
public Enterprise saveOrUpdateEnterprise(Enterprise enterprise) {
EnterpriseExample example = new EnterpriseExample();
EnterpriseExample.Criteria criteria = example.or();
enterprise.setEnterpriseName(enterprise.getEnterpriseName().trim());
criteria.andEnterpriseNameEqualTo(enterprise.getEnterpriseName());
Enterprise enterprise0 = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByExample", example);
if (null != enterprise0) {
// 修改
enterprise0.setEnterpriseNature(enterprise.getEnterpriseNature());
enterprise0.setOrgIndustry(enterprise.getOrgIndustry());
enterprise0.setAuthenticationLevel(null);
enterprise0.setHasBl(null);
enterprise0.setHasOrgCode(null);
enterprise0.setHasTaxCert(null);
enterprise0.setHasIdCard(null);
enterprise0.setHasAgent(null);
sqlSession.update("com.itrus.portal.db.EnterpriseMapper.updateByPrimaryKey", enterprise0);
sqlSession.flushStatements();
return enterprise0;
} else {
// 新增
enterprise.setCreateTime(new Date());
// 修复新增企业自动给企业生成唯一标识的bug
if (StringUtils.isBlank(enterprise.getEnterpriseSn())) {
// 设置企业标识
enterprise.setEnterpriseSn(UniqueIDUtils.genEnterpriseUID(sqlSession));
}
sqlSession.insert("com.itrus.portal.db.EnterpriseMapper.insert", enterprise);
sqlSession.flushStatements();
return enterprise;
}
}
use of com.itrus.portal.db.EnterpriseExample in project portal by ixinportal.
the class EnterpriseServiceImpl method getEntByName.
/**
* 根据企业名称获取企业信息 szy 2016年8月24日 下午4:49:11
*
* @param enterpriseName
* @return Enterprise
*/
public Enterprise getEntByName(String enterpriseName) {
EnterpriseExample example = new EnterpriseExample();
EnterpriseExample.Criteria criteria = example.or();
criteria.andEnterpriseNameEqualTo(enterpriseName);
example.setOrderByClause("create_time desc");
example.setLimit(1);
Enterprise enterprise = sqlSession.selectOne("com.itrus.portal.db.EnterpriseMapper.selectByExample", example);
return enterprise;
}
Aggregations