陈士柏 před 2 roky
rodič
revize
f9c90e8e37

+ 74 - 0
src/main/java/com/template/services/impl/SmartAuthorGroupServiceImpl.java

@@ -0,0 +1,74 @@
+package com.template.services.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.template.mapper.SmartAuthorGroupMapper;
+import com.template.mapper.SmartAuthorityMapper;
+import com.template.model.pojo.SmartAuthorGroup;
+import com.template.model.pojo.SmartAuthorGroup;
+import com.template.mapper.SmartAuthorGroupMapper;
+import com.template.model.result.PageUtils;
+import com.template.services.SmartAuthorGroupService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author ceshi
+ * @since 2023-12-04
+ */
+@Service
+public class SmartAuthorGroupServiceImpl extends ServiceImpl<SmartAuthorGroupMapper, SmartAuthorGroup> implements SmartAuthorGroupService {
+    @Autowired
+    private SmartAuthorGroupMapper smartAuthorGroupMapper;
+
+    @Override
+    public int insertSmartAuthorGroup(SmartAuthorGroup sa) {
+        int result = smartAuthorGroupMapper.insert(sa);
+        return result;
+    }
+
+    @Override
+    public int updateSmartAuthorGroup(SmartAuthorGroup sa) {
+        int result = smartAuthorGroupMapper.updateById(sa);
+        return result;
+    }
+
+    @Override
+    public PageUtils<SmartAuthorGroup> queryPageSmartAuthorGroups(int currentPage, int pageCount, String name) {
+        Page<SmartAuthorGroup> page = new Page<>(currentPage, pageCount);
+        QueryWrapper<SmartAuthorGroup> queryWrapper = new QueryWrapper<>();
+        //queryWrapper.like(StringUtils.hasText(name), "name", name);
+        IPage<SmartAuthorGroup> result = smartAuthorGroupMapper.selectPage(page,queryWrapper);
+        return new PageUtils<>(result);
+    }
+
+    @Override
+    public int deleteSmartAuthorGroupById(int id) {
+        int result = smartAuthorGroupMapper.deleteById(id);
+        return result;
+    }
+
+    @Override
+    public SmartAuthorGroup getSmartById(int id) {
+        SmartAuthorGroup result = smartAuthorGroupMapper.selectById(id);
+        return result;
+    }
+
+    @Override
+    public List<SmartAuthorGroup> getAuthorGroupList() {
+        QueryWrapper<SmartAuthorGroup> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("deleted", 0);
+        List<SmartAuthorGroup> result = smartAuthorGroupMapper.selectList(queryWrapper);
+        return result;
+    }
+
+}