文档章节

spring data jpa 查询使用案例

6x5_
 6x5_
发布于 2016/09/18 14:21
字数 1852
阅读 113
收藏 0
/**
 * 
 */
public String getSumAmount(final AcctDtlSearchDto searchDto, final ERecvPayFlag recvPayFlag) {  
	String startDate = searchDto.getStartDate();                                                
	String endDate = searchDto.getEndDate();                                                    
	EUseType useType = searchDto.getUseType();                                                  
	CriteriaBuilder builder = em.getCriteriaBuilder();                                          
	CriteriaQuery<BigDecimal> query = builder.createQuery(BigDecimal.class);                    
	Root<SubAcctTrxJnlPo> root = query.from(SubAcctTrxJnlPo.class);                             
	Predicate predicate = builder.conjunction();                                                
	List<Expression<Boolean>> expressions = predicate.getExpressions();                         
	Expression<BigDecimal> sumTrxAmt = builder.sum(root.<BigDecimal> get("trxAmt"));            
	if (StringUtils.isNotBlank(startDate)) {                                                    
		expressions.add(builder.greaterThanOrEqualTo(root.<String> get("trxDate"), startDate)); 
	}                                                                                           
	if (StringUtils.isNotBlank(endDate)) {                                                      
		expressions.add(builder.lessThanOrEqualTo(root.<String> get("trxDate"), endDate));      
	}                                                                                           
	if (EUseType.ALL != useType) {                                                              
		expressions.add(builder.equal(root.<EUseType> get("useType"), useType));                
	}                                                                                           
	if (null != recvPayFlag) {                                                                  
		expressions.add(builder.equal(root.<ERecvPayFlag> get("recvPayFlag"), recvPayFlag));    
	}                                                                                           
	query.where(predicate);                                                                     
	query.select(sumTrxAmt);                                                                    
	BigDecimal result = em.createQuery(query).getSingleResult();                                
	result = (null == result ? BigDecimal.ZERO : result);                                       
	return result.toString();                                                                   
}                   



/**
 * 
 */
private BigDecimal getWarrantedProjectAmt(final String userId) {
	List<ProjectPo> list = projectRepository.findAll(new Specification<ProjectPo>() {
	@Override
	public Predicate toPredicate(Root<ProjectPo> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
		Predicate predicate = cb.conjunction();
		List<Expression<Boolean>> expressions = predicate.getExpressions();
		expressions.add(cb.equal(root.<String> get("wrtrId"), userId));
		List<EProjStatus> inStatus = Arrays.asList(EProjStatus.RISK_AUDIT, EProjStatus.RISK_RATING);
		expressions.add(root.<EProjStatus> get("status").in(inStatus));
		return predicate;
		}
	});
	BigDecimal warrantAmt = BigDecimal.ZERO;
	for (ProjectPo proj : list) {
		warrantAmt = warrantAmt.add(proj.getProjectAmt());
	}
	return warrantAmt;
}



/**
 * 
 */
