cn.foxtech.common.entity.service.repocomp.RepoCompEntityService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fox-edge-server-common-entity-service Show documentation
Show all versions of fox-edge-server-common-entity-service Show documentation
fox-edge-server-common-entity-service
package cn.foxtech.common.entity.service.repocomp;
import cn.foxtech.common.entity.entity.BaseEntity;
import cn.foxtech.common.entity.entity.RepoCompEntity;
import cn.foxtech.common.entity.entity.RepoCompPo;
import cn.foxtech.common.entity.service.mybatis.BaseEntityService;
import lombok.AccessLevel;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
@Getter(value = AccessLevel.PUBLIC)
public class RepoCompEntityService extends BaseEntityService {
@Autowired(required = false)
private RepoCompMapper mapper;
/**
* 子类将自己的mapper绑定到父类上
*/
public void bindMapper() {
super.mapper = this.mapper;
}
@Override
public BaseEntity selectEntity(Long id) {
RepoCompPo po = (RepoCompPo) super.selectEntity(id);
if (po == null) {
return null;
}
return RepoCompEntityMaker.makePo2Entity(po);
}
@Override
public List selectListBatchIds(List idList) {
List poList = super.selectListBatchIds(idList);
List entityList = new ArrayList<>();
for (BaseEntity entity : poList) {
RepoCompPo po = (RepoCompPo) entity;
RepoCompEntity RepoComp = RepoCompEntityMaker.makePo2Entity(po);
entityList.add(RepoComp);
}
return entityList;
}
/**
* 根据Key特征,查询实体
*/
@Override
public List selectEntityList() {
List poList = super.selectEntityList();
List entityList = new ArrayList<>();
for (BaseEntity entity : poList) {
RepoCompPo po = (RepoCompPo) entity;
RepoCompEntity RepoComp = RepoCompEntityMaker.makePo2Entity(po);
entityList.add(RepoComp);
}
return entityList;
}
/**
* 插入实体
*
* @param entity 实体
*/
@Override
public void insertEntity(BaseEntity entity) {
RepoCompPo RepoCompPo = RepoCompEntityMaker.makeEntity2Po((RepoCompEntity) entity);
super.insertEntity(RepoCompPo);
entity.setId(RepoCompPo.getId());
entity.setCreateTime(RepoCompPo.getCreateTime());
entity.setUpdateTime(RepoCompPo.getUpdateTime());
}
@Override
public void updateEntity(BaseEntity entity) {
RepoCompPo RepoCompPo = RepoCompEntityMaker.makeEntity2Po((RepoCompEntity) entity);
super.updateEntity(RepoCompPo);
entity.setId(RepoCompPo.getId());
entity.setCreateTime(RepoCompPo.getCreateTime());
entity.setUpdateTime(RepoCompPo.getUpdateTime());
}
@Override
public int deleteEntity(BaseEntity entity) {
RepoCompPo RepoCompPo = RepoCompEntityMaker.makeEntity2Po((RepoCompEntity) entity);
return super.deleteEntity(RepoCompPo);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy