Search in sources :

Example 6 with EnterpriseExample

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;
}
Also used : EnterpriseExample(com.itrus.portal.db.EnterpriseExample)

Example 7 with EnterpriseExample

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;
    }
}
Also used : EnterpriseExample(com.itrus.portal.db.EnterpriseExample) Enterprise(com.itrus.portal.db.Enterprise) Date(java.util.Date)

Example 8 with EnterpriseExample

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;
}
Also used : EnterpriseExample(com.itrus.portal.db.EnterpriseExample) Enterprise(com.itrus.portal.db.Enterprise)

Example 9 with EnterpriseExample

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;
    }
}
Also used : EnterpriseExample(com.itrus.portal.db.EnterpriseExample) Enterprise(com.itrus.portal.db.Enterprise) Date(java.util.Date)

Example 10 with EnterpriseExample

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;
}
Also used : EnterpriseExample(com.itrus.portal.db.EnterpriseExample) Enterprise(com.itrus.portal.db.Enterprise)

Aggregations

EnterpriseExample (com.itrus.portal.db.EnterpriseExample)11 Enterprise (com.itrus.portal.db.Enterprise)10 HashMap (java.util.HashMap)3 Bill (com.itrus.portal.db.Bill)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 Agent (com.itrus.portal.db.Agent)1 BillExample (com.itrus.portal.db.BillExample)1 Certification (com.itrus.portal.db.Certification)1 Product (com.itrus.portal.db.Product)1 Project (com.itrus.portal.db.Project)1 UserInfo (com.itrus.portal.db.UserInfo)1 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)1 Calendar (java.util.Calendar)1 List (java.util.List)1 Map (java.util.Map)1