diff --git a/src/main/java/com/peanut/modules/master/controller/UserCertificateController.java b/src/main/java/com/peanut/modules/master/controller/UserCertificateController.java index 6a7179bc..f34f68fb 100644 --- a/src/main/java/com/peanut/modules/master/controller/UserCertificateController.java +++ b/src/main/java/com/peanut/modules/master/controller/UserCertificateController.java @@ -11,6 +11,7 @@ import com.peanut.modules.common.service.MyUserService; import com.peanut.modules.common.service.UserCertificateLabelService; import com.peanut.modules.common.service.UserCertificateService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -41,15 +42,24 @@ public class UserCertificateController { return R.ok().put("labelList", labelList); } - //标签下证书列表 - @RequestMapping("/userCertificateListByLabel") - public R userCertificateListByLabel(@RequestBody Map params) { + //证书列表 + @RequestMapping("/userCertificateList") + public R userCertificateList(@RequestBody Map params) { MPJLambdaWrapper wrapper = new MPJLambdaWrapper(); wrapper.leftJoin(MyUserEntity.class,MyUserEntity::getId,UserCertificate::getUserId); wrapper.selectAll(UserCertificate.class); - wrapper.eq(UserCertificate::getLabelId,params.get("labelId")); - wrapper.like(MyUserEntity::getTel,params.get("tel")); - wrapper.like(UserCertificate::getTitle,params.get("title")); + if (params.containsKey("labelId")&&StringUtils.isNotBlank(params.get("labelId").toString())) { + wrapper.eq(UserCertificate::getLabelId,params.get("labelId")); + } + if (params.containsKey("userId")&&StringUtils.isNotBlank(params.get("userId").toString())) { + wrapper.eq(MyUserEntity::getId,params.get("userId")); + } + if (params.containsKey("tel")&&StringUtils.isNotBlank(params.get("tel").toString())) { + wrapper.like(MyUserEntity::getTel,params.get("tel")); + } + if (params.containsKey("title")&&StringUtils.isNotBlank(params.get("title").toString())) { + wrapper.like(UserCertificate::getTitle,params.get("title")); + } Page certificatePage = userCertificateService.page(new Page<>( Long.parseLong(params.get("current").toString()),Long.parseLong(params.get("limit").toString())),wrapper); for (UserCertificate certificate:certificatePage.getRecords()){