public List<ProdServItemDto> getItems(final ProdServItemSearchDto searchDto, final String currUserId){
	long times = System.currentTimeMillis();
	List<ProdServInfoPo> list = prodServInfoRepo.findAll(new Specification<ProdServInfoPo>(){
		@Override
		public Predicate toPredicate(Root<ProdServInfoPo> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
			Predicate predicate = cb.conjunction();
			String workDate = CommonBusinessUtil.getCurrentWorkDate();
                List<Expression<Boolean>> expressions = predicate.getExpressions();
                // 已授信过滤
                expressions.add(cb.exists(getProdServParamSubQuery(query, cb, workDate, root.<String>get("userId"))));
                if(StringUtils.isNotBlank(searchDto.getName())){
                	expressions.add(cb.like(root.<EnterpriseInfoPo>get("enterpriseInfoPo").<String>get("name"), "%"+searchDto.getName()+"%"));
                }
                if(StringUtils.isNotBlank(searchDto.getTelephone())){
                	expressions.add(cb.like(root.<EnterpriseInfoPo>get("enterpriseInfoPo").<String>get("telephone"), "%"+searchDto.getTelephone()+"%"));
                }
                Expression<Boolean> servProvTypes = root.<EWarrantProdServProvType> get("servProvType").in(EWarrantProdServProvType.MICRO_CMPY, EWarrantProdServProvType.WRTR_CMPY);
                Expression<Boolean> unionServProvType = cb.and(
                		cb.equal(root.<EWarrantProdServProvType> get("servProvType"), EWarrantProdServProvType.UNION_CMPY), 
                		cb.exists(getSubQuery(query, cb, currUserId, root.<String> get("userId"))));
                expressions.add(cb.or(servProvTypes, unionServProvType));
                /** 如果是小贷,不显示自己 **/
                expressions.add(cb.notEqual(root.<String>get("userId"), currUserId));
                return predicate;
			}
			private Subquery<String> getSubQuery(CriteriaQuery<?> query, 
					CriteriaBuilder cb, String fncrId, Path<String> prodServUserId) {
                Subquery<String> subQuery = query.subquery(String.class);
                Root<ProdServInfoPo> prodServ = subQuery.from(ProdServInfoPo.class);
                Join<ProdServInfoPo, ProdServGroupPo> prodServGroup = prodServ.join("prodServGroupList", JoinType.INNER);
                Join<ProdServGroupPo, GroupPo> group = prodServGroup.join("groupPo", JoinType.INNER);
                Join<GroupPo, GroupUserPo> groupUser = group.join("groupUserPoSet", JoinType.INNER);
                Join<GroupUserPo, FncrInfoPo> fncrInfo = groupUser.join("fncrInfoPo", JoinType.INNER);
                return subQuery.select(prodServ.<String>get("userId")).where(
                		cb.and(cb.equal(prodServ.get("userId"), prodServUserId), 
                				cb.equal(fncrInfo.<String> get("userId"), fncrId)));
            }
			
			private Subquery<String> getProdServParamSubQuery(CriteriaQuery<?> query, 
					CriteriaBuilder cb, String workDate, Path<String> userId) {
                Subquery<String> subQuery = query.subquery(String.class);
                Root<ProdServParamPo> param = subQuery.from(ProdServParamPo.class);
                return subQuery.select(param.<String>get("userId")).where(
                		cb.and(cb.equal(param.get("userId"), userId), 
                				cb.lessThanOrEqualTo(param.<String>get("startDate"), workDate), 
                				cb.greaterThanOrEqualTo(param.<String>get("endDate"), workDate)
                		));
			}
		});
		List<ProdServItemDto> items = new ArrayList<ProdServItemDto>();
		for(ProdServInfoPo serv: list){
			EnterpriseInfoPo ent = serv.getEnterpriseInfoPo();
			ProdServItemDto item = new ProdServItemDto();
			item.setUserId(serv.getUserId());
			item.setWrtrKind(serv.getWrtrKind());
			item.setServProvType(serv.getServProvType());
			item.setQq(ent.getQq());
			item.setName(ent.getName());
			item.setAddress(ent.getAddress());
			item.setZipCode(ent.getZipCode());
			item.setContractName(ent.getContractName());
			item.setTelephone(ent.getTelephone());
			item.setWrtrFileId(serv.getWrtrFileId());
			items.add(item);
		}
		logger.debug("cost times is {} ms", (System.currentTimeMillis()-times));
		return items;
	}
	
//expressions.add(cb.greaterThanOrEqualTo(root.<Date> get("createTs"), DateUtils.getStartDate(DateUtils.getDate(fromDate, YYYY_MM_DD))));
//expressions.add(cb.lessThanOrEqualTo(root.<Date> get("createTs"), DateUtils.getEndDate(DateUtils.getDate(toDate, YYYY_MM_DD))));

