diff --git a/src/main/java/com/JIAL/FMSystem/controller/HeraCaseController.java b/src/main/java/com/JIAL/FMSystem/controller/HeraCaseController.java index 910b79e..f8eb65f 100644 --- a/src/main/java/com/JIAL/FMSystem/controller/HeraCaseController.java +++ b/src/main/java/com/JIAL/FMSystem/controller/HeraCaseController.java @@ -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 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 iPage = hearCaseMapper.selectJoinPage(pageInfo, HearCaseInMenuDto.class, queryWrapper); - //IPage> 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); } } diff --git a/src/main/java/com/JIAL/FMSystem/entity/HearCase.java b/src/main/java/com/JIAL/FMSystem/entity/HearCase.java index af72a11..b359f68 100644 --- a/src/main/java/com/JIAL/FMSystem/entity/HearCase.java +++ b/src/main/java/com/JIAL/FMSystem/entity/HearCase.java @@ -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; //开庭时间 diff --git a/src/main/java/com/JIAL/FMSystem/entity/HearCaseDefendant.java b/src/main/java/com/JIAL/FMSystem/entity/HearCaseDefendant.java new file mode 100644 index 0000000..de8b225 --- /dev/null +++ b/src/main/java/com/JIAL/FMSystem/entity/HearCaseDefendant.java @@ -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; +} diff --git a/src/main/java/com/JIAL/FMSystem/entity/HearCasePlaintiff.java b/src/main/java/com/JIAL/FMSystem/entity/HearCasePlaintiff.java new file mode 100644 index 0000000..aa608fe --- /dev/null +++ b/src/main/java/com/JIAL/FMSystem/entity/HearCasePlaintiff.java @@ -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; +} diff --git a/src/main/java/com/JIAL/FMSystem/mapper/HearCaseDefendantMapper.java b/src/main/java/com/JIAL/FMSystem/mapper/HearCaseDefendantMapper.java new file mode 100644 index 0000000..cf6624a --- /dev/null +++ b/src/main/java/com/JIAL/FMSystem/mapper/HearCaseDefendantMapper.java @@ -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 { +} diff --git a/src/main/java/com/JIAL/FMSystem/mapper/HearCasePlaintiffMapper.java b/src/main/java/com/JIAL/FMSystem/mapper/HearCasePlaintiffMapper.java new file mode 100644 index 0000000..59b57a7 --- /dev/null +++ b/src/main/java/com/JIAL/FMSystem/mapper/HearCasePlaintiffMapper.java @@ -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 { +} diff --git a/src/main/java/com/JIAL/FMSystem/service/HearCaseService.java b/src/main/java/com/JIAL/FMSystem/service/HearCaseService.java index c120811..c4394ee 100644 --- a/src/main/java/com/JIAL/FMSystem/service/HearCaseService.java +++ b/src/main/java/com/JIAL/FMSystem/service/HearCaseService.java @@ -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 { + + void selectJoinPage(Page pageInfo, Class hearCaseInMenuDtoClass, MPJLambdaWrapper queryWrapper); } + diff --git a/src/main/java/com/JIAL/FMSystem/service/impl/HearCaseServiceImpl.java b/src/main/java/com/JIAL/FMSystem/service/impl/HearCaseServiceImpl.java index 62fa76b..a5f8f09 100644 --- a/src/main/java/com/JIAL/FMSystem/service/impl/HearCaseServiceImpl.java +++ b/src/main/java/com/JIAL/FMSystem/service/impl/HearCaseServiceImpl.java @@ -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 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 hearCaseInMenuDtoClass, + MPJLambdaWrapper queryWrapper) { + hearCaseMapper.selectJoinPage(pageInfo, hearCaseInMenuDtoClass, queryWrapper); + } } diff --git a/target/classes/com/JIAL/FMSystem/controller/HeraCaseController.class b/target/classes/com/JIAL/FMSystem/controller/HeraCaseController.class index 80924e1..b87fbb6 100644 Binary files a/target/classes/com/JIAL/FMSystem/controller/HeraCaseController.class and b/target/classes/com/JIAL/FMSystem/controller/HeraCaseController.class differ diff --git a/target/classes/com/JIAL/FMSystem/entity/HearCase.class b/target/classes/com/JIAL/FMSystem/entity/HearCase.class index 35fc1fc..1d8ace3 100644 Binary files a/target/classes/com/JIAL/FMSystem/entity/HearCase.class and b/target/classes/com/JIAL/FMSystem/entity/HearCase.class differ diff --git a/target/classes/com/JIAL/FMSystem/entity/HearCaseDefendant.class b/target/classes/com/JIAL/FMSystem/entity/HearCaseDefendant.class new file mode 100644 index 0000000..986738f Binary files /dev/null and b/target/classes/com/JIAL/FMSystem/entity/HearCaseDefendant.class differ diff --git a/target/classes/com/JIAL/FMSystem/entity/HearCasePlaintiff.class b/target/classes/com/JIAL/FMSystem/entity/HearCasePlaintiff.class new file mode 100644 index 0000000..ee1055a Binary files /dev/null and b/target/classes/com/JIAL/FMSystem/entity/HearCasePlaintiff.class differ diff --git a/target/classes/com/JIAL/FMSystem/mapper/HearCaseDefendantMapper.class b/target/classes/com/JIAL/FMSystem/mapper/HearCaseDefendantMapper.class new file mode 100644 index 0000000..295cf7b Binary files /dev/null and b/target/classes/com/JIAL/FMSystem/mapper/HearCaseDefendantMapper.class differ diff --git a/target/classes/com/JIAL/FMSystem/mapper/HearCasePlaintiffMapper.class b/target/classes/com/JIAL/FMSystem/mapper/HearCasePlaintiffMapper.class new file mode 100644 index 0000000..730231b Binary files /dev/null and b/target/classes/com/JIAL/FMSystem/mapper/HearCasePlaintiffMapper.class differ diff --git a/target/classes/com/JIAL/FMSystem/service/HearCaseService.class b/target/classes/com/JIAL/FMSystem/service/HearCaseService.class index babb15c..0ea8334 100644 Binary files a/target/classes/com/JIAL/FMSystem/service/HearCaseService.class and b/target/classes/com/JIAL/FMSystem/service/HearCaseService.class differ diff --git a/target/classes/com/JIAL/FMSystem/service/impl/HearCaseServiceImpl.class b/target/classes/com/JIAL/FMSystem/service/impl/HearCaseServiceImpl.class index cf6963f..e2e3ddc 100644 Binary files a/target/classes/com/JIAL/FMSystem/service/impl/HearCaseServiceImpl.class and b/target/classes/com/JIAL/FMSystem/service/impl/HearCaseServiceImpl.class differ