package com.doumee.service.business.impl;
|
|
import com.doumee.core.model.PageData;
|
import com.doumee.core.model.PageWrap;
|
import com.doumee.core.utils.Utils;
|
import com.doumee.dao.business.CreationApplyPlatMapper;
|
import com.doumee.dao.business.model.CreationApplyPlat;
|
import com.doumee.service.business.CreationApplyPlatService;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.springframework.util.CollectionUtils;
|
|
import java.util.List;
|
|
/**
|
* 创作中心申请-平台信息关联表Service实现
|
* @author 江蹄蹄
|
* @date 2023/03/21 15:48
|
*/
|
@Service
|
public class CreationApplyPlatServiceImpl implements CreationApplyPlatService {
|
|
@Autowired
|
private CreationApplyPlatMapper creationApplyPlatMapper;
|
|
@Override
|
public Integer create(CreationApplyPlat creationApplyPlat) {
|
creationApplyPlatMapper.insert(creationApplyPlat);
|
return creationApplyPlat.getId();
|
}
|
|
@Override
|
public void deleteById(Integer id) {
|
creationApplyPlatMapper.deleteById(id);
|
}
|
|
@Override
|
public void delete(CreationApplyPlat creationApplyPlat) {
|
UpdateWrapper<CreationApplyPlat> deleteWrapper = new UpdateWrapper<>(creationApplyPlat);
|
creationApplyPlatMapper.delete(deleteWrapper);
|
}
|
|
@Override
|
public void deleteByIdInBatch(List<Integer> ids) {
|
if (CollectionUtils.isEmpty(ids)) {
|
return;
|
}
|
creationApplyPlatMapper.deleteBatchIds(ids);
|
}
|
|
@Override
|
public void updateById(CreationApplyPlat creationApplyPlat) {
|
creationApplyPlatMapper.updateById(creationApplyPlat);
|
}
|
|
@Override
|
public void updateByIdInBatch(List<CreationApplyPlat> creationApplyPlats) {
|
if (CollectionUtils.isEmpty(creationApplyPlats)) {
|
return;
|
}
|
for (CreationApplyPlat creationApplyPlat: creationApplyPlats) {
|
this.updateById(creationApplyPlat);
|
}
|
}
|
|
@Override
|
public CreationApplyPlat findById(Integer id) {
|
return creationApplyPlatMapper.selectById(id);
|
}
|
|
@Override
|
public CreationApplyPlat findOne(CreationApplyPlat creationApplyPlat) {
|
QueryWrapper<CreationApplyPlat> wrapper = new QueryWrapper<>(creationApplyPlat);
|
return creationApplyPlatMapper.selectOne(wrapper);
|
}
|
|
@Override
|
public List<CreationApplyPlat> findList(CreationApplyPlat creationApplyPlat) {
|
QueryWrapper<CreationApplyPlat> wrapper = new QueryWrapper<>(creationApplyPlat);
|
return creationApplyPlatMapper.selectList(wrapper);
|
}
|
|
@Override
|
public PageData<CreationApplyPlat> findPage(PageWrap<CreationApplyPlat> pageWrap) {
|
IPage<CreationApplyPlat> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
|
QueryWrapper<CreationApplyPlat> queryWrapper = new QueryWrapper<>();
|
Utils.MP.blankToNull(pageWrap.getModel());
|
if (pageWrap.getModel().getId() != null) {
|
queryWrapper.lambda().eq(CreationApplyPlat::getId, pageWrap.getModel().getId());
|
}
|
if (pageWrap.getModel().getCreator() != null) {
|
queryWrapper.lambda().eq(CreationApplyPlat::getCreator, pageWrap.getModel().getCreator());
|
}
|
if (pageWrap.getModel().getCreateDate() != null) {
|
queryWrapper.lambda().ge(CreationApplyPlat::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()));
|
queryWrapper.lambda().le(CreationApplyPlat::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate()));
|
}
|
if (pageWrap.getModel().getEditor() != null) {
|
queryWrapper.lambda().eq(CreationApplyPlat::getEditor, pageWrap.getModel().getEditor());
|
}
|
if (pageWrap.getModel().getEditDate() != null) {
|
queryWrapper.lambda().ge(CreationApplyPlat::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate()));
|
queryWrapper.lambda().le(CreationApplyPlat::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate()));
|
}
|
if (pageWrap.getModel().getIsdeleted() != null) {
|
queryWrapper.lambda().eq(CreationApplyPlat::getIsdeleted, pageWrap.getModel().getIsdeleted());
|
}
|
if (pageWrap.getModel().getRemark() != null) {
|
queryWrapper.lambda().eq(CreationApplyPlat::getRemark, pageWrap.getModel().getRemark());
|
}
|
|
if (pageWrap.getModel().getStatus() != null) {
|
queryWrapper.lambda().eq(CreationApplyPlat::getStatus, pageWrap.getModel().getStatus());
|
}
|
if (pageWrap.getModel().getObjId() != null) {
|
queryWrapper.lambda().eq(CreationApplyPlat::getObjId, pageWrap.getModel().getObjId());
|
}
|
for(PageWrap.SortData sortData: pageWrap.getSorts()) {
|
if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
|
queryWrapper.orderByDesc(sortData.getProperty());
|
} else {
|
queryWrapper.orderByAsc(sortData.getProperty());
|
}
|
}
|
return PageData.from(creationApplyPlatMapper.selectPage(page, queryWrapper));
|
}
|
|
@Override
|
public long count(CreationApplyPlat creationApplyPlat) {
|
QueryWrapper<CreationApplyPlat> wrapper = new QueryWrapper<>(creationApplyPlat);
|
return creationApplyPlatMapper.selectCount(wrapper);
|
}
|
}
|