SmartUserServiceImpl.java 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. package com.template.services.impl;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.baomidou.mybatisplus.core.metadata.IPage;
  4. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  5. import com.template.mapper.SmartUserMapper;
  6. import com.template.model.dto.WarningUserDto;
  7. import com.template.model.enumModel.eIdentityStatu;
  8. import com.template.model.pojo.SmartUser;
  9. import com.template.model.result.PageUtils;
  10. import com.template.model.vo.*;
  11. import com.template.services.SmartUserService;
  12. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  13. import org.apache.ibatis.annotations.Param;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.stereotype.Service;
  16. import org.springframework.util.StringUtils;
  17. import java.util.List;
  18. /**
  19. * <p>
  20. * 服务实现类
  21. * </p>
  22. *
  23. * @author ceshi
  24. * @since 2023-12-04
  25. */
  26. @Service
  27. public class SmartUserServiceImpl extends ServiceImpl<SmartUserMapper, SmartUser> implements SmartUserService {
  28. @Autowired
  29. private SmartUserMapper smartUserMapper;
  30. @Override
  31. public int insertSmartUser(SmartUser sa) {
  32. int result = smartUserMapper.insert(sa);
  33. return result;
  34. }
  35. @Override
  36. public int updateSmartUser(SmartUser sa) {
  37. int result = smartUserMapper.updateById(sa);
  38. return result;
  39. }
  40. @Override
  41. public PageUtils<SmartUser> queryPageSmartUsers(int currentPage, int pageCount, List<Integer> departmentIds) {
  42. Page<SmartUser> page = new Page<>(currentPage, pageCount);
  43. // QueryWrapper<SmartUser> queryWrapper = new QueryWrapper<>();
  44. // queryWrapper.eq(departmentId > 0, "department_id", departmentId);
  45. IPage<SmartUser> result = smartUserMapper.selectPage(page, null);
  46. return new PageUtils<>(result);
  47. }
  48. @Override
  49. public PageUtils<UserVo> querySmartUserPages(int currentPage, int pageCount, List<Integer> departmentIds, String name) {
  50. Page<UserVo> page = new Page<>();
  51. page.setCurrent(currentPage);
  52. page.setSize(pageCount);
  53. IPage<UserVo> result = smartUserMapper.querySmartUserPages(page, departmentIds, name);
  54. return new PageUtils(result);
  55. }
  56. @Override
  57. public PageUtils<GradeVo> querySmartSecordPage(int currentPage, int pageCount, String name) {
  58. Page<GradeVo> page = new Page<>();
  59. page.setCurrent(currentPage);
  60. page.setSize(pageCount);
  61. IPage<GradeVo> result = smartUserMapper.querySmartSecordPage(page, name);
  62. return new PageUtils(result);
  63. }
  64. @Override
  65. public List<SmartUser> querySmartUsers(List<Integer> departmentIds, String name) {
  66. List<SmartUser> result = smartUserMapper.querySmartUsers(departmentIds, name);
  67. return result;
  68. }
  69. @Override
  70. public List<SmartUser> getSmartUserByIds(List<Integer> ids) {
  71. QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
  72. queryWrapper.in("id", ids);
  73. queryWrapper.eq("is_cancel", 0);
  74. List<SmartUser> result = smartUserMapper.selectList(queryWrapper);
  75. return result;
  76. }
  77. @Override
  78. public List<SmartUser> getSmartUserIds(List<String> ids) {
  79. QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
  80. queryWrapper.in("id", ids);
  81. queryWrapper.eq("is_cancel", 0);
  82. List<SmartUser> result = smartUserMapper.selectList(queryWrapper);
  83. return result;
  84. }
  85. @Override
  86. public int getSmartUserCountByIds(List<Integer> ids) {
  87. QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
  88. queryWrapper.in("id", ids);
  89. queryWrapper.eq("is_cancel", 0);
  90. int result = smartUserMapper.selectCount(queryWrapper);
  91. return result;
  92. }
  93. @Override
  94. public boolean updateUserBatchById(List<SmartUser> users) {
  95. boolean result = this.updateBatchById(users);
  96. return result;
  97. }
  98. @Override
  99. public Integer querySmartUserByCardNo(String cardNo) {
  100. QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
  101. queryWrapper.eq("card_no", cardNo);
  102. queryWrapper.eq("is_cancel", 0);
  103. int existCount = smartUserMapper.selectCount(queryWrapper);
  104. return existCount;
  105. }
  106. @Override
  107. public List<SmartUser> queryStudentBySchoolClass(Integer schoolClass) {
  108. QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
  109. queryWrapper.eq("school_class", schoolClass);
  110. queryWrapper.eq("identity_id", eIdentityStatu.Student.getValue());
  111. queryWrapper.eq("is_cancel", 0);
  112. List<SmartUser> result = smartUserMapper.selectList(queryWrapper);
  113. return result;
  114. }
  115. @Override
  116. public int deleteSmartUserById(int id) {
  117. int result = smartUserMapper.deleteById(id);
  118. return result;
  119. }
  120. @Override
  121. public int deleteSmartUserByIds(List<Integer> ids) {
  122. int result = smartUserMapper.deleteBatchIds(ids);
  123. return result;
  124. }
  125. @Override
  126. public SmartUser getSmartById(Integer id) {
  127. QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
  128. queryWrapper.eq("is_cancel", 0);
  129. queryWrapper.eq("id", id);
  130. SmartUser result = smartUserMapper.selectOne(queryWrapper);
  131. return result;
  132. }
  133. @Override
  134. public List<AffiliateUserVo> queryAffiliateUserById(Integer id) {
  135. List<AffiliateUserVo> result = smartUserMapper.queryAffiliateUserById(id);
  136. return result;
  137. }
  138. @Override
  139. public List<SmartUser> queryStudentDatas(){
  140. QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
  141. queryWrapper.eq("is_cancel", 0);
  142. queryWrapper.eq("identity_id", eIdentityStatu.Student.getValue());
  143. List<SmartUser> result = smartUserMapper.selectList(queryWrapper);
  144. return result;
  145. }
  146. @Override
  147. public PageUtils<WarningUserDto> warningUserList(int currentPage, int pageCount, String name) {
  148. Page<UserVo> page = new Page<>();
  149. page.setCurrent(currentPage);
  150. page.setSize(pageCount);
  151. IPage<WarningUserDto> result = smartUserMapper.warningUserList(page, name);
  152. return new PageUtils(result);
  153. }
  154. @Override
  155. public List<WarningUserDto> warningPushList() {
  156. return smartUserMapper.warningPushList();
  157. }
  158. @Override
  159. public List<AffiliateParentVo> queryAffiliateParents(Integer userId){
  160. return smartUserMapper.queryAffiliateParents(userId);
  161. }
  162. @Override
  163. public SmartUser queryUserInfo(String name, String cardNo, String idCard) {
  164. QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
  165. queryWrapper.eq(StringUtils.hasText(name),"name", name);
  166. queryWrapper.eq(StringUtils.hasText(cardNo),"card_no", cardNo);
  167. queryWrapper.eq(StringUtils.hasText(idCard),"id_card", idCard);
  168. queryWrapper.eq("is_cancel", 0);
  169. SmartUser result = smartUserMapper.selectOne(queryWrapper);
  170. return result;
  171. }
  172. @Override
  173. public List<SmartUser> getSmartUserList(List<Integer> ids) {
  174. QueryWrapper<SmartUser> queryWrapper = new QueryWrapper();
  175. queryWrapper.eq("is_cancel", 0);
  176. queryWrapper.in("id", ids);
  177. List<SmartUser> result = smartUserMapper.selectList(queryWrapper);
  178. return result;
  179. }
  180. }