增加证书实现类

This commit is contained in:
张博 2024-10-18 16:36:24 +08:00
parent 15c19e05d3
commit 4df0355c0f
2 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,38 @@
package net.shapelight.modules.ten.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.shapelight.common.utils.MyBeanUtils;
import net.shapelight.modules.ten.entity.TenPersonCert;
import net.shapelight.modules.ten.entity.TenPersonEntity;
import net.shapelight.modules.ten.service.TenPersonCertService;
import net.shapelight.modules.ten.dao.TenPersonCertDao;
import org.springframework.stereotype.Service;
/**
* @author zhangbo
* @description 针对表ten_person_cert的数据库操作Service实现
* @createDate 2024-10-16 19:43:27
*/
@Service
public class TenPersonCertServiceImpl extends ServiceImpl<TenPersonCertDao, TenPersonCert> implements TenPersonCertService{
/**
* 可以根据其他字段批量更新或新增
*
* @param entity 对象
* @param fieldName 字段名称
* @return 操作结果
*/
public void saveOrUpdateByField(TenPersonCert entity, String fieldName) {
QueryWrapper<TenPersonCert> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(fieldName, MyBeanUtils.getFieldValueByName(entity,fieldName));
TenPersonCert existEntity = this.getOne(queryWrapper);
if (existEntity == null) {
this.save(entity);
} else {
this.updateById(entity);
}
}
}

View File

@ -0,0 +1,38 @@
package net.shapelight.modules.ten.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.shapelight.common.utils.MyBeanUtils;
import net.shapelight.modules.ten.entity.TenPersonTrain;
import net.shapelight.modules.ten.service.TenPersonTrainService;
import net.shapelight.modules.ten.dao.TenPersonTrainDao;
import org.springframework.stereotype.Service;
/**
* @author zhangbo
* @description 针对表ten_person_train的数据库操作Service实现
* @createDate 2024-10-16 19:50:29
*/
@Service
public class TenPersonTrainServiceImpl extends ServiceImpl<TenPersonTrainDao, TenPersonTrain>
implements TenPersonTrainService{
/**
* 可以根据其他字段批量更新或新增
*
* @param entity 对象
* @param fieldName 字段名称
* @return 操作结果
*/
public void saveOrUpdateByField(TenPersonTrain entity, String fieldName) {
QueryWrapper<TenPersonTrain> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(fieldName, MyBeanUtils.getFieldValueByName(entity,fieldName));
TenPersonTrain existEntity = this.getOne(queryWrapper);
if (existEntity == null) {
this.save(entity);
} else {
this.updateById(entity);
}
}
}