MPJLambdaWrapper

https://mybatisplusjoin.com/pages/quickstart/js.html

		MPJLambdaWrapper<ProProjectNodeIntentionEntity> wrapper = new MPJLambdaWrapper<ProProjectNodeIntentionEntity>();
		wrapper.selectAll(ProProjectNodeIntentionEntity.class);
		wrapper.select(ProProject::getProjectName);
		wrapper.select(BsCompany::getCompanyName);

		wrapper.leftJoin(ProProject.class,ProProject::getProjectId,ProProjectNodeIntentionEntity::getProjectId);
		wrapper.leftJoin(BsCompany.class,BsCompany::getCompanyId,ProProjectNodeIntentionEntity::getCompanyId);

		wrapper.eq(ProProjectNodeIntentionEntity::getId,id);
		return R.ok(proProjectNodeIntentionMapper.selectJoinList(ProProjectNodeIntentionEntity.class,wrapper));
		MPJLambdaWrapper<ProProjectNodeIntentionEntity> wrapper = new MPJLambdaWrapper<ProProjectNodeIntentionEntity>();
		wrapper.selectAll(ProProjectNodeIntentionEntity.class);
		wrapper.select(ProProject::getProjectName);
		wrapper.select(BsCompany::getCompanyName);

		wrapper.selectAs(ProProject::getCity,"newCity");
		wrapper.selectAs(BsCompany::getContacts,"newContacts");

		wrapper.leftJoin(ProProject.class,ProProject::getProjectId,ProProjectNodeIntentionEntity::getProjectId);
		wrapper.leftJoin(BsCompany.class,BsCompany::getCompanyId,ProProjectNodeIntentionEntity::getCompanyId);

		wrapper.eq(ProProjectNodeIntentionEntity::getDelFlag,"0");
		wrapper.eq(ProProjectNodeIntentionEntity::getCompanyId,map.get("companyId").toString());
		if(null != map.get("id") && StrUtil.isNotBlank(map.get("id").toString())) {
			wrapper.eq(ProProjectNodeIntentionEntity::getId,Long.valueOf(map.get("id").toString()));
		}
		wrapper.orderByDesc(ProProjectNodeIntentionEntity::getCreateTime);


		return R.ok(proProjectNodeIntentionMapper.selectJoinMaps(wrapper).stream().map(MapUtil::toCamelCaseMap).collect(Collectors.toList()));
		//return R.ok(proProjectNodeIntentionMapper.selectJoinList(ProProjectNodeIntentionEntity.class,wrapper));
posted @ 2023-12-27 13:23  寒冷的雨呢  阅读(3172)  评论(0编辑  收藏  举报