From b4fea234d68f268e73160e0c3d0eb0daf07f07a8 Mon Sep 17 00:00:00 2001 From: pqyt64hnf <2543568107@qq.com> Date: Sun, 30 Apr 2023 01:15:41 +0800 Subject: [PATCH] ADD file via upload --- .../com/service/AdvertiserInfoService.java | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/main/java/com/service/AdvertiserInfoService.java diff --git a/src/main/java/com/service/AdvertiserInfoService.java b/src/main/java/com/service/AdvertiserInfoService.java new file mode 100644 index 0000000..44c0e5c --- /dev/null +++ b/src/main/java/com/service/AdvertiserInfoService.java @@ -0,0 +1,63 @@ +package com.example.service; + +import cn.hutool.json.JSONUtil; +import com.example.dao.AdvertiserInfoDao; +import org.springframework.stereotype.Service; +import com.example.entity.AdvertiserInfo; +import com.example.entity.AuthorityInfo; +import com.example.entity.Account; +import com.example.vo.AdvertiserInfoVo; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; + +import org.springframework.beans.factory.annotation.Value; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +@Service +public class AdvertiserInfoService { + + @Value("${authority.info}") + private String authorityInfo; + + @Resource + private AdvertiserInfoDao advertiserInfoDao; + + public AdvertiserInfo add(AdvertiserInfo advertiserInfo) { + advertiserInfo.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + advertiserInfoDao.insertSelective(advertiserInfo); + return advertiserInfo; + } + + public void delete(Long id) { + advertiserInfoDao.deleteByPrimaryKey(id); + } + + public void update(AdvertiserInfo advertiserInfo) { + advertiserInfo.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + advertiserInfoDao.updateByPrimaryKeySelective(advertiserInfo); + } + + public AdvertiserInfo findById(Long id) { + return advertiserInfoDao.selectByPrimaryKey(id); + } + + public List findAll() { + return advertiserInfoDao.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 advertiserInfoDao.findByName(name); + } + +}