feat:预定

This commit is contained in:
dzc committed 2026-05-09 17:58:11 +08:00
1 parent 8cd122a5d6
commit a13adfba87
5 files changed
+56 -19

No files matched your search

@@ -28,6 +28,12 @@ public class HardApptEntity extends Model<HardApptEntity> {
@Schema(description = "编号")
private Long id;
/**
* 商户id
*/
@Schema(description = "商户id")
private Long mchId;
/**
* 标题
*/
@@ -70,6 +76,12 @@ public class HardApptEntity extends Model<HardApptEntity> {
@Schema(description = "备注")
private String remark;
/**
* 部门id
*/
@Schema(description = "部门id")
private Long deptId;
/**
* 创建人
*/
@@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.hard.api.dto.HardApptDto;
import com.bsd.pjcloud.hard.api.entity.HardApptEntity;
import com.bsd.pjcloud.hard.service.HardApptService;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -52,10 +54,8 @@ public class HardApptController {
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
@PreAuthorize("@pms.hasPermission('hard_hardAppt_view')")
public R getHardApptPage(@ParameterObject Page page, @ParameterObject HardApptEntity dto) {
LambdaQueryWrapper<HardApptEntity> wrapper = new LambdaQueryWrapper<HardApptEntity>()
.like(ObjectUtil.isNotEmpty(dto.getTitle()), HardApptEntity::getTitle, dto.getTitle());
return R.ok(hardApptService.page(page, wrapper));
public R getHardApptPage(@ParameterObject Page page, @ParameterObject HardApptDto dto) {
return R.ok(hardApptService.scopePage(page, dto, DataScope.of()));
}
@Operation(summary = "通过id查询", description = "通过id查询")
@@ -1,7 +1,12 @@
package com.bsd.pjcloud.hard.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.hard.api.dto.HardApptDto;
import com.bsd.pjcloud.hard.api.entity.HardApptEntity;
import com.bsd.pjcloud.hard.api.vo.HardApptVo;
import java.util.ArrayList;
@@ -21,4 +26,9 @@ public interface HardApptService extends IService<HardApptEntity> {
* 删除
*/
void delByIds(ArrayList<Long> list);
/**
* 分页查询
*/
Page<HardApptVo> scopePage(Page page, HardApptDto dto, DataScope of);
}
@@ -2,10 +2,16 @@ package com.bsd.pjcloud.hard.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.hard.api.dto.HardApptDto;
import com.bsd.pjcloud.hard.api.entity.HardApptEntity;
import com.bsd.pjcloud.hard.api.vo.HardApptVo;
import com.bsd.pjcloud.hard.mapper.HardApptMapper;
import com.bsd.pjcloud.hard.service.HardApptService;
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -22,6 +28,8 @@ import java.util.ArrayList;
@Service
public class HardApptServiceImpl extends ServiceImpl<HardApptMapper, HardApptEntity> implements HardApptService {
private final RemoteMchService remoteMchService;
/**
* 新增
*/
@@ -31,6 +39,11 @@ public class HardApptServiceImpl extends ServiceImpl<HardApptMapper, HardApptEnt
if (existTitle(dto.getTitle(), null)) {
throw new RuntimeException("标题不能重复");
}
// 查询商户id
MchManageVo mchDeatil = remoteMchService.getById(dto.getMchId()).getData();
if (ObjectUtil.isNotEmpty(mchDeatil)) {
dto.setDeptId(mchDeatil.getDeptId());
}
baseMapper.insert(dto);
return 0L;
}
@@ -44,6 +57,11 @@ public class HardApptServiceImpl extends ServiceImpl<HardApptMapper, HardApptEnt
if (existTitle(dto.getTitle(), dto.getId())) {
throw new RuntimeException("标题不能重复");
}
// 查询商户id
MchManageVo mchDeatil = remoteMchService.getById(dto.getMchId()).getData();
if (ObjectUtil.isNotEmpty(mchDeatil)) {
dto.setDeptId(mchDeatil.getDeptId());
}
baseMapper.updateById(dto);
return dto.getId();
}
@@ -57,6 +75,17 @@ public class HardApptServiceImpl extends ServiceImpl<HardApptMapper, HardApptEnt
baseMapper.deleteBatchIds(list);
}
/**
* 分页查询
*/
@Override
public Page<HardApptVo> scopePage(Page page, HardApptDto dto, DataScope of) {
LambdaQueryWrapper<HardApptEntity> wrapper = new LambdaQueryWrapper<HardApptEntity>()
.eq(ObjectUtil.isNotEmpty(dto.getDeptId()), HardApptEntity::getDeptId, dto.getDeptId())
.like(ObjectUtil.isNotEmpty(dto.getTitle()), HardApptEntity::getTitle, dto.getTitle());
return baseMapper.selectPageByScope(page, wrapper, of);
}
private boolean existTitle(String title, Long id) {
Long count = baseMapper.selectCount(new LambdaQueryWrapper<HardApptEntity>()
.eq(ObjectUtil.isNotEmpty(title), HardApptEntity::getTitle, title)
@@ -2,19 +2,5 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsd.pjcloud.hard.mapper.HardApptMapper">
<resultMap id="hardApptMap" type="com.bsd.pjcloud.hard.api.entity.HardApptEntity">
<id property="id" column="id"/>
<result property="title" column="title"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
<result property="status" column="status"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
</mapper>