main
parent
0ed7b7e041
commit
c57ab0f674
@ -1,19 +0,0 @@
|
|||||||
package com.tamguo.modules.sys.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.baomidou.mybatisplus.service.IService;
|
|
||||||
import com.tamguo.modules.sys.model.SysPostEntity;
|
|
||||||
import com.tamguo.modules.sys.model.condition.SysPostCondition;
|
|
||||||
|
|
||||||
public interface IPostService extends IService<SysPostEntity>{
|
|
||||||
|
|
||||||
/** 查询列表*/
|
|
||||||
Page<SysPostEntity> listData(SysPostCondition condition);
|
|
||||||
|
|
||||||
/** 添加数据*/
|
|
||||||
void add(SysPostEntity post);
|
|
||||||
|
|
||||||
/** 修改数据*/
|
|
||||||
void update(SysPostEntity post);
|
|
||||||
|
|
||||||
}
|
|
@ -1,8 +1,19 @@
|
|||||||
package com.tamguo.modules.sys.service;
|
package com.tamguo.modules.sys.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.plugins.Page;
|
||||||
import com.baomidou.mybatisplus.service.IService;
|
import com.baomidou.mybatisplus.service.IService;
|
||||||
import com.tamguo.modules.sys.model.SysPostEntity;
|
import com.tamguo.modules.sys.model.SysPostEntity;
|
||||||
|
import com.tamguo.modules.sys.model.condition.SysPostCondition;
|
||||||
|
|
||||||
public interface ISysPostService extends IService<SysPostEntity>{
|
public interface ISysPostService extends IService<SysPostEntity>{
|
||||||
|
|
||||||
|
/** 查询列表*/
|
||||||
|
Page<SysPostEntity> listData(SysPostCondition condition);
|
||||||
|
|
||||||
|
/** 添加数据*/
|
||||||
|
void add(SysPostEntity post);
|
||||||
|
|
||||||
|
/** 修改数据*/
|
||||||
|
void update(SysPostEntity post);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
package com.tamguo.modules.sys.service.impl;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.plugins.Page;
|
|
||||||
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
||||||
import com.tamguo.modules.sys.dao.SysPostMapper;
|
|
||||||
import com.tamguo.modules.sys.model.SysPostEntity;
|
|
||||||
import com.tamguo.modules.sys.model.condition.SysPostCondition;
|
|
||||||
import com.tamguo.modules.sys.model.enums.SysPostStatusEnum;
|
|
||||||
import com.tamguo.modules.sys.service.IPostService;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class PostServiceImpl extends ServiceImpl<SysPostMapper, SysPostEntity> implements IPostService{
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysPostMapper sysPostMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<SysPostEntity> listData(SysPostCondition condition) {
|
|
||||||
Page<SysPostEntity> page = new Page<>(condition.getPageNo(), condition.getPageSize());
|
|
||||||
return page.setRecords(sysPostMapper.listData(condition , page));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void add(SysPostEntity post) {
|
|
||||||
post.setCreateDate(new Date());
|
|
||||||
post.setUpdateDate(new Date());
|
|
||||||
post.setStatus(SysPostStatusEnum.NORMAL);
|
|
||||||
sysPostMapper.insert(post);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(readOnly=false)
|
|
||||||
@Override
|
|
||||||
public void update(SysPostEntity post) {
|
|
||||||
post.setUpdateDate(new Date());
|
|
||||||
sysPostMapper.updateById(post);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,13 +1,45 @@
|
|||||||
package com.tamguo.modules.sys.service.impl;
|
package com.tamguo.modules.sys.service.impl;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.plugins.Page;
|
||||||
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
||||||
import com.tamguo.modules.sys.dao.SysPostMapper;
|
import com.tamguo.modules.sys.dao.SysPostMapper;
|
||||||
import com.tamguo.modules.sys.model.SysPostEntity;
|
import com.tamguo.modules.sys.model.SysPostEntity;
|
||||||
|
import com.tamguo.modules.sys.model.condition.SysPostCondition;
|
||||||
|
import com.tamguo.modules.sys.model.enums.SysPostStatusEnum;
|
||||||
import com.tamguo.modules.sys.service.ISysPostService;
|
import com.tamguo.modules.sys.service.ISysPostService;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPostEntity> implements ISysPostService{
|
public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPostEntity> implements ISysPostService{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPostMapper sysPostMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<SysPostEntity> listData(SysPostCondition condition) {
|
||||||
|
Page<SysPostEntity> page = new Page<>(condition.getPageNo(), condition.getPageSize());
|
||||||
|
return page.setRecords(sysPostMapper.listData(condition , page));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly=false)
|
||||||
|
@Override
|
||||||
|
public void add(SysPostEntity post) {
|
||||||
|
post.setCreateDate(new Date());
|
||||||
|
post.setUpdateDate(new Date());
|
||||||
|
post.setStatus(SysPostStatusEnum.NORMAL);
|
||||||
|
sysPostMapper.insert(post);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly=false)
|
||||||
|
@Override
|
||||||
|
public void update(SysPostEntity post) {
|
||||||
|
post.setUpdateDate(new Date());
|
||||||
|
sysPostMapper.updateById(post);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue