|
|
@@ -0,0 +1,135 @@
|
|
|
+package org.dromara.system.service.impl;
|
|
|
+
|
|
|
+import org.dromara.common.core.utils.MapstructUtils;
|
|
|
+import org.dromara.common.core.utils.StringUtils;
|
|
|
+import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
+import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.dromara.system.domain.bo.SysRegisterinfoBo;
|
|
|
+import org.dromara.system.domain.vo.SysRegisterinfoVo;
|
|
|
+import org.dromara.system.domain.SysRegisterinfo;
|
|
|
+import org.dromara.system.mapper.SysRegisterinfoMapper;
|
|
|
+import org.dromara.system.service.ISysRegisterinfoService;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Collection;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 注册信息Service业务层处理
|
|
|
+ *
|
|
|
+ * @author LionLi
|
|
|
+ * @date 2024-08-15
|
|
|
+ */
|
|
|
+@RequiredArgsConstructor
|
|
|
+@Service
|
|
|
+public class SysRegisterinfoServiceImpl implements ISysRegisterinfoService {
|
|
|
+
|
|
|
+ private final SysRegisterinfoMapper baseMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询注册信息
|
|
|
+ *
|
|
|
+ * @param registerId 主键
|
|
|
+ * @return 注册信息
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public SysRegisterinfoVo queryById(Long registerId){
|
|
|
+ return baseMapper.selectVoById(registerId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询注册信息列表
|
|
|
+ *
|
|
|
+ * @param bo 查询条件
|
|
|
+ * @param pageQuery 分页参数
|
|
|
+ * @return 注册信息分页列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public TableDataInfo<SysRegisterinfoVo> queryPageList(SysRegisterinfoBo bo, PageQuery pageQuery) {
|
|
|
+ LambdaQueryWrapper<SysRegisterinfo> lqw = buildQueryWrapper(bo);
|
|
|
+ Page<SysRegisterinfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
+ return TableDataInfo.build(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询符合条件的注册信息列表
|
|
|
+ *
|
|
|
+ * @param bo 查询条件
|
|
|
+ * @return 注册信息列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<SysRegisterinfoVo> queryList(SysRegisterinfoBo bo) {
|
|
|
+ LambdaQueryWrapper<SysRegisterinfo> lqw = buildQueryWrapper(bo);
|
|
|
+ return baseMapper.selectVoList(lqw);
|
|
|
+ }
|
|
|
+
|
|
|
+ private LambdaQueryWrapper<SysRegisterinfo> buildQueryWrapper(SysRegisterinfoBo bo) {
|
|
|
+ Map<String, Object> params = bo.getParams();
|
|
|
+ LambdaQueryWrapper<SysRegisterinfo> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getCustomerId()), SysRegisterinfo::getCustomerId, bo.getCustomerId());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getCustomerPubKey()), SysRegisterinfo::getCustomerPubKey, bo.getCustomerPubKey());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getCustomerPriKey()), SysRegisterinfo::getCustomerPriKey, bo.getCustomerPriKey());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getDealerNo()), SysRegisterinfo::getDealerNo, bo.getDealerNo());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getDealerPubKey()), SysRegisterinfo::getDealerPubKey, bo.getDealerPubKey());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getRegisterInfo()), SysRegisterinfo::getRegisterInfo, bo.getRegisterInfo());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getRandomSn()), SysRegisterinfo::getRandomSn, bo.getRandomSn());
|
|
|
+ return lqw;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增注册信息
|
|
|
+ *
|
|
|
+ * @param bo 注册信息
|
|
|
+ * @return 是否新增成功
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean insertByBo(SysRegisterinfoBo bo) {
|
|
|
+ SysRegisterinfo add = MapstructUtils.convert(bo, SysRegisterinfo.class);
|
|
|
+ validEntityBeforeSave(add);
|
|
|
+ boolean flag = baseMapper.insert(add) > 0;
|
|
|
+ if (flag) {
|
|
|
+ bo.setRegisterId(add.getRegisterId());
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改注册信息
|
|
|
+ *
|
|
|
+ * @param bo 注册信息
|
|
|
+ * @return 是否修改成功
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean updateByBo(SysRegisterinfoBo bo) {
|
|
|
+ SysRegisterinfo update = MapstructUtils.convert(bo, SysRegisterinfo.class);
|
|
|
+ validEntityBeforeSave(update);
|
|
|
+ return baseMapper.updateById(update) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存前的数据校验
|
|
|
+ */
|
|
|
+ private void validEntityBeforeSave(SysRegisterinfo entity){
|
|
|
+ //TODO 做一些数据校验,如唯一约束
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 校验并批量删除注册信息信息
|
|
|
+ *
|
|
|
+ * @param ids 待删除的主键集合
|
|
|
+ * @param isValid 是否进行有效性校验
|
|
|
+ * @return 是否删除成功
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
+ if(isValid){
|
|
|
+ //TODO 做一些业务上的校验,判断是否需要校验
|
|
|
+ }
|
|
|
+ return baseMapper.deleteByIds(ids) > 0;
|
|
|
+ }
|
|
|
+}
|