package com.template.services.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.template.mapper.SmartUserMapper;
import com.template.model.pojo.SmartFamilyIndex;
import com.template.mapper.SmartFamilyIndexMapper;
import com.template.services.SmartFamilyIndexService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
/**
*
* 楼栋表 服务实现类
*
*
* @author ceshi
* @since 2024-04-23
*/
@Service
public class SmartFamilyIndexServiceImpl extends ServiceImpl implements SmartFamilyIndexService {
@Autowired
private SmartFamilyIndexMapper smartFamilyIndexMapper;
@Override
public SmartFamilyIndex queryFamilyByPhoneCardNo(String phone, String cardNo) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq(StringUtils.hasText(phone), "parent_phone", phone);
queryWrapper.eq(StringUtils.hasText(cardNo), "student_no", cardNo);
SmartFamilyIndex result = smartFamilyIndexMapper.selectOne(queryWrapper);
return result;
}
@Override
public List querySmartFamilyByCardNo(String cardNo) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq(StringUtils.hasText(cardNo), "student_no", cardNo);
queryWrapper.orderByAsc("index_data");
List indexs = smartFamilyIndexMapper.selectList(queryWrapper);
return indexs;
}
@Override
public int deleteSmartFamilyByPhone(String phone) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq(StringUtils.hasText(phone), "parent_phone", phone);
int result = smartFamilyIndexMapper.delete(queryWrapper);
return result;
}
@Override
public int deleteSmartFamilyByCardNo(String cardNo) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq(StringUtils.hasText(cardNo), "student_no", cardNo);
int result = smartFamilyIndexMapper.delete(queryWrapper);
return result;
}
@Override
public int updateSmartFamily(SmartFamilyIndex sfi) {
int result = smartFamilyIndexMapper.updateById(sfi);
return result;
}
@Override
public int deleteSmartFamilyByIds(List ids) {
int result = smartFamilyIndexMapper.deleteBatchIds(ids);
return result;
}
}