/**
*公告查询,这里主要看根据roleIds 不同用户显示不同的公告
*/
public DataTablesResponseDto<ArticleDto> getArticlesForHome(final ArticleSearchDto searchCriteria) {
Pageable pageable = PaginationUtil.buildPageable(searchCriteria,
		PersistenceUtil.getIdName(ArticlePo.class));
Specification<ArticlePo> specification = new Specification<ArticlePo>() {
	@Override
	public Predicate toPredicate(Root<ArticlePo> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
		Predicate predicate = cb.conjunction();
		List<Expression<Boolean>> expressions = predicate.getExpressions();
		if (null != searchCriteria) {
			String nowDateStr = DateUtils.formatDate(new Date(), ApplicationConsts.DATE_FORMAT);
			EArticleStatus status = searchCriteria.getStatus();
			EColumnCategory categoryId = searchCriteria.getCategoryId();
			List<Predicate> predicateList = new ArrayList<Predicate>();
			List<UserRolePo> userRolePoList = userRoleRepository.findByUserId(securityContext
					.getCurrentUserId());

			for (UserRolePo userRole : userRolePoList) {
				predicateList.add(cb.like(root.<String> get("roleIds"), "%" + userRole.getRoleId()
						+ "%"));
			}
			predicateList.add(cb.isNull(root.<String> get("roleIds")));

			Predicate[] predicate1 = new Predicate[predicateList.size()];
			Predicate predicate2 = cb.or(predicateList.toArray(predicate1));
			expressions.add(predicate2);

			expressions.add(cb.lessThanOrEqualTo(root.<String> get("startDt"), nowDateStr));
			expressions.add(cb.greaterThanOrEqualTo(root.<String> get("endDt"), nowDateStr));
			if (EArticleStatus.ALL != status && null != status) {
				expressions.add(cb.equal(root.<EArticleStatus> get("status"), status));
			}
			if (EColumnCategory.ALL != categoryId && null != categoryId) {
				expressions.add(cb.equal(root.<EColumnCategory> get("categoryId"), categoryId));
			}
		}
		return predicate;
	}
};
Page<ArticlePo> articlePos = articleRepository.findAll(specification, pageable);
DataTablesResponseDto<ArticleDto> result = PaginationUtil.populateFromPage(articlePos,
		new Function<ArticlePo, ArticleDto>() {
			@Override
			public ArticleDto apply(ArticlePo po) {
				ArticleDto articleDto = ConverterService.convert(po, ArticleDto.class);
				return articleDto;
			}
		});
return result;
}



/**
 * 
 */
public BigDecimal getSumInvstAmt(String acctNo, String productId){
	CriteriaBuilder cb = em.getCriteriaBuilder();
	CriteriaQuery<BigDecimal> query = cb.createQuery(BigDecimal.class);
	Root<ProductSubscribeDtlPo> root = query.from(ProductSubscribeDtlPo.class);
	Expression<BigDecimal> subsAmtCm = cb.prod(root.<BigDecimal>get("unitAmt"), root.<Long>get("unit").as(BigDecimal.class));
	Expression<BigDecimal> sumSubAmtQuery = cb.sum(subsAmtCm);
	Predicate predicate = cb.conjunction();
	List<Expression<Boolean>> expressions = predicate.getExpressions();
	if(StringUtils.isNotBlank(acctNo)){
		expressions.add(cb.equal(root.<String>get("acctNo"), acctNo));
	}
	if(StringUtils.isNotBlank(productId)){
		expressions.add(cb.equal(root.<String>get("productId"), productId));
	}
	query.select(sumSubAmtQuery);
	query.where(predicate);
	BigDecimal result = em.createQuery(query).getSingleResult();
	return result==null?BigDecimal.ZERO:result;
}


/**
 * 
 */
private List<ProjectPo> getProjectByFncrId(final String fncrAcctNo) {
	List<ProjectPo> list = projectRepository.findAll(new Specification<ProjectPo>() {
		@Override
		public Predicate toPredicate(Root<ProjectPo> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
			Predicate predicate = cb.conjunction();
			List<Expression<Boolean>> expressions = predicate.getExpressions();
			expressions.add(cb.equal(root.<String> get("fncrAcctNo"), fncrAcctNo));
			List<EProjStatus> inStatus = Arrays.asList(EProjStatus.INIT, EProjStatus.WRTR_AUDIT,
					EProjStatus.RISK_AUDIT, EProjStatus.RISK_RATING, EProjStatus.PASSED);
			expressions.add(root.<EProjStatus> get("status").in(inStatus));
			return predicate;
		}
	});
	return list;
}


