SmartIdentityServiceImpl.java 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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.SmartIdentityMapper;
  6. import com.template.model.pojo.SmartIdentity;
  7. import com.template.model.pojo.SmartIdentity;
  8. import com.template.mapper.SmartIdentityMapper;
  9. import com.template.model.result.PageUtils;
  10. import com.template.services.SmartIdentityService;
  11. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.stereotype.Service;
  14. import org.springframework.util.StringUtils;
  15. /**
  16. * <p>
  17. * 服务实现类
  18. * </p>
  19. *
  20. * @author ceshi
  21. * @since 2023-12-04
  22. */
  23. @Service
  24. public class SmartIdentityServiceImpl extends ServiceImpl<SmartIdentityMapper, SmartIdentity> implements SmartIdentityService {
  25. @Autowired
  26. private SmartIdentityMapper smartIdentityMapper;
  27. @Override
  28. public int insertSmartIdentity(SmartIdentity sa) {
  29. int result = smartIdentityMapper.insert(sa);
  30. return result;
  31. }
  32. @Override
  33. public int updateSmartIdentity(SmartIdentity sa) {
  34. int result = smartIdentityMapper.updateById(sa);
  35. return result;
  36. }
  37. @Override
  38. public SmartIdentity queryIdentityByName(String name){
  39. QueryWrapper<SmartIdentity> queryWrapper = new QueryWrapper<>();
  40. queryWrapper.eq("name", name);
  41. SmartIdentity result = smartIdentityMapper.selectOne(queryWrapper);
  42. return result;
  43. }
  44. @Override
  45. public PageUtils<SmartIdentity> queryPageSmartIdentitys(int currentPage, int pageCount, String name) {
  46. Page<SmartIdentity> page = new Page<>(currentPage, pageCount);
  47. QueryWrapper<SmartIdentity> queryWrapper = new QueryWrapper<>();
  48. //queryWrapper.like(StringUtils.hasText(name), "name", name);
  49. IPage<SmartIdentity> result = smartIdentityMapper.selectPage(page,queryWrapper);
  50. return new PageUtils<>(result);
  51. }
  52. @Override
  53. public int deleteSmartIdentityById(int id) {
  54. int result = smartIdentityMapper.deleteById(id);
  55. return result;
  56. }
  57. @Override
  58. public SmartIdentity getSmartById(int id) {
  59. SmartIdentity result = smartIdentityMapper.selectById(id);
  60. return result;
  61. }
  62. }