浏览代码

绑定操作

夏文涛 2 年之前
父节点
当前提交
04e6e66b7d

文件差异内容过多而无法显示
+ 297 - 282
.idea/workspace.xml


+ 12 - 4
src/main/java/com/template/api/SmartUserControllerAPI.java

@@ -1,9 +1,6 @@
 package com.template.api;
 
-import com.template.model.request.changeDepartmentRequest;
-import com.template.model.request.insertSmartUserRequest;
-import com.template.model.request.updateSmartUserRequest;
-import com.template.model.request.useridsRequest;
+import com.template.model.request.*;
 import com.template.model.result.CommonResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -116,4 +113,15 @@ public interface SmartUserControllerAPI {
     @GetMapping(value = "/queryInfoData")
     @ApiOperation(value = "根据数据ID获取用户信息", notes = "根据数据ID获取用户信息", httpMethod = "GET")
     CommonResult queryInfoData(@RequestParam int id);
+
+    /**
+     * 绑定学生
+     * @param isur
+     * @param bindingResult
+     * @return
+     */
+    @PostMapping(value = "/bindStudent")
+    @ApiOperation(value = "绑定学生", notes = "绑定学生", httpMethod = "POST")
+    CommonResult bindStudent(@Validated @RequestBody bindStudentRequest isur, BindingResult bindingResult);
+
 }

+ 2 - 2
src/main/java/com/template/common/utils/JWTUtil.java