/**
 * 
 */
@Transactional(readOnly = true)
public List<SimpleMemberDto> searchFncrMembers(final String keyWord) {
	Sort sort = new Sort(Direction.ASC, PersistenceUtil.getIdName(AcctPo.class));
	Pageable pageable = new PageRequest(0, 20, sort);
	Page<AcctPo> page = acctRepository.findAll(new Specification<AcctPo>() {
		@Override
		public Predicate toPredicate(Root<AcctPo> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
			Predicate predicate = cb.conjunction();
			List<Expression<Boolean>> expressions = predicate.getExpressions();
			expressions.add(cb.exists(getSubQuery(query, cb, root.<String>get("userId"))));
			String keyWordTrim = keyWord.trim();
			if (StringUtils.isNotBlank(keyWord)) {
				expressions.add(cb.or(
						cb.like(root.<String> get("acctNo"), "%" + keyWordTrim + "%"),
						cb.or(cb.like(root.<UserPo> get("userPo").<String> get("sname"), "%" + keyWordTrim
								+ "%"),
								cb.like(root.<UserPo> get("userPo").<String> get("mobile"), "%" + keyWordTrim
										+ "%"))));
			} else {
				expressions.add(cb.equal(root.<String> get("acctNo"), "0"));
			}
			return predicate;
		}
		
		private Subquery<String> getSubQuery(CriteriaQuery<?> query, 
				CriteriaBuilder cb, Path<String> userId) {
			Subquery<String> subQuery = query.subquery(String.class);
			Root<SimpleUserPo> suser = subQuery.from(SimpleUserPo.class);
			Join<SimpleUserPo, FncrInfoPo> fncrInfo = suser.join("fncrInfoPo", JoinType.INNER);
			return subQuery.select(suser.<String>get("userId")).where(
					cb.and(cb.equal(suser.get("userId"), userId), 
							cb.equal(suser.get("userId"), fncrInfo.<String> get("userId"))));
		}
	}, pageable);
	List<SimpleMemberDto> items = new ArrayList<SimpleMemberDto>();
	List<AcctPo> list = page.getContent();
	for (AcctPo acct : list) {
		SimpleMemberDto dto = new SimpleMemberDto();
		UserPo userPo = acct.getUserPo();
		StringBuilder label = new StringBuilder();
		String sname = userPo.getSname();
		String mobile = userPo.getMobile();
		mobile = null == mobile ? "":mobile;
		String acctNo = acct.getAcctNo();
		dto.setAcctNo(acctNo);
		dto.setSname(sname);
		dto.setMobile(mobile);
		label.append("姓名:");
		label.append(sname);
		label.append(",手机号:");
		label.append(mobile);
		label.append(",交易账号:");
		label.append(acctNo);
		dto.setLabel(label.toString());
		items.add(dto);
	}
	return items;
}


/**
 * 
 */
