package com.iailab.module.model.mcs.pre.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.module.model.mcs.pre.dao.DmModuleItemDao; import com.iailab.module.model.mcs.pre.entity.DmModuleItemEntity; import com.iailab.module.model.mcs.pre.service.DmModuleItemService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.List; import java.util.UUID; /** * @author PanZhibao * @date 2021年04月27日 9:20 */ @Service("dmModuleItemService") public class DmModuleItemServiceImpl extends BaseServiceImpl implements DmModuleItemService { @Override @Transactional(rollbackFor = Exception.class) public void saveModuleItem(DmModuleItemEntity moduleItem) { moduleItem.setId(UUID.randomUUID().toString()); baseDao.insert(moduleItem); } @Override @Transactional(rollbackFor = Exception.class) public void update(DmModuleItemEntity moduleItem) { baseDao.updateById(moduleItem); } public DmModuleItemEntity getByItemid(String itemid) { List list = baseDao.selectList(new QueryWrapper().in("itemid", itemid)); if (CollectionUtils.isEmpty(list)) { return new DmModuleItemEntity(); } return list.get(0); } }