SmartGradeServiceImpl.java 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package com.template.services.impl;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.template.model.pojo.SmartBuild;
  4. import com.template.model.pojo.SmartFreezeRecord;
  5. import com.template.model.pojo.SmartGrade;
  6. import com.template.mapper.SmartGradeMapper;
  7. import com.template.model.pojo.SmartIdentity;
  8. import com.template.services.SmartGradeService;
  9. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.stereotype.Service;
  12. import org.springframework.util.StringUtils;
  13. import java.util.List;
  14. /**
  15. * <p>
  16. * 楼栋表 服务实现类
  17. * </p>
  18. *
  19. * @author ceshi
  20. * @since 2023-12-25
  21. */
  22. @Service
  23. public class SmartGradeServiceImpl extends ServiceImpl<SmartGradeMapper, SmartGrade> implements SmartGradeService {
  24. @Autowired
  25. private SmartGradeMapper smartGradeMapper;
  26. @Override
  27. public int updateSmartGrade(SmartGrade sg) {
  28. int result = smartGradeMapper.updateById(sg);
  29. return result;
  30. }
  31. @Override
  32. public List<SmartGrade> getSmartGrades() {
  33. List<SmartGrade> result = smartGradeMapper.selectList(null);
  34. return result;
  35. }
  36. @Override
  37. public int insertSmartGrade(SmartGrade sg) {
  38. int result = smartGradeMapper.insert(sg);
  39. return result;
  40. }
  41. @Override
  42. public int existSmartGrade(Integer gradeNo, String gradeName) {
  43. QueryWrapper<SmartGrade> queryWrapper = new QueryWrapper<>();
  44. queryWrapper.eq(gradeNo != null, "grade_no", gradeNo);
  45. queryWrapper.eq(StringUtils.hasText(gradeName), "name", gradeName);
  46. int existCount = smartGradeMapper.selectCount(queryWrapper);
  47. return existCount;
  48. }
  49. @Override
  50. public SmartGrade querySmartGradeByBaisheng(String bsGradeNo) {
  51. QueryWrapper<SmartGrade> queryWrapper = new QueryWrapper<>();
  52. queryWrapper.eq(StringUtils.hasText(bsGradeNo), "bs_grade_no", bsGradeNo);
  53. SmartGrade result = smartGradeMapper.selectOne(queryWrapper);
  54. return result;
  55. }
  56. }