public List<GroupUserInfoDto> getInvsUsers(final GroupUserSearchDto searchDto) {
	Specification<UserPo> spec = new Specification<UserPo>() {
		@Override
		public Predicate toPredicate(Root<UserPo> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
			Predicate predicate = cb.conjunction();
			List<Expression<Boolean>> expressions = predicate.getExpressions();
			expressions.add(cb.not(cb.exists(getSubQuery(query, cb, searchDto.getGroupId(), root.<String> get("userId")))));
			if(searchDto!=null){
				if(StringUtils.isNotBlank(searchDto.getKeyWord())){
					expressions.add(cb.or(
						cb.like(root.<String>get("sname"), "%"+searchDto.getKeyWord()+"%"),
						cb.like(root.<String>get("nickName"), "%"+searchDto.getKeyWord()+"%"),
						cb.like(root.<String>get("mobile"), "%"+searchDto.getKeyWord()+"%"),
						cb.exists(getWorkUnitSubQuery(query, cb, searchDto.getKeyWord(), root.<String> get("userId")))
					));
				}
				else{
					// 未传关键字查询条件,则查询结果为空
					expressions.add(cb.equal(root.<String>get("userId"),"0"));
				}
			}
			return predicate;
		}
		private Subquery<String> getSubQuery(CriteriaQuery<?> query, 
				CriteriaBuilder cb, String groupId, Path<String> userId) {
			Subquery<String> subQuery = query.subquery(String.class);
			Root<GroupUserPo> groupUsers = subQuery.from(GroupUserPo.class);
			return subQuery.select(groupUsers.<String>get("userId")).where(
					cb.and(cb.equal(groupUsers.<String> get("groupId"), groupId)), 
					cb.equal(groupUsers.<String> get("userId"), userId));
		}
		private Subquery<String> getWorkUnitSubQuery(CriteriaQuery<?> query, 
				CriteriaBuilder cb, String keyWord, Path<String> userId) {
			Subquery<String> subQuery = query.subquery(String.class);
			Root<PersonalInfoPo> personalInfo = subQuery.from(PersonalInfoPo.class);
			return subQuery.select(personalInfo.<String>get("userId")).where(
					cb.equal(personalInfo.<String> get("userId"), userId),
					cb.like(personalInfo.<String> get("workUnit"), "%"+searchDto.getKeyWord()+"%"));
		}
		
	};
	List<UserPo> userList = userRepository.findAll(spec);
	List<GroupUserInfoDto> dtoList = new ArrayList<GroupUserInfoDto>();
	for(UserPo ur:userList){
		GroupUserInfoDto dto = new GroupUserInfoDto();
		dto.setName(ur.getSname());
		dto.setNickName(ur.getNickName());
		dto.setUserType(ur.getUserType());
		dto.setUserId(ur.getUserId());
		if(ur.getUserType() == EUserType.PERSON){
			PersonalInfoPo persnoalInfo = personalInfoRepository.findOne(ur.getUserId());
			if(persnoalInfo!=null){
				dto.setWorkUnit(persnoalInfo.getWorkUnit());
			}
		}
		else{
			dto.setWorkUnit(null);
		}
		dtoList.add(dto);
	}
	return dtoList;
}
	

/**
 * json
 */
private Specification<Qfjbxxdz> getWhereClause(final JSONArray condetion,final JSONArray search) {
	return new Specification<Qfjbxxdz>() {
		@Override
		public Predicate toPredicate(Root<Qfjbxxdz> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
			List<Predicate> predicate = new ArrayList<>();
			Iterator<JSONObject> iterator = condetion.iterator();
			Predicate preP = null;
			while(iterator.hasNext()){
				JSONObject jsonObject = iterator.next();
				//注意:这里用的root.join 因为我们要用qfjbxx对象里的字段作为条件就必须这样做join方法有很多重载,使用的时候可以多根据自己业务决断
				Predicate p1 = cb.equal(root.join("qfjbxx").get("id").as(String.class),jsonObject.get("fzId").toString());
				Predicate p2 = cb.equal(root.get("fzcc").as(String.class),jsonObject.get("ccId").toString());
				if(preP!=null){
					preP = cb.or(preP,cb.and(p1,p2));
				}else{
					preP = cb.and(p1,p2);
				}
			}
			JSONObject jsonSearch=(JSONObject) search.get(0);
			Predicate p3=null;
			if(null!=jsonSearch.get("xm")&&jsonSearch.get("xm").toString().length()>0){
			   p3=cb.like(root.join("criminalInfo").get("xm").as(String.class),"%"+jsonSearch.get("xm").toString()+"%");
			}
			Predicate p4=null;
			if(null!=jsonSearch.get("fzmc")&&jsonSearch.get("fzmc").toString().length()>0){
				p4=cb.like(root.join("qfjbxx").get("fzmc").as(String.class),"%"+jsonSearch.get("fzmc").toString()+"%");
			}
			Predicate preA;
			if(null!=p3&&null!=p4){
				Predicate  preS =cb.and(p3,p4);
				preA =cb.and(preP,preS);
			}else if(null==p3&&null!=p4){
				preA=cb.and(preP,p4);
			}else if(null!=p3&&null==p4){
				preA=cb.and(preP,p3);
			}else{
				preA=preP;
			}
			predicate.add(preA);
			Predicate[] pre = new Predicate[predicate.size()];
			query.where(predicate.toArray(pre));
			return query.getRestriction();
		}
	};
}


