| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- package com.template.services.impl;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.template.mapper.SmartUserMapper;
- import com.template.model.dto.WarningUserDto;
- import com.template.model.enumModel.eIdentityStatu;
- import com.template.model.pojo.SmartUser;
- import com.template.model.result.PageUtils;
- import com.template.model.vo.*;
- import com.template.services.SmartUserService;
- import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- import org.apache.ibatis.annotations.Param;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.util.StringUtils;
- import java.util.List;
- /**
- * <p>
- * 服务实现类
- * </p>
- *
- * @author ceshi
- * @since 2023-12-04
- */
- @Service
- public class SmartUserServiceImpl extends ServiceImpl<SmartUserMapper, SmartUser> implements SmartUserService {
- @Autowired
- private SmartUserMapper smartUserMapper;
- @Override
- public int insertSmartUser(SmartUser sa) {
- int result = smartUserMapper.insert(sa);
- return result;
- }
- @Override
- public int updateSmartUser(SmartUser sa) {
- int result = smartUserMapper.updateById(sa);
- return result;
- }
- @Override
- public PageUtils<SmartUser> queryPageSmartUsers(int currentPage, int pageCount, List<Integer> departmentIds) {
- Page<SmartUser> page = new Page<>(currentPage, pageCount);
- // QueryWrapper<SmartUser> queryWrapper = new QueryWrapper<>();
- // queryWrapper.eq(departmentId > 0, "department_id", departmentId);
- IPage<SmartUser> result = smartUserMapper.selectPage(page, null);
- return new PageUtils<>(result);
- }
- @Override
- public PageUtils<UserVo> querySmartUserPages(int currentPage, int pageCount, List<Integer> departmentIds, String name) {
- Page<UserVo> page = new Page<>();
- page.setCurrent(currentPage);
- page.setSize(pageCount);
- IPage<UserVo> result = smartUserMapper.querySmartUserPages(page, departmentIds, name);
- return new PageUtils(result);
- }
- @Override
- public PageUtils<GradeVo> querySmartSecordPage(int currentPage, int pageCount, String name) {
- Page<GradeVo> page = new Page<>();
- page.setCurrent(currentPage);
- page.setSize(pageCount);
- IPage<GradeVo> result = smartUserMapper.querySmartSecordPage(page, name);
- return new PageUtils(result);
- }
- @Override
- public List<SmartUser> querySmartUsers(List<Integer> departmentIds, String name) {
- List<SmartUser> result = smartUserMapper.querySmartUsers(departmentIds, name);
- return result;
- }
- @Override
- public List<SmartUser> getSmartUserByIds(List<Integer> ids) {
- QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
- queryWrapper.in("id", ids);
- queryWrapper.eq("is_cancel", 0);
- List<SmartUser> result = smartUserMapper.selectList(queryWrapper);
- return result;
- }
- @Override
- public List<SmartUser> getSmartUserIds(List<String> ids) {
- QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
- queryWrapper.in("id", ids);
- queryWrapper.eq("is_cancel", 0);
- List<SmartUser> result = smartUserMapper.selectList(queryWrapper);
- return result;
- }
- @Override
- public int getSmartUserCountByIds(List<Integer> ids) {
- QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
- queryWrapper.in("id", ids);
- queryWrapper.eq("is_cancel", 0);
- int result = smartUserMapper.selectCount(queryWrapper);
- return result;
- }
- @Override
- public boolean updateUserBatchById(List<SmartUser> users) {
- boolean result = this.updateBatchById(users);
- return result;
- }
- @Override
- public Integer querySmartUserByCardNo(String cardNo) {
- QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
- queryWrapper.eq("card_no", cardNo);
- queryWrapper.eq("is_cancel", 0);
- int existCount = smartUserMapper.selectCount(queryWrapper);
- return existCount;
- }
- @Override
- public List<SmartUser> queryStudentBySchoolClass(Integer schoolClass) {
- QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
- queryWrapper.eq("school_class", schoolClass);
- queryWrapper.eq("identity_id", eIdentityStatu.Student.getValue());
- queryWrapper.eq("is_cancel", 0);
- List<SmartUser> result = smartUserMapper.selectList(queryWrapper);
- return result;
- }
- @Override
- public int deleteSmartUserById(int id) {
- int result = smartUserMapper.deleteById(id);
- return result;
- }
- @Override
- public int deleteSmartUserByIds(List<Integer> ids) {
- int result = smartUserMapper.deleteBatchIds(ids);
- return result;
- }
- @Override
- public SmartUser getSmartById(Integer id) {
- QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
- queryWrapper.eq("is_cancel", 0);
- queryWrapper.eq("id", id);
- SmartUser result = smartUserMapper.selectOne(queryWrapper);
- return result;
- }
- @Override
- public List<AffiliateUserVo> queryAffiliateUserById(Integer id) {
- List<AffiliateUserVo> result = smartUserMapper.queryAffiliateUserById(id);
- return result;
- }
- @Override
- public List<SmartUser> queryStudentDatas(){
- QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
- queryWrapper.eq("is_cancel", 0);
- queryWrapper.eq("identity_id", eIdentityStatu.Student.getValue());
- List<SmartUser> result = smartUserMapper.selectList(queryWrapper);
- return result;
- }
- @Override
- public PageUtils<WarningUserDto> warningUserList(int currentPage, int pageCount, String name) {
- Page<UserVo> page = new Page<>();
- page.setCurrent(currentPage);
- page.setSize(pageCount);
- IPage<WarningUserDto> result = smartUserMapper.warningUserList(page, name);
- return new PageUtils(result);
- }
- @Override
- public List<WarningUserDto> warningPushList() {
- return smartUserMapper.warningPushList();
- }
- @Override
- public List<AffiliateParentVo> queryAffiliateParents(Integer userId){
- 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;
- }
- @Override
- public List<SmartUser> getSmartUserList(List<Integer> ids) {
- QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
- queryWrapper.eq("is_cancel", 0);
- queryWrapper.in("id", ids);
- List<SmartUser> result = smartUserMapper.selectList(queryWrapper);
- return result;
- }
- }
|