|
@@ -16,6 +16,7 @@ import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.TenantInfoWrapper;
|
|
|
import com.yonge.cooleshow.biz.dal.mapper.TenantInfoMapper;
|
|
|
import com.yonge.cooleshow.biz.dal.service.TenantInfoService;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -60,6 +61,34 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoMapper, TenantI
|
|
|
|
|
|
//分页查询
|
|
|
List<TenantInfoWrapper.TenantInfo> tenantInfos = baseMapper.selectPage(page, query);
|
|
|
+ //获取id
|
|
|
+ ArrayList<Integer> listId = new ArrayList<>();
|
|
|
+ for (int i = 0; i < tenantInfos.size(); i++) {
|
|
|
+ TenantInfoWrapper.TenantInfo info = tenantInfos.get(i);
|
|
|
+ Integer id = info.getId();
|
|
|
+ listId.add(i,id);
|
|
|
+ }
|
|
|
+ //查询对应机构的老师数量
|
|
|
+ List<Integer> listTeacher = new ArrayList<>();
|
|
|
+ //查询对应机构的学生数量
|
|
|
+ List<Integer> listStudent = new ArrayList<>();
|
|
|
+ if (!CollectionUtils.isEmpty(listId)){
|
|
|
+ listTeacher = tenantInfoMapper.queryTeacherCounts(listId);
|
|
|
+ listStudent = tenantInfoMapper.queryStudentCounts(listId);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ for (int j = 0; j < tenantInfos.size(); j++) {
|
|
|
+ TenantInfoWrapper.TenantInfo tenantInfo = tenantInfos.get(j);
|
|
|
+ for (int z = 0; z < listTeacher.size(); z++) {
|
|
|
+ tenantInfo.setTeacherCounts(listTeacher.get(z).toString());
|
|
|
+ }
|
|
|
+ for (int t = 0; t < listStudent.size(); t++) {
|
|
|
+ tenantInfo.setStudentCounts(listStudent.get(t).toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//获取省市区信息
|
|
|
List<Integer> areaCodeList = tenantInfos.stream().map(next -> {
|
|
|
Set<Integer> codes = new HashSet<>();
|
|
@@ -81,7 +110,6 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoMapper, TenantI
|
|
|
next.setProvinceName(codeNameMap.getOrDefault(next.getProvinceCode(), ""));
|
|
|
next.setCityName(codeNameMap.getOrDefault(next.getCityCode(), ""));
|
|
|
next.setRegionName(codeNameMap.getOrDefault(next.getRegionCode(), ""));
|
|
|
-// next.setSchoolName(schoolIdNameMap.getOrDefault(next.getSchoolId(), ""));
|
|
|
}
|
|
|
return page.setRecords(tenantInfos);
|
|
|
}
|
|
@@ -92,9 +120,9 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoMapper, TenantI
|
|
|
* @return Boolean
|
|
|
*/
|
|
|
@Override
|
|
|
- public HttpResponseResult<Boolean> add(TenantInfo tenantInfo) {
|
|
|
+ public Boolean add(TenantInfo tenantInfo) {
|
|
|
Boolean bool = tenantInfoMapper.insertInfo(tenantInfo);
|
|
|
- return HttpResponseResult.succeed(bool);
|
|
|
+ return bool;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -140,6 +168,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoMapper, TenantI
|
|
|
* @param query TenantInfoWrapper.TenantInfo
|
|
|
* @return Boolean
|
|
|
*/
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public Boolean state(TenantInfoWrapper.TenantInfoQuery query) {
|
|
|
Boolean flag;
|
|
@@ -177,9 +206,9 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoMapper, TenantI
|
|
|
* @return Boolean
|
|
|
*/
|
|
|
@Override
|
|
|
- public HttpResponseResult<Boolean> updateTenantInfo(TenantInfo info) {
|
|
|
+ public Boolean updateTenantInfo(TenantInfo info) {
|
|
|
Boolean bool = tenantInfoMapper.updateInfo(info);
|
|
|
- return HttpResponseResult.succeed(bool);
|
|
|
+ return bool;
|
|
|
}
|
|
|
|
|
|
|