/**
 * 
 */
private List<SubAcctTrxJnlPo> getRechargeList(final String trxDate, final String serviceCenterId) {
	return subAcctTrxJnlRepository.findAll(new Specification<SubAcctTrxJnlPo>() {
		@Override
		public Predicate toPredicate(Root<SubAcctTrxJnlPo> root, CriteriaQuery<?> query,
				CriteriaBuilder cb) {
			Predicate predicate = cb.conjunction();
			List<Expression<Boolean>> expressions = predicate.getExpressions();
			expressions
					.add(cb.exists(getSubQuery(query, cb, root.<String> get("acctNo"), serviceCenterId)));
			expressions.add(cb.equal(root.<String> get("trxDate"), trxDate));
			expressions.add(cb.equal(root.<String> get("useType"), EUseType.RECHARGE));
			return predicate;
		}

		private Subquery<String> getSubQuery(CriteriaQuery<?> query, CriteriaBuilder cb,
				Path<String> acctNo, String serviceCenterId) {
			Subquery<String> subQuery = query.subquery(String.class);
			Root<AcctPo> rAcct = subQuery.from(AcctPo.class);
			Root<InvestorInfoPo> rInvestor = subQuery.from(InvestorInfoPo.class);
			return subQuery.select(rAcct.<String> get("acctNo"))
					.where(cb.and(cb.equal(rAcct.<String> get("acctNo"), acctNo),
							cb.equal(rAcct.<String> get("userId"), rInvestor.<String> get("userId")),
							cb.equal(rInvestor.<String> get("serviceCenterId"), serviceCenterId)));
		}
	});
}


/**
 * 
 */
@Transactional(readOnly = true)
public List<AcctDto> getAcctInfoList(final List<String> userIdList, 
		final List<String> groupIds, final List<EBizRole> bizRoles){
	Specification<AcctPo> spec = new Specification<AcctPo>() {
		@Override
		public Predicate toPredicate(Root<AcctPo> root, CriteriaQuery<?> query,	CriteriaBuilder cb) {
			Predicate predicate = cb.conjunction();
			List<Expression<Boolean>> expressions = predicate.getExpressions();
			if(userIdList!=null&&!userIdList.isEmpty()){
				expressions.add(root.<String>get("userId").in(userIdList));
			}
			if(bizRoles!=null && !bizRoles.isEmpty()){
				expressions.add(cb.exists(getRolesSubQuery(query, cb, 
						root.<String>get("userId"), getRoleIds(bizRoles))));
			}
			if(groupIds!=null && !groupIds.isEmpty()){
				expressions.add(cb.exists(getGroupsSubQuery(query, cb, 
						root.<String>get("userId"), getGroupIds(groupIds))));
			}
			return predicate;
		}
		private Subquery<String> getRolesSubQuery(CriteriaQuery<?> query, 
				CriteriaBuilder cb, Path<String> userId, Set<String> roleIds) {
			Subquery<String> subQuery = query.subquery(String.class);
			Root<UserRolePo> param = subQuery.from(UserRolePo.class);
			return subQuery.select(param.<String>get("userId")).where(
					cb.and(cb.equal(param.get("userId"), userId),
						   param.<String>get("roleId").in(roleIds)
			));
		}
		private Subquery<String> getGroupsSubQuery(CriteriaQuery<?> query, 
				CriteriaBuilder cb, Path<String> userId, Set<String> groupIds) {
			Subquery<String> subQuery = query.subquery(String.class);
			Root<GroupUserPo> param = subQuery.from(GroupUserPo.class);
			return subQuery.select(param.<String>get("userId")).where(
					cb.and(cb.equal(param.get("userId"), userId),
						   param.<String>get("groupId").in(groupIds)
			));
		}
		private Set<String> getRoleIds(List<EBizRole> bizRoles){
			Set<String> sets = new HashSet<String>();
			for(EBizRole role:bizRoles){
				sets.add(role.getRoleId());
			}
			return sets;
		}
		private Set<String> getGroupIds(List<String> groupIds){
			Set<String> sets = new HashSet<String>();
			for(String gid:groupIds){
				sets.add(gid);
			}
			return sets;
		}
	};
	List<AcctPo> list = acctRepo.findAll(spec);
	return packItems(list);
}

 

 

