From fb19bd9c5ae0af622610745345924e8719ec70ca Mon Sep 17 00:00:00 2001 From: lyt <891063282@qq.com> Date: Fri, 25 Sep 2020 11:44:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E4=BA=86=E4=B8=80=E4=B8=AA=E5=87=BD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FundApplyController.java | 21 +++++++++++++++++++ .../com/neuedu/mapper/FundApplyMapper.java | 6 ++++++ .../com/neuedu/service/IFundApplyService.java | 2 ++ .../service/impl/FundApplyServiceImpl.java | 6 ++++++ 4 files changed, 35 insertions(+) diff --git a/admin/src/main/java/com/neuedu/controller/FundApplyController.java b/admin/src/main/java/com/neuedu/controller/FundApplyController.java index 2d8c9ed..3ee4683 100644 --- a/admin/src/main/java/com/neuedu/controller/FundApplyController.java +++ b/admin/src/main/java/com/neuedu/controller/FundApplyController.java @@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; @@ -105,6 +106,26 @@ public class FundApplyController { return CommonResult.failed("修改失败"); } + + + /** + * 通过项目id在表中查找信息 + */ + @GetMapping("/search") + public CommonResult getByProjectId(@RequestParam Map param) { + //List FundApplyList = iFundApplyService.getByProjectId(id); + InitUtil.initPage(param); + int num = Integer.parseInt(param.get("page").toString()); + int limit = Integer.parseInt(param.get("limit").toString()); + QueryWrapper wrapper = new QueryWrapper<>(); + Object id = param.get("id"); + if (!StringUtils.isEmpty(id)){ + wrapper.eq("project_id", id); + } + IPage page = new Page<>(num, limit); + return CommonResult.success(iFundApplyService.page(page, wrapper)); + } + /** * active 字段 相当于激活一样 设置字段的有效性 active=1 有效 */ diff --git a/admin/src/main/java/com/neuedu/mapper/FundApplyMapper.java b/admin/src/main/java/com/neuedu/mapper/FundApplyMapper.java index a1161d2..ccbcc78 100644 --- a/admin/src/main/java/com/neuedu/mapper/FundApplyMapper.java +++ b/admin/src/main/java/com/neuedu/mapper/FundApplyMapper.java @@ -2,6 +2,10 @@ package com.neuedu.mapper; import com.neuedu.pojo.FundApply; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; /** *

@@ -13,4 +17,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; */ public interface FundApplyMapper extends BaseMapper { + @Select("SELECT * FROM fund_apply where project_id=#{pid}") + List getByProjectId(@Param("pid")int pid); } diff --git a/admin/src/main/java/com/neuedu/service/IFundApplyService.java b/admin/src/main/java/com/neuedu/service/IFundApplyService.java index 3c384a4..7633e13 100644 --- a/admin/src/main/java/com/neuedu/service/IFundApplyService.java +++ b/admin/src/main/java/com/neuedu/service/IFundApplyService.java @@ -4,6 +4,7 @@ import com.neuedu.pojo.FundApply; import com.baomidou.mybatisplus.extension.service.IService; import java.io.IOException; +import java.util.List; /** *

@@ -15,4 +16,5 @@ import java.io.IOException; */ public interface IFundApplyService extends IService { boolean add(FundApply fundApply) throws IOException; + List getByProjectId(int pid); } diff --git a/admin/src/main/java/com/neuedu/service/impl/FundApplyServiceImpl.java b/admin/src/main/java/com/neuedu/service/impl/FundApplyServiceImpl.java index 47eb449..a204820 100644 --- a/admin/src/main/java/com/neuedu/service/impl/FundApplyServiceImpl.java +++ b/admin/src/main/java/com/neuedu/service/impl/FundApplyServiceImpl.java @@ -14,6 +14,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.IOException; import java.util.HashSet; +import java.util.List; /** *

@@ -41,4 +42,9 @@ public class FundApplyServiceImpl extends ServiceImpl getByProjectId(int pid) { + return getBaseMapper().getByProjectId(pid); + } + } -- Gitee