From 7a98c0372ff14583feb9588e946c254443897fbd Mon Sep 17 00:00:00 2001 From: pqyt64hnf <2543568107@qq.com> Date: Sun, 30 Apr 2023 01:17:35 +0800 Subject: [PATCH] ADD file via upload --- .../java/com/service/MessageInfoService.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/main/java/com/service/MessageInfoService.java diff --git a/src/main/java/com/service/MessageInfoService.java b/src/main/java/com/service/MessageInfoService.java new file mode 100644 index 0000000..cf2f6c4 --- /dev/null +++ b/src/main/java/com/service/MessageInfoService.java @@ -0,0 +1,56 @@ +package com.example.service; + +import cn.hutool.json.JSONUtil; +import com.example.dao.MessageInfoDao; +import org.springframework.stereotype.Service; +import com.example.entity.MessageInfo; +import com.example.entity.AuthorityInfo; +import com.example.entity.Account; +import com.example.vo.MessageInfoVo; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; + +@Service +public class MessageInfoService { + + @Resource + private MessageInfoDao messageInfoDao; + + public MessageInfo add(MessageInfo messageInfo) { + messageInfoDao.insertSelective(messageInfo); + return messageInfo; + } + + public void delete(Long id) { + messageInfoDao.deleteByPrimaryKey(id); + } + + public void update(MessageInfo messageInfo) { + messageInfoDao.updateByPrimaryKeySelective(messageInfo); + } + + public MessageInfo findById(Long id) { + return messageInfoDao.selectByPrimaryKey(id); + } + + public List findAll() { + return messageInfoDao.findByName("all"); + } + + public PageInfo findPage(String name, Integer pageNum, Integer pageSize, HttpServletRequest request) { + PageHelper.startPage(pageNum, pageSize); + List all = findAllPage(request, name); + return PageInfo.of(all); + } + + public List findAllPage(HttpServletRequest request, String name) { + return messageInfoDao.findByName(name); + } + +}