© 著作权归作者所有

共有 人打赏支持
6x5_
粉丝 0
博文 17
码字总数 8472
作品 0
杭州
高级程序员
私信 提问
springboot从入门到精通教程分享, 深度掌握Springboot实践技术教程

深度掌握Springboot实践技术教程,共22个课时,需要的可回复邮箱。 课程简介 day1 01springboot简介-曾经开发中的问题 02springboot解决的问题-优势以及弊端 03springboot环境准备 04spring...

小小倾听
2018/12/06
0
0
(入门帖)使用 Spring Data JPA 简化 JPA 开发

本文主要讲述 Spring Data JPA,但是为了不至于给 JPA 和 Spring 的初学者造成较大的学习曲线,我们首先从 JPA 开始,简单介绍一个 JPA 示例;接着重构该示例,并引入 Spring 框架,这两部分...

阿莱倪士
2014/01/09
0
0
Spring Boot [组件学习-Spring Data JPA]

导读: 在上篇文章中对Spring MVC常用的一些注解做了简要的说明,在这篇文章中主要对Spring Data JPA 做一个简要的说明,并附有一个简单的例子,可以体会到Spring Data JPA 的强大之处。 Sp...

yangrd
2018/08/27
0
0
解决spring jpa中配置文件报'jpa:repositories'的问题

一、问题描述 使用spring jpa,报no declaration can be found for element 'jpa:repositories'错误的解决方案 Multiple annotations found at this line: - cvc-complex-type.2.4.c: The mat......

cloud-coder
2014/04/17
0
1
Spring Data JPA 1.9.0 发布

Spring Data JPA 1.9.0 发布,此版本更新内容如下: * DATAJPA-787 - Release 1.9 GA (Gosling). * DATAJPA-785 - Make sure the build works with Hibernate 5 GA. * DATAJPA-779 - Update ......

淡漠悠然
2015/09/04
1K
0

没有更多内容

加载失败,请刷新页面

加载更多

泛型就这么简单

前言 从今天开始进入Java基础的复习,可能一个星期会有一篇的<十道简单算法>,我写博文的未必都是正确的~如果有写错的地方请大家多多包涵并指正~ 今天要复习的是泛型,泛型在Java中也是个很...

群星纪元
23分钟前
2
0
大数据提醒你:中国这些古建筑,可能是下一个巴黎圣母院!

大家晚上好,我是今天的提笔人嗅嗅。 巴黎圣母院失火事件让我的心情很沉重,一句无关痛痒的安慰“巴黎不哭”,已经不能表达我对这场文化之殇的惋惜之痛,人类伟大的建筑在一瞬间被毁灭。 世界...

forespider
35分钟前
0
0
mysql函数substring_index的用法

substring_index 按索引字符位进行截取字符串 substring_index(“待截取的字符串”,“截取数据依据的字符”,截取字符的位置N) 第三个参数可正,可负。正数表示索引字符前面的字符串,负数...

echojson
35分钟前
1
0
好程序员web前端分享用CSS和JS打造一个简单的图片编辑器

好程序员web前端分享用CSS和JS打造一个简单的图片编辑器,本文主要是利用CSS的 filter和简单的Jquery代码来实现一个简单的图片编辑器,包括对图片的透明度,黑白,图片亮度等调节。 CSS filt...

好程序员IT
44分钟前
2
0
浅析spring mvc的细节

spring mvc 整体结构 系统监听到请求 -> 通知tomcat -> 根据web.xml 通知相应的拦截器(spring mvc 通常指DispatcherServlet) --> 检查url是否有相匹配的请求实现 --> 拿到请求实现bean的适配...

最爱肉肉
46分钟前
2
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部