manailin
2022-09-11 58e0679060b7421f30df7996b39b99f2d236854d
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSanShuoEventServiceImpl.java
@@ -1,6 +1,5 @@
package com.panzhihua.service_community.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.panzhihua.common.model.dtos.community.sanshuo.ComSanshuoEventDTO;
@@ -11,40 +10,39 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import static java.util.Objects.isNull;
@Service
public class ComSanShuoEventServiceImpl  extends ServiceImpl<ComSanshuoEventDao, ComSanshuoEvent> implements ComSanShuoEventService {
public class ComSanShuoEventServiceImpl extends ServiceImpl<ComSanshuoEventDao, ComSanshuoEvent> implements ComSanShuoEventService {
    @Resource
    private ComSanshuoEventDao sanshuoEventDao;
    /**
     * 添加或修改事件类型
     *
     * @param comSanshuoEvent
     * @return  处理结果
     * */
     * @return 处理结果
     */
    @Override
    public R addOrUpdate(ComSanshuoEvent comSanshuoEvent) {
        if (isNull(comSanshuoEvent.getName())){
        if (isNull(comSanshuoEvent.getName())) {
            return R.fail("名称不能为空!");
        }
        if (isNull(comSanshuoEvent.getId())){
        if (isNull(comSanshuoEvent.getId())) {
            //添加操作
            comSanshuoEvent.setCreateTime(new Date());
            int insert = sanshuoEventDao.insert(comSanshuoEvent);
            if (insert>0){
            if (insert > 0) {
                return R.ok();
            }
        }
        //修改
        comSanshuoEvent.setUpdateTime(new Date());
        int i = sanshuoEventDao.updateById(comSanshuoEvent);
        if (i>0){
        if (i > 0) {
            return R.ok();
        }
        return R.fail("操作失败");
@@ -52,11 +50,12 @@
    /**
     * 后台获取事件类型列表
     *
     * @param comSanshuoEventDTO
     * @return  处理结果
     * */
     * @return 处理结果
     */
    @Override
    public R backStageList(ComSanshuoEventDTO comSanshuoEventDTO) {
        return R.ok(this.baseMapper.pageEvent(new Page(comSanshuoEventDTO.getPage(),comSanshuoEventDTO.getSize()),comSanshuoEventDTO)) ;
        return R.ok(this.baseMapper.pageEvent(new Page(comSanshuoEventDTO.getPage(), comSanshuoEventDTO.getSize()), comSanshuoEventDTO));
    }
}