|
|
@@ -0,0 +1,55 @@
|
|
|
+package io.renren.modules.qyh.service.impl;
|
|
|
+
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import io.renren.common.utils.PageUtils;
|
|
|
+import io.renren.common.utils.Query;
|
|
|
+import io.renren.modules.qyh.entity.WithdrawConfigEntity;
|
|
|
+import io.renren.modules.qyh.mapper.WithdrawConfigMapper;
|
|
|
+import io.renren.modules.qyh.service.WithdrawConfigService;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@Service("withdrawConfigService")
|
|
|
+public class WithdrawConfigServiceImpl extends ServiceImpl<WithdrawConfigMapper, WithdrawConfigEntity>
|
|
|
+ implements WithdrawConfigService {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PageUtils queryPage(Map<String, Object> params) {
|
|
|
+ IPage<WithdrawConfigEntity> page =
|
|
|
+ this.page(new Query<WithdrawConfigEntity>().getPage(params), new QueryWrapper<WithdrawConfigEntity>());
|
|
|
+
|
|
|
+ return new PageUtils(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public WithdrawConfigEntity info() {
|
|
|
+ return baseMapper.selectOne(new LambdaQueryWrapper<WithdrawConfigEntity>().last("limit 1"));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public WithdrawConfigEntity getOne() {
|
|
|
+ return baseMapper.selectOne(new LambdaQueryWrapper<WithdrawConfigEntity>()
|
|
|
+ .last("limit 1"));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void addOrUpdate(WithdrawConfigEntity entity) {
|
|
|
+ WithdrawConfigEntity info = this.info();
|
|
|
+ entity.setCreateTime(LocalDateTime.now());
|
|
|
+ if (ObjectUtil.isNull(info)) {
|
|
|
+ baseMapper.insert(entity);
|
|
|
+ } else {
|
|
|
+ entity.setUpdateTime(LocalDateTime.now());
|
|
|
+ baseMapper.updateById(entity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|