浏览代码

搜索条件新增

change 3 年之前
父节点
当前提交
97b9299ef8

+ 2 - 4
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/UserServiceImpl.java

@@ -258,10 +258,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
             userUpdateAddBo.setTelphone(update.getTelphone());
         }
         if (!StringUtils.isBlank(update.getIdCard())){
-            LambdaQueryWrapper<User> lqw = Wrappers.lambdaQuery();
-            lqw.eq(User::getIdCard, update.getIdCard());
-            List<User> list = this.list(lqw);
-           if (!CollectionUtils.isEmpty(list)){
+            Long list = iClassGradeUserService.selectList(update);
+           if (list > 0){
                throw new IllegalAccessException("身份证已经被使用注册为学员");
            }
             userUpdateAddBo.setIdCard(update.getIdCard());

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/ClassGradeUserMapper.java

@@ -4,6 +4,7 @@ import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
 import com.zhongzheng.modules.grade.domain.ClassGradeUser;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.grade.vo.*;
+import com.zhongzheng.modules.user.domain.User;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Collection;
@@ -46,4 +47,6 @@ public interface ClassGradeUserMapper extends BaseMapper<ClassGradeUser> {
     List<ClassGradeUserGoodsVo> sendTenClassGradeUser();
 
     List<ClassGradeUserGoodsVo> sendFiveClassGradeUser();
+
+    Long selectUserCount(User bo);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/IClassGradeUserService.java

@@ -7,6 +7,7 @@ import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
 import com.zhongzheng.modules.grade.bo.ClassGradeUserAddBo;
 import com.zhongzheng.modules.grade.bo.ClassGradeUserEditBo;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.user.domain.User;
 
 import java.util.Collection;
 import java.util.List;
@@ -72,4 +73,6 @@ public interface IClassGradeUserService extends IService<ClassGradeUser> {
 	List<ClassGradeUserGoodsVo> sendTenClassGradeUser();
 
 	List<ClassGradeUserGoodsVo> sendFiveClassGradeUser();
+
+	Long selectList(User bo);
 }

+ 10 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -11,6 +11,7 @@ import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
 import com.zhongzheng.modules.user.domain.User;
 import com.zhongzheng.modules.user.domain.UserPlan;
 import com.zhongzheng.modules.user.domain.UserStudyRecordPhoto;
+import com.zhongzheng.modules.user.mapper.UserMapper;
 import com.zhongzheng.modules.user.service.IUserStudyRecordPhotoService;
 import com.zhongzheng.modules.user.service.IUserStudyRecordService;
 import com.zhongzheng.modules.user.vo.SubjectStudyRecordVo;
@@ -53,6 +54,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
     @Autowired
     private IUserStudyRecordPhotoService userStudyRecordPhotoService;
 
+    @Autowired
+    private UserMapper userMapper;
+
     @Override
     public ClassGradeUserVo queryById(Long id){
         ClassGradeUser db = this.baseMapper.selectById(id);
@@ -478,6 +482,12 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
         return baseMapper.sendFiveClassGradeUser();
     }
 
+    @Override
+    public Long selectList(User bo) {
+
+        return baseMapper.selectUserCount(bo);
+    }
+
     /**
      * 实体类转化成视图对象
      *

+ 8 - 0
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml

@@ -723,5 +723,13 @@
         AND unix_timestamp(now()) BETWEEN cg.class_end_time-432000 and cg.class_end_time-345600
         AND (SELECT COUNT(1) FROM inform_user iu where 1=1 and iu.remind_id = 6 and cgu.user_id = iu.user_id and cgu.grade_id = iu.grade_id and iu.system_status=3) &lt; 1
     </select>
+    <select id="selectUserCount" parameterType="com.zhongzheng.modules.user.domain.User" resultType="long">
+        SELECT
+            COUNT( 1 )
+        FROM
+            `user`
+        WHERE
+            id_card = #{idCard} and user_id != #{userId} and `status` = 1
+    </select>
 
 </mapper>