|
@@ -0,0 +1,120 @@
|
|
|
+package org.dromara.system.service.impl.reservat;
|
|
|
+
|
|
|
+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.dromara.system.domain.reservat.XiaoyuanReservat;
|
|
|
+import org.dromara.system.domain.reservat.bo.XiaoyuanReservatBo;
|
|
|
+import org.dromara.system.domain.reservat.vo.XiaoyuanReservatVo;
|
|
|
+import org.dromara.system.mapper.reservat.XiaoyuanReservatMapper;
|
|
|
+import org.dromara.system.service.reservat.IXiaoyuanReservatService;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Collection;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 校园预约Service业务层处理
|
|
|
+ *
|
|
|
+ * @author boman
|
|
|
+ * @date 2023-09-12
|
|
|
+ */
|
|
|
+@RequiredArgsConstructor
|
|
|
+@Service
|
|
|
+public class XiaoyuanReservatServiceImpl implements IXiaoyuanReservatService {
|
|
|
+
|
|
|
+ private final XiaoyuanReservatMapper baseMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询校园预约
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public XiaoyuanReservatVo queryById(Long reservatId){
|
|
|
+ return baseMapper.selectVoById(reservatId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询校园预约列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public TableDataInfo<XiaoyuanReservatVo> queryPageList(XiaoyuanReservatBo bo, PageQuery pageQuery) {
|
|
|
+ LambdaQueryWrapper<XiaoyuanReservat> lqw = buildQueryWrapper(bo);
|
|
|
+ Page<XiaoyuanReservatVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
+ return TableDataInfo.build(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询校园预约列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<XiaoyuanReservatVo> queryList(XiaoyuanReservatBo bo) {
|
|
|
+ LambdaQueryWrapper<XiaoyuanReservat> lqw = buildQueryWrapper(bo);
|
|
|
+ return baseMapper.selectVoList(lqw);
|
|
|
+ }
|
|
|
+
|
|
|
+ private LambdaQueryWrapper<XiaoyuanReservat> buildQueryWrapper(XiaoyuanReservatBo bo) {
|
|
|
+ Map<String, Object> params = bo.getParams();
|
|
|
+ LambdaQueryWrapper<XiaoyuanReservat> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.like(StringUtils.isNotBlank(bo.getTeacherName()), XiaoyuanReservat::getTeacherName, bo.getTeacherName());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getTeacherPhone()), XiaoyuanReservat::getTeacherPhone, bo.getTeacherPhone());
|
|
|
+ lqw.like(StringUtils.isNotBlank(bo.getVisitName()), XiaoyuanReservat::getVisitName, bo.getVisitName());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getVisitPhone()), XiaoyuanReservat::getVisitPhone, bo.getVisitPhone());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getVisitIdCard()), XiaoyuanReservat::getVisitIdCard, bo.getVisitIdCard());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getVisitReason()), XiaoyuanReservat::getVisitReason, bo.getVisitReason());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getVisitRemark()), XiaoyuanReservat::getVisitRemark, bo.getVisitRemark());
|
|
|
+ lqw.eq(bo.getVisitDate() != null, XiaoyuanReservat::getVisitDate, bo.getVisitDate());
|
|
|
+ lqw.eq(bo.getVisitTime() != null, XiaoyuanReservat::getVisitTime, bo.getVisitTime());
|
|
|
+ lqw.eq(bo.getVisitDateTime() != null, XiaoyuanReservat::getVisitDateTime, bo.getVisitDateTime());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getVisitQr()), XiaoyuanReservat::getVisitQr, bo.getVisitQr());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getVisitType()), XiaoyuanReservat::getVisitType, bo.getVisitType());
|
|
|
+ lqw.eq(StringUtils.isNotBlank(bo.getVisitStatus()), XiaoyuanReservat::getVisitStatus, bo.getVisitStatus());
|
|
|
+ return lqw;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增校园预约
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean insertByBo(XiaoyuanReservatBo bo) {
|
|
|
+ XiaoyuanReservat add = MapstructUtils.convert(bo, XiaoyuanReservat.class);
|
|
|
+ validEntityBeforeSave(add);
|
|
|
+ boolean flag = baseMapper.insert(add) > 0;
|
|
|
+ if (flag) {
|
|
|
+ bo.setReservatId(add.getReservatId());
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改校园预约
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean updateByBo(XiaoyuanReservatBo bo) {
|
|
|
+ XiaoyuanReservat update = MapstructUtils.convert(bo, XiaoyuanReservat.class);
|
|
|
+ validEntityBeforeSave(update);
|
|
|
+ return baseMapper.updateById(update) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存前的数据校验
|
|
|
+ */
|
|
|
+ private void validEntityBeforeSave(XiaoyuanReservat entity){
|
|
|
+ //TODO 做一些数据校验,如唯一约束
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除校园预约
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
+ if(isValid){
|
|
|
+ //TODO 做一些业务上的校验,判断是否需要校验
|
|
|
+ }
|
|
|
+ return baseMapper.deleteBatchIds(ids) > 0;
|
|
|
+ }
|
|
|
+}
|