案件展示列表查询完成

This commit is contained in:
JIAL 2023-12-07 20:54:26 +08:00
parent 699f51f161
commit 8589322488
16 changed files with 118 additions and 19 deletions

View File

@ -2,10 +2,7 @@ package com.JIAL.FMSystem.controller;
import com.JIAL.FMSystem.common.R;
import com.JIAL.FMSystem.dto.HearCaseInMenuDto;
import com.JIAL.FMSystem.entity.Defendant;
import com.JIAL.FMSystem.entity.HearCase;
import com.JIAL.FMSystem.entity.Plaintiff;
import com.JIAL.FMSystem.entity.User;
import com.JIAL.FMSystem.entity.*;
import com.JIAL.FMSystem.mapper.HearCaseMapper;
import com.JIAL.FMSystem.service.DefendantService;
import com.JIAL.FMSystem.service.HearCaseService;
@ -43,9 +40,6 @@ public class HeraCaseController {
@Autowired
private HearCaseService hearCaseService;
@Resource
private HearCaseMapper hearCaseMapper;
/**
* @title page
* @description 分页查询案件列表
@ -66,15 +60,15 @@ public class HeraCaseController {
MPJLambdaWrapper<HearCase> queryWrapper = new MPJLambdaWrapper<>();
queryWrapper.selectAll(HearCase.class)//查询案件所有属性
.selectAs(Defendant::getUnitName, "defendant_name")
.selectAs(Plaintiff::getUnitName, "plaintiff_name")
.leftJoin(Defendant.class, Defendant::getId, HearCase::getDefendantId)
.leftJoin(Plaintiff.class, Plaintiff::getId, HearCase::getPlaintiffId);
.select("GROUP_CONCAT(DISTINCT d.unit_name ORDER BY d.id ASC SEPARATOR ', ') AS defendant_name")
.select("GROUP_CONCAT(DISTINCT p.unit_name ORDER BY p.id ASC SEPARATOR ', ') AS plaintiff_name")
.leftJoin(HearCaseDefendant.class, HearCaseDefendant::getHearCaseId, HearCase::getId)
.leftJoin(Defendant.class, "d",Defendant::getId, HearCaseDefendant::getDefendantId)
.leftJoin(HearCasePlaintiff.class, HearCasePlaintiff::getHearCaseId, HearCase::getId)
.leftJoin(Plaintiff.class, "p", Plaintiff::getId, HearCasePlaintiff::getPlaintiffId)
.groupBy(HearCase::getId);
//IPage<HearCaseInMenuDto> iPage = hearCaseMapper.selectJoinPage(pageInfo, HearCaseInMenuDto.class, queryWrapper);
//IPage<Map<String, Object>> pageInfoResult = hearCaseService.getBaseMapper().selectMapsPage(pageInfo, queryWrapper);
//hearCaseService.page(pageInfo, queryWrapper);
hearCaseMapper.selectJoinPage(pageInfo, HearCaseInMenuDto.class, queryWrapper);
hearCaseService.selectJoinPage(pageInfo, HearCaseInMenuDto.class, queryWrapper);
return R.success(pageInfo);
}
}

View File

@ -24,10 +24,6 @@ public class HearCase implements Serializable {
private String caseReason; //案件来由
private Long defendantId; //被告id
private Long plaintiffId; //原告id
private Integer caseType; //案件类型
private LocalDateTime trialTime; //开庭时间

View File

@ -0,0 +1,23 @@
package com.JIAL.FMSystem.entity;
import lombok.Data;
import java.io.Serializable;
/**
* @ClassName HearCaseDefendant
* @Description TODO
* @Author JIAL
* @Date 2023/12/7 16:05
* @Version 1.0
*/
@Data
public class HearCaseDefendant implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Long hearCaseId;
private Long defendantId;
}

View File

@ -0,0 +1,23 @@
package com.JIAL.FMSystem.entity;
import lombok.Data;
import java.io.Serializable;
/**
* @ClassName HearCasePlaintiff
* @Description TODO
* @Author JIAL
* @Date 2023/12/7 16:05
* @Version 1.0
*/
@Data
public class HearCasePlaintiff implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private Long hearCaseId;
private Long plaintiffId;
}

View File

@ -0,0 +1,17 @@
package com.JIAL.FMSystem.mapper;
import com.JIAL.FMSystem.entity.HearCase;
import com.JIAL.FMSystem.entity.HearCaseDefendant;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @ClassName HearCaseDefendantMapper
* @Description TODO
* @Author JIAL
* @Date 2023/12/7 16:09
* @Version 1.0
*/
@Mapper
public interface HearCaseDefendantMapper extends MPJBaseMapper<HearCaseDefendant> {
}

View File

@ -0,0 +1,17 @@
package com.JIAL.FMSystem.mapper;
import com.JIAL.FMSystem.entity.HearCaseDefendant;
import com.JIAL.FMSystem.entity.HearCasePlaintiff;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @ClassName HearCasePlaintiffMapper
* @Description TODO
* @Author JIAL
* @Date 2023/12/7 16:09
* @Version 1.0
*/
@Mapper
public interface HearCasePlaintiffMapper extends MPJBaseMapper<HearCasePlaintiff> {
}

View File

@ -1,9 +1,12 @@
package com.JIAL.FMSystem.service;
import com.JIAL.FMSystem.dto.HearCaseInMenuDto;
import com.JIAL.FMSystem.entity.HearCase;
import com.JIAL.FMSystem.entity.User;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.yulichang.base.MPJBaseService;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
/**
* @ClassName HearCaseService
@ -13,4 +16,7 @@ import com.github.yulichang.base.MPJBaseService;
* @Version 1.0
*/
public interface HearCaseService extends MPJBaseService<HearCase> {
void selectJoinPage(Page pageInfo, Class<HearCaseInMenuDto> hearCaseInMenuDtoClass, MPJLambdaWrapper<HearCase> queryWrapper);
}

View File

@ -1,15 +1,21 @@
package com.JIAL.FMSystem.service.impl;
import com.JIAL.FMSystem.dto.HearCaseInMenuDto;
import com.JIAL.FMSystem.entity.HearCase;
import com.JIAL.FMSystem.entity.User;
import com.JIAL.FMSystem.mapper.HearCaseMapper;
import com.JIAL.FMSystem.mapper.UserMapper;
import com.JIAL.FMSystem.service.HearCaseService;
import com.JIAL.FMSystem.service.UserService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @ClassName HearCaseServiceImpl
* @Description TODO
@ -19,4 +25,21 @@ import org.springframework.stereotype.Service;
*/
@Service
public class HearCaseServiceImpl extends MPJBaseServiceImpl<HearCaseMapper, HearCase> implements HearCaseService {
@Autowired
private HearCaseMapper hearCaseMapper;
/**
* @title selectJoinPage
* @description 在Controller层需要调用到mapper层的方法将其封装在Service层中通过Service层进行调取
* @author JIAL
* @param: pageInfo
* @param: hearCaseInMenuDtoClass
* @param: queryWrapper
* @updateTime 2023/12/7 19:41
*/
public void selectJoinPage(Page pageInfo, Class<HearCaseInMenuDto> hearCaseInMenuDtoClass,
MPJLambdaWrapper<HearCase> queryWrapper) {
hearCaseMapper.selectJoinPage(pageInfo, hearCaseInMenuDtoClass, queryWrapper);
}
}