@@ -32,7 +32,7 @@ public class JWTUtil {
      * 生成token 有过期时间
      * @return 返回token
      */
-    public static String getToken(SmartUser user){
+    public static String getToken(SmartUser user, Long expired){
 
         // 签发时间
         Date iatDate = new Date();
@@ -48,7 +48,7 @@ public class JWTUtil {
         String token = JWT.create()
                 .withHeader(map) // header
                 .withClaim("cardNo", user.getCardNo()) // 账号
-                .withExpiresAt(new Date(CommonUtil.getCurrentTimestamp() + EXPIRED)) // 设置过期时间。过期时间要大于签发时间
+                .withExpiresAt(new Date(CommonUtil.getCurrentTimestamp() + (expired == null ? EXPIRED : expired))) // 设置过期时间。过期时间要大于签发时间
                 .withIssuedAt(iatDate) // 设置签发时间
                 .sign(Algorithm.HMAC256(SIGNATURE)); // 加密
         return token;

+ 1 - 1
src/main/java/com/template/controller/LoginController.java

@@ -108,7 +108,7 @@ public class LoginController implements LoginControllerAPI {
             return CommonResult.fail("密码错误");
         }
         SmartUser user = new SmartUser();
-        String token = JWTUtil.getToken(user);
+        String token = JWTUtil.getToken(user,null);
         LoginVO login = new LoginVO();
         login.setToken(token);
         login.setTokenTtl(JWTUtil.getExpired());

+ 13 - 0
src/main/java/com/template/controller/SmartApplyController.java

@@ -10,6 +10,8 @@ import com.template.model.result.PageUtils;
 import com.template.model.vo.ApplyVo;
 import com.template.model.vo.ApplysVo;
 import com.template.services.SmartApplyService;
+import com.template.services.SmartIdentityService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -33,6 +36,9 @@ public class SmartApplyController implements SmartApplyControllerAPI {
     @Autowired
     private SmartApplyService smartApplyService;
 
+    @Autowired
+    private SmartIdentityService smartIdentityService;
+
     /**
      * 查询应用管理
      *
@@ -125,6 +131,13 @@ public class SmartApplyController implements SmartApplyControllerAPI {
             return CommonResult.fail("当前数据不存在,删除失败!");
         }
 
+        //查看被删除的应用管理有没有绑定身份数据 有的话提示无法删除
+        List<SmartIdentity> identitys = smartIdentityService.querySmartIdentityDatas(id);
+        if (identitys != null && identitys.size() > 0) {
+            String name = StringUtils.join(identitys.stream().map(SmartIdentity::getName).collect(Collectors.toList()), ',');
+            return CommonResult.fail("当前应用数据已绑定" + name + "身份,请先解绑");
+        }
+
         int result = smartApplyService.deleteSmartApplyById(id);
 
         return result > 0 ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");

+ 105 - 21
src/main/java/com/template/controller/SmartUserController.java

@@ -17,10 +17,7 @@ import com.template.model.pojo.SmartClass;
 import com.template.model.pojo.SmartDepartment;
 import com.template.model.pojo.SmartGrade;
 import com.template.model.pojo.SmartUser;
-import com.template.model.request.changeDepartmentRequest;
-import com.template.model.request.insertSmartUserRequest;
-import com.template.model.request.updateSmartUserRequest;
-import com.template.model.request.useridsRequest;
+import com.template.model.request.*;
 import com.template.model.result.CommonResult;
 import com.template.model.result.PageUtils;
 import com.template.model.seewo.*;
@@ -1489,17 +1486,19 @@ public class SmartUserController implements SmartUserControllerAPI {
                 }
 
                 List<AffiliateUserVo> datas = new ArrayList<>();
-                List<String> affiliates = Arrays.asList(data.getAffiliate().split(","));
-                for (String a : affiliates) {
-                    if (!ObjectUtils.isEmpty(a)) {
-                        Optional<SmartUser> student = students.stream().filter(e -> e.getId().equals(Integer.valueOf(a))).findFirst();
-                        if (student != null && student.isPresent()) {
-                            AffiliateUserVo affiliate = new AffiliateUserVo();
-                            affiliate.setId(student.get().getId());
-                            affiliate.setName(student.get().getName());
-                            affiliate.setCardNo(student.get().getCardNo());
-                            affiliate.setDepartmentId(student.get().getDepartmentId());
-                            datas.add(affiliate);
+                if (data.getAffiliate() != null) {
+                    List<String> affiliates = Arrays.asList(data.getAffiliate().split(","));
+                    for (String a : affiliates) {
+                        if (!ObjectUtils.isEmpty(a)) {
+                            Optional<SmartUser> student = students.stream().filter(e -> e.getId().equals(Integer.valueOf(a))).findFirst();
+                            if (student != null && student.isPresent()) {
+                                AffiliateUserVo affiliate = new AffiliateUserVo();
+                                affiliate.setId(student.get().getId());
+                                affiliate.setName(student.get().getName());
+                                affiliate.setCardNo(student.get().getCardNo());
+                                affiliate.setDepartmentId(student.get().getDepartmentId());
+                                datas.add(affiliate);
+                            }
                         }
                     }
                 }
@@ -1702,10 +1701,10 @@ public class SmartUserController implements SmartUserControllerAPI {
 
 
     @Override
-    public CommonResult queryInfoData(int id){
+    public CommonResult queryInfoData(int id) {
 
         SmartUser su = smartUserService.getSmartById(id);
-        if(su == null){
+        if (su == null) {
             return CommonResult.fail("用户信息失效,获取用户信息失败");
         }
 
@@ -1740,15 +1739,15 @@ public class SmartUserController implements SmartUserControllerAPI {
         //查找关联人
         if (su.getIdentityId().intValue() == eIdentityStatu.Student.getValue()) {//学生
             List<AffiliateParentVo> parents = smartUserService.queryAffiliateParents(su.getId());
-            if(parents != null && parents.size() > 0){
-                String affiliateStr = StringUtils.join(parents.stream().map(AffiliateParentVo::getName).collect(Collectors.toList()),",");
+            if (parents != null && parents.size() > 0) {
+                String affiliateStr = StringUtils.join(parents.stream().map(AffiliateParentVo::getName).collect(Collectors.toList()), ",");
                 userData.setAffiliateName(affiliateStr);
             }
         } else if (su.getIdentityId().intValue() == eIdentityStatu.Parent.getValue()) {//家长
-            if(su.getAffiliate() != null){
+            if (su.getAffiliate() != null) {
                 List<String> affiliates = Arrays.asList(su.getAffiliate().split(","));
                 List<SmartUser> childs = smartUserService.getSmartUserIds(affiliates);
-                String affiliateStr = StringUtils.join(childs.stream().map(SmartUser::getName).collect(Collectors.toList()),",");
+                String affiliateStr = StringUtils.join(childs.stream().map(SmartUser::getName).collect(Collectors.toList()), ",");
                 userData.setAffiliateName(affiliateStr);
             }
         }
@@ -1772,5 +1771,90 @@ public class SmartUserController implements SmartUserControllerAPI {
 
         return CommonResult.ok(userData);
     }
+
+    @Override
+    public CommonResult bindStudent(bindStudentRequest bsr, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            String st = paramUtils.getParamError(bindingResult);
+            return CommonResult.fail(st);
+        }
+
+        SmartUser parentUser = smartUserService.getSmartById(bsr.getUserId());
+        if (parentUser == null) {
+            return CommonResult.fail("当前用户信息无效,绑定失败!");
+        }
+
+        if (parentUser.getIdentityId().intValue() != eIdentityStatu.Parent.getValue()) {
+            return CommonResult.fail("当前用户身份无法进行绑定操作");
+        }
+
+        //查找是否存在学生数据
+        SmartUser studentUser = smartUserService.queryUserInfo(bsr.getName(), bsr.getCardNo(), bsr.getIdCard());
+        if (studentUser == null) {
+            return CommonResult.fail("当前学生不存在,绑定失败!");
+        }
+
+        //判断是否已绑定过
+        if (parentUser.getAffiliate() == null) {
+            parentUser.setAffiliate(String.valueOf(studentUser.getId()));
+        } else {
+            List<String> affiliates = Arrays.asList(parentUser.getAffiliate().split(","));
+            long existCount = affiliates.stream().filter(e -> e.equals(String.valueOf(studentUser.getId()))).count();
+            if (existCount > 0) {
+                return CommonResult.fail("当前学生信息已绑定过,请勿重复操作!");
+            }
+            affiliates.add(String.valueOf(studentUser.getId()));
+
+            parentUser.setAddress(StringUtils.join(affiliates.stream().distinct(), ","));
+        }
+
+        //region 新增希沃学生家长信息
+        //初始化客户端
+        SeewoClient seewoClient = new DefaultSeewoClient(new Account(seewoConfig.getAppId(), seewoConfig.getAppSecret()));
+        ParentServiceBatchSaveOrUpdateParentsParam param = new ParentServiceBatchSaveOrUpdateParentsParam();
+        //响应体,MimeType为 application/json
+        ParentServiceBatchSaveOrUpdateParentsParam.RequestBody requestBody = ParentServiceBatchSaveOrUpdateParentsParam.RequestBody.builder()
+                .build();
+        param.setRequestBody(requestBody);
+        //query
+        ParentServiceBatchSaveOrUpdateParentsParam.Query query = ParentServiceBatchSaveOrUpdateParentsParam.Query.builder()
+                .appId(seewoConfig.getAppId())
+                .schoolUid(seewoConfig.getSchoolId())
+                .build();
+        requestBody.setQuery(query);
+        //学生与家长列表,最大100条
+        ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem studentParents = ParentServiceBatchSaveOrUpdateParentsParam.StudentParentsItem.builder()
+                .studentCode(studentUser.getCardNo())
+                .build();
+        query.setStudentParents(java.util.Collections.singletonList(studentParents));
+        //家长列表,最多4个
+        ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem parents = ParentServiceBatchSaveOrUpdateParentsParam.ParentsItem.builder()
+                .name(parentUser.getName())
+                .phone(parentUser.getPhone())
+                .index(0)
+                .build();
+        studentParents.setParents(java.util.Collections.singletonList(parents));
+        param.setRequestBody(requestBody);
+        ParentServiceBatchSaveOrUpdateParentsRequest request = new ParentServiceBatchSaveOrUpdateParentsRequest(param);
+        System.out.println("入参:" + request);
+        //如果想要调用沙箱环境,请通过设置 request 对象的 serverUrl 属性,如:
+        //request.setServerUrl("https://openapi.test.seewo.com")
+        //执行请求,如果想获取到com.seewo.open.sdk.HttpResponse对象,请调用 seewoClient.execute 方法
+        ParentServiceBatchSaveOrUpdateParentsResult result = seewoClient.invoke(request);
+        System.out.println("出参:" + result);
+
+        if (result == null) {
+            return CommonResult.fail("希沃学生家长数据添加失败!");
+        }
+
+        if (!result.getResponseBody().getCode().equals("000000")) {
+            return CommonResult.fail(result.getResponseBody().getMessage());
+        }
+        //endregion
+
+        int updateResult = smartUserService.updateSmartUser(parentUser);
+
+        return updateResult > 0 ? CommonResult.ok("绑定成功") : CommonResult.fail("绑定失败");
+    }
 }
 

+ 12 - 7
src/main/java/com/template/controller/WechatScanLoginController.java

@@ -46,7 +46,7 @@ import java.util.Map;
 /**
  * Title: WechatScanLoginController
  * Description: 微信扫码登录controller
- * 
+ *
  * @author fengyong
  * @date 2018年9月7日
  */
@@ -68,7 +68,7 @@ public class WechatScanLoginController implements WechatScanLoginControllerAPI {
 	 * Title: list
 	 * Description: 重定向到微信扫码登录二维码页面
 	 * 此处显示要微信要扫描的二维码
-	 * 
+	 *
 	 * @param model
 	 * @return
 	 * @throws UnsupportedEncodingException
@@ -85,7 +85,7 @@ public class WechatScanLoginController implements WechatScanLoginControllerAPI {
 	/**
 	 * Title: callback
 	 * Description: 回调地址处理
-	 * 
+	 *
 	 * @param code
 	 * @param state
 	 * @return
@@ -110,7 +110,7 @@ public class WechatScanLoginController implements WechatScanLoginControllerAPI {
 				if (user==null) {		/*不存在*/
 					return "redirect:"+HttpParame.FRONT_URI+"/#/login?message=" + URLEncoder.encode("请绑定信息", "UTF-8");
 				} else {
-					String token = JWTUtil.getToken(user);
+					String token = JWTUtil.getToken(user, null);
 					QueryWrapper<SmartAuthority> queryWrapper1 = new QueryWrapper<>();
 					queryWrapper1.eq("deleted", 0);
 					queryWrapper1.eq("user_id", user.getId());
@@ -176,7 +176,7 @@ public class WechatScanLoginController implements WechatScanLoginControllerAPI {
 				userc.get(0).setOpenId(openid);
 				int m = wechatScanLoginService.updateSmartUser(userc.get(0));
 				if (m>0){
-					String token = JWTUtil.getToken(userc.get(0));
+					String token = JWTUtil.getToken(userc.get(0),null);
 					QueryWrapper<SmartAuthority> queryWrapper3 = new QueryWrapper<>();
 					queryWrapper3.eq("deleted", 0);
 					queryWrapper3.eq("user_id", userc.get(0).getId());
@@ -333,10 +333,13 @@ public class WechatScanLoginController implements WechatScanLoginControllerAPI {
 		if (user.isEmpty()){
 			return CommonResult.fail("请绑定后再进入");
 		}
-		String token = JWTUtil.getToken(user.get(0));
+		long expired = 1000 * 60 * 60 * 24 * 365;
+		String token = JWTUtil.getToken(user.get(0), expired);
 		JSONObject jsonObject = new JSONObject();
 		jsonObject.put("token", token);
 		jsonObject.put("user", user);
+		jsonObject.put("userhead", AesUtils.encrypt(String.valueOf(user.get(0).getId())));
+
 		return CommonResult.ok(jsonObject.toString());
 	}
 
@@ -420,10 +423,12 @@ public class WechatScanLoginController implements WechatScanLoginControllerAPI {
 		}
 		user.get(0).setXOpenId(openid);
 		smartUserService.updateSmartUser(user.get(0));
-		String token = JWTUtil.getToken(user.get(0));
+		long expired = 1000 * 60 * 60 * 24 * 365;
+		String token = JWTUtil.getToken(user.get(0),expired);
 		JSONObject jsonObject = new JSONObject();
 		jsonObject.put("token", token);
 		jsonObject.put("user", user.get(0));
+		jsonObject.put("userhead", AesUtils.encrypt(String.valueOf(user.get(0).getId())));
 		return CommonResult.ok(jsonObject);
 	}
 }

+ 32 - 35
src/main/java/com/template/core/JwtAuthenticationInterceptor.java

@@ -45,47 +45,44 @@ public class JwtAuthenticationInterceptor implements HandlerInterceptor {
             //endregion
         }
 
-
         //冻结后无法操作系统
-
         if (1 == 1) {
             return true;
         }
 
+        //除了登录和注册接口不需要user_head和token请求头外其他时候基本都要请求头
+        if(request.getHeader("user_head") == null){
+            //region 自定义返回响应的json格式
+            //加上这个可以让浏览器那里得到浏览器的401:response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+            response.setCharacterEncoding("UTF-8");
+            response.setContentType("application/json; charset=utf-8");
+            JSONObject res = new JSONObject();
+            res.put("code", ResponseStatusEnum.MISSING_REQUEST_HEADER.getStatus());
+            res.put("message",  ResponseStatusEnum.MISSING_REQUEST_HEADER.getMsg());
+            res.put("success", false);
+            PrintWriter out = null;
+            out = response.getWriter();
+            out.write(res.toString());
+            out.flush();
+            out.close();
+            //endregion
+            return false;
+        }
 
-//        //除了登录和注册接口不需要user_head和token请求头外其他时候基本都要请求头
-//        if(request.getHeader("user_head") == null){
-//            //region 自定义返回响应的json格式
-//            //加上这个可以让浏览器那里得到浏览器的401:response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
-//            response.setCharacterEncoding("UTF-8");
-//            response.setContentType("application/json; charset=utf-8");
-//            JSONObject res = new JSONObject();
-//            res.put("code", ResponseStatusEnum.MISSING_REQUEST_HEADER.getStatus());
-//            res.put("message",  ResponseStatusEnum.MISSING_REQUEST_HEADER.getMsg());
-//            res.put("success", false);
-//            PrintWriter out = null;
-//            out = response.getWriter();
-//            out.write(res.toString());
-//            out.flush();
-//            out.close();
-//            //endregion
-//            return false;
-//        }
-//
-//        //region 获取url传递的参数 Query string传递的参数
-//        //获取url参数 getParameter方法里的参数名和定义的参数名一致
-//        String token = request.getHeader("token");
-//        // 验证userToken
-//        if (!StringUtils.hasText(token)) {
-//            throw new MyCustomException(ResponseStatusEnum.SYSTEM_TOKEN_ERROR);
-//        }
-//
-//        // 解析token
-//        Map<String, Claim> stringClaimMap = JWTUtil.verifyToken(token);
-//        if (ObjectUtils.isNotEmpty(stringClaimMap)) { // 登录
-//            return true;
-//        }
-//        //endregion
+        //region 获取url传递的参数 Query string传递的参数
+        //获取url参数 getParameter方法里的参数名和定义的参数名一致
+        String token = request.getHeader("token");
+        // 验证userToken
+        if (!StringUtils.hasText(token)) {
+            throw new MyCustomException(ResponseStatusEnum.SYSTEM_TOKEN_ERROR);
+        }
+
+        // 解析token
+        Map<String, Claim> stringClaimMap = JWTUtil.verifyToken(token);
+        if (ObjectUtils.isNotEmpty(stringClaimMap)) { // 登录
+            return true;
+        }
+        //endregion
 
         //region 自定义返回响应的json格式
         //加上这个可以让浏览器那里得到浏览器的401:response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);

+ 5 - 0
src/main/java/com/template/mapper/SmartIdentityMapper.java

@@ -2,8 +2,12 @@ package com.template.mapper;
 
 import com.template.model.pojo.SmartIdentity;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.template.model.vo.AffiliateUserVo;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
  * <p>
  *  Mapper 接口
@@ -15,4 +19,5 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface SmartIdentityMapper extends BaseMapper<SmartIdentity> {
 
+    List<SmartIdentity> querySmartIdentityDatas(@Param("id") Integer id);
 }

+ 42 - 0
src/main/java/com/template/model/request/bindStudentRequest.java

@@ -0,0 +1,42 @@
+package com.template.model.request;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * <p>
+ *
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-04
+ */
+@Data
+public class bindStudentRequest {
+
+    /**
+     * 用户ID
+     */
+    @NotNull(message = "用户ID不能为空")
+    private Integer userId;
+
+    /**
+     * 学生名称
+     */
+    @NotBlank(message = "学生名称不能为空")
+    private String name;
+
+    /**
+     * 编号
+     */
+    @NotBlank(message = "编号不能为空")
+    private String cardNo;
+
+    /**
+     * 身份证号
+     */
+    @NotBlank(message = "身份证号不能为空")
+    private String idCard;
+}

+ 4 - 0
src/main/java/com/template/services/SmartIdentityService.java

@@ -5,6 +5,8 @@ import com.template.model.pojo.SmartIdentity;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.template.model.result.PageUtils;
 
+import java.util.List;
+
 /**
  * <p>
  *  服务类
@@ -25,4 +27,6 @@ public interface SmartIdentityService extends IService<SmartIdentity> {
     int deleteSmartIdentityById(int id);
 
     SmartIdentity getSmartById(int id);
+
+    List<SmartIdentity> querySmartIdentityDatas(int id);
 }

+ 9 - 0
src/main/java/com/template/services/SmartUserService.java

@@ -56,4 +56,13 @@ public interface SmartUserService extends IService<SmartUser> {
     List<SmartUser> warningPushList();
 
     List<AffiliateParentVo> queryAffiliateParents(Integer userId);
+
+    /**
+     * 获取用户信息
+     * @param name 姓名
+     * @param cardNo 编号
+     * @param idCard 身份证号
+     * @return
+     */
+    SmartUser queryUserInfo(String name,String cardNo,String idCard);
 }

+ 9 - 3
src/main/java/com/template/services/impl/SmartIdentityServiceImpl.java

@@ -5,14 +5,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.template.mapper.SmartIdentityMapper;
 import com.template.model.pojo.SmartIdentity;
-import com.template.model.pojo.SmartIdentity;
-import com.template.mapper.SmartIdentityMapper;
 import com.template.model.result.PageUtils;
 import com.template.services.SmartIdentityService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
+
+import java.util.List;
 
 /**
  * <p>
@@ -67,4 +66,11 @@ public class SmartIdentityServiceImpl extends ServiceImpl<SmartIdentityMapper, S
         SmartIdentity result = smartIdentityMapper.selectById(id);
         return result;
     }
+
+    @Override
+    public List<SmartIdentity> querySmartIdentityDatas(int id){
+        List<SmartIdentity> result = smartIdentityMapper.querySmartIdentityDatas(id);
+        return result;
+    }
+
 }

+ 11 - 0
src/main/java/com/template/services/impl/SmartUserServiceImpl.java

@@ -186,4 +186,15 @@ public class SmartUserServiceImpl extends ServiceImpl<SmartUserMapper, SmartUser
         return smartUserMapper.queryAffiliateParents(userId);
     }
 
+    @Override
+    public SmartUser queryUserInfo(String name, String cardNo, String idCard) {
+        QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
+        queryWrapper.eq(StringUtils.hasText(name),"name", name);
+        queryWrapper.eq(StringUtils.hasText(cardNo),"card_no", cardNo);
+        queryWrapper.eq(StringUtils.hasText(idCard),"id_card", idCard);
+        queryWrapper.eq("is_cancel", 0);
+        SmartUser result = smartUserMapper.selectOne(queryWrapper);
+        return result;
+    }
+
 }

+ 17 - 0
src/main/resources/mapper/template/SmartIdentityMapper.xml

@@ -2,4 +2,21 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.template.mapper.SmartIdentityMapper">
 
+    <resultMap type="com.template.model.pojo.SmartIdentity" id="smartIdentityMap">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="applyId" column="apply_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="createUser" column="create_user"/>
+        <result property="updateUser" column="update_user"/>
+        <result property="deleted" column="deleted"/>
+    </resultMap>
+    <select id="querySmartIdentityDatas" resultType="com.template.model.pojo.SmartIdentity" resultMap="smartIdentityMap">
+        select * from smart_identity where deleted = 0
+        <if test="id != null and id != ''">
+            and FIND_IN_SET(id,apply_id)
+        </if>
+    </select>
+
 </mapper>

+ 17 - 0
target/classes/mapper/template/SmartIdentityMapper.xml

@@ -2,4 +2,21 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.template.mapper.SmartIdentityMapper">
 
+    <resultMap type="com.template.model.pojo.SmartIdentity" id="smartIdentityMap">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="applyId" column="apply_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="createUser" column="create_user"/>
+        <result property="updateUser" column="update_user"/>
+        <result property="deleted" column="deleted"/>
+    </resultMap>
+    <select id="querySmartIdentityDatas" resultType="com.template.model.pojo.SmartIdentity" resultMap="smartIdentityMap">
+        select * from smart_identity where deleted = 0
+        <if test="id != null and id != ''">
+            and FIND_IN_SET(id,apply_id)
+        </if>
+    </select>
+
 </mapper>

+ 1 - 0
target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst

@@ -477,6 +477,7 @@ com\template\services\SmartAttendanceService.class
 com\template\mapper\SmartScoreManageMapper.class
 com\template\model\pojo\SmartDataTask.class
 com\template\model\seewo\TeacherServiceBatchSetClassMastersResult.class
+com\template\model\request\bindStudentRequest.class
 com\template\model\vo\TurnOnDeviceVo.class
 com\template\model\seewo\StudentServiceUpdateStudentInfoParam$CardsItem$CardsItemBuilder.class
 com\template\common\utils\JWTUtil.class

+ 1 - 0
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@@ -109,6 +109,7 @@ D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\templa
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\request\insertFreezeRecordRequest.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\api\SmartFreezeRecordControllerAPI.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\impl\SmsCodeServiceImpl.java
+D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\request\bindStudentRequest.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\model\vo\BsGradeNoVo.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\impl\SmartBuildMeterServiceImpl.java
 D:\Bingo\Desktop\工作内容\万载三中\backend_code\src\main\java\com\template\services\SmartDataSourceService.java

二进制
target/mybatis_plus-0.0.1-SNAPSHOT.jar.original