StatDayService.java 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package com.qxgmat.service.inline;
  2. import com.github.pagehelper.Page;
  3. import com.nuliji.tools.AbstractService;
  4. import com.nuliji.tools.exception.ParameterException;
  5. import com.nuliji.tools.exception.SystemException;
  6. import com.nuliji.tools.mybatis.Example;
  7. import com.qxgmat.data.dao.StatDayMapper;
  8. import com.qxgmat.data.dao.entity.StatDay;
  9. import org.slf4j.Logger;
  10. import org.slf4j.LoggerFactory;
  11. import org.springframework.stereotype.Service;
  12. import javax.annotation.Resource;
  13. import java.util.Collection;
  14. import java.util.List;
  15. @Service
  16. public class StatDayService extends AbstractService {
  17. private static final Logger logger = LoggerFactory.getLogger(SettingService.class);
  18. @Resource
  19. private StatDayMapper statDayMapper;
  20. public StatDay add(StatDay day){
  21. int result = insert(statDayMapper, day);
  22. day = one(statDayMapper, day.getId());
  23. if(day == null){
  24. throw new SystemException("统计添加失败");
  25. }
  26. return day;
  27. }
  28. public StatDay edit(StatDay setting){
  29. StatDay in = one(statDayMapper, setting.getId());
  30. if(in == null){
  31. throw new ParameterException("统计不存在");
  32. }
  33. int result = update(statDayMapper, setting);
  34. return setting;
  35. }
  36. public boolean delete(Number id){
  37. StatDay in = one(statDayMapper, id);
  38. if(in == null){
  39. throw new ParameterException("统计不存在");
  40. }
  41. int result = delete(statDayMapper, id);
  42. return result > 0;
  43. }
  44. public StatDay get(Number id){
  45. StatDay in = one(statDayMapper, id);
  46. if(in == null){
  47. throw new ParameterException("统计不存在");
  48. }
  49. return in;
  50. }
  51. public Page<StatDay> select(int page, int pageSize){
  52. return select(statDayMapper, page, pageSize);
  53. }
  54. public List<StatDay> select(Collection ids){
  55. return select(statDayMapper, ids);
  56. }
  57. }