| | |
| | | package com.yeshi.fanli.service.impl.redpack;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.redpack.RedPackConfigMapper;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackConfig;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackConfigException;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackConfigService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class RedPackConfigServiceImpl implements RedPackConfigService {
|
| | |
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<RedPackConfig> query(int page, int pageSize, String key) {
|
| | | return redPackConfigMapper.query((page - 1) * pageSize, pageSize, key);
|
| | | }
|
| | | |
| | | @Override
|
| | | public long count(String key) {
|
| | | return redPackConfigMapper.count(key);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void save(RedPackConfig record) throws RedPackConfigException {
|
| | | String name = record.getName();
|
| | | if (StringUtil.isNullOrEmpty(name))
|
| | | throw new RedPackConfigException(1, "名称不能为空");
|
| | | |
| | | if (StringUtil.isNullOrEmpty(record.getValue()))
|
| | | throw new RedPackConfigException(1, "值不能为空");
|
| | | |
| | | if (StringUtil.isNullOrEmpty(record.getKey()))
|
| | | throw new RedPackConfigException(1, "标识不能为空");
|
| | |
|
| | | String remark = record.getRemark();
|
| | | if ("null".equalsIgnoreCase(remark)) {
|
| | | record.setRemark("");
|
| | | }
|
| | | |
| | | record.setUpdateTime(new Date());
|
| | | if (record.getId() == null) {
|
| | | record.setCreateTime(new Date());
|
| | | redPackConfigMapper.insert(record);
|
| | | } else {
|
| | | RedPackConfig resultObj = redPackConfigMapper.selectByPrimaryKey(record.getId());
|
| | | if (resultObj == null)
|
| | | throw new RedPackConfigException(1, "修改内容已不存在");
|
| | | record.setCreateTime(resultObj.getCreateTime());
|
| | | redPackConfigMapper.updateByPrimaryKey(record);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void delete(List<Long> idsList) {
|
| | | if (idsList != null)
|
| | | for (Long id : idsList)
|
| | | redPackConfigMapper.deleteByPrimaryKey(id);
|
| | |
|
| | | }
|
| | |
|
| | | }
|