7 changed files with 595 additions and 0 deletions
@ -0,0 +1,105 @@ |
|||
package org.dromara.demo.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
import jakarta.servlet.http.HttpServletResponse; |
|||
import jakarta.validation.constraints.*; |
|||
import cn.dev33.satoken.annotation.SaCheckPermission; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
|||
import org.dromara.common.log.annotation.Log; |
|||
import org.dromara.common.web.core.BaseController; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
import org.dromara.common.core.domain.R; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import org.dromara.common.log.enums.BusinessType; |
|||
import org.dromara.common.excel.utils.ExcelUtil; |
|||
import org.dromara.demo.domain.vo.PlanInfoVo; |
|||
import org.dromara.demo.domain.bo.PlanInfoBo; |
|||
import org.dromara.demo.service.IPlanInfoService; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
|
|||
/** |
|||
* 计划管理 |
|||
* |
|||
* @author GJH |
|||
* @date 2025-07-03 |
|||
*/ |
|||
@Validated |
|||
@RequiredArgsConstructor |
|||
@RestController |
|||
@RequestMapping("/air/planInfo") |
|||
public class PlanInfoController extends BaseController { |
|||
|
|||
private final IPlanInfoService planInfoService; |
|||
|
|||
/** |
|||
* 查询计划管理列表 |
|||
*/ |
|||
//@SaCheckPermission("air:planInfo:list")
|
|||
@GetMapping("/list") |
|||
public TableDataInfo<PlanInfoVo> list(PlanInfoBo bo, PageQuery pageQuery) { |
|||
return planInfoService.queryPageList(bo, pageQuery); |
|||
} |
|||
|
|||
/** |
|||
* 导出计划管理列表 |
|||
*/ |
|||
//@SaCheckPermission("air:planInfo:export")
|
|||
@Log(title = "计划管理", businessType = BusinessType.EXPORT) |
|||
@PostMapping("/export") |
|||
public void export(PlanInfoBo bo, HttpServletResponse response) { |
|||
List<PlanInfoVo> list = planInfoService.queryList(bo); |
|||
ExcelUtil.exportExcel(list, "计划管理", PlanInfoVo.class, response); |
|||
} |
|||
|
|||
/** |
|||
* 获取计划管理详细信息 |
|||
* |
|||
* @param id 主键 |
|||
*/ |
|||
//@SaCheckPermission("air:planInfo:query")
|
|||
@GetMapping("/{id}") |
|||
public R<PlanInfoVo> getInfo(@NotNull(message = "主键不能为空") |
|||
@PathVariable String id) { |
|||
return R.ok(planInfoService.queryById(id)); |
|||
} |
|||
|
|||
/** |
|||
* 新增计划管理 |
|||
*/ |
|||
//@SaCheckPermission("air:planInfo:add")
|
|||
@Log(title = "计划管理", businessType = BusinessType.INSERT) |
|||
@RepeatSubmit() |
|||
@PostMapping() |
|||
public R<Void> add(@Validated(AddGroup.class) @RequestBody PlanInfoBo bo) { |
|||
return toAjax(planInfoService.insertByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 修改计划管理 |
|||
*/ |
|||
//@SaCheckPermission("air:planInfo:edit")
|
|||
@Log(title = "计划管理", businessType = BusinessType.UPDATE) |
|||
@RepeatSubmit() |
|||
@PutMapping() |
|||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody PlanInfoBo bo) { |
|||
return toAjax(planInfoService.updateByBo(bo)); |
|||
} |
|||
|
|||
/** |
|||
* 删除计划管理 |
|||
* |
|||
* @param ids 主键串 |
|||
*/ |
|||
//@SaCheckPermission("air:planInfo:remove")
|
|||
@Log(title = "计划管理", businessType = BusinessType.DELETE) |
|||
@DeleteMapping("/{ids}") |
|||
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
|||
@PathVariable String[] ids) { |
|||
return toAjax(planInfoService.deleteWithValidByIds(List.of(ids), true)); |
|||
} |
|||
} |
@ -0,0 +1,84 @@ |
|||
package org.dromara.demo.domain; |
|||
|
|||
import org.dromara.common.tenant.core.TenantEntity; |
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import java.util.Date; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
|
|||
import java.io.Serial; |
|||
|
|||
/** |
|||
* 计划管理对象 plan_info |
|||
* |
|||
* @author GJH |
|||
* @date 2025-07-03 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@TableName("plan_info") |
|||
public class PlanInfo extends TenantEntity { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
@TableId(value = "id") |
|||
private String id; |
|||
|
|||
/** |
|||
* 计划号 |
|||
*/ |
|||
private String planNum; |
|||
|
|||
/** |
|||
* 计划日期 |
|||
*/ |
|||
private Date planDate; |
|||
|
|||
/** |
|||
* 子站名称 |
|||
*/ |
|||
private String station; |
|||
|
|||
/** |
|||
* 子站状态 |
|||
*/ |
|||
private String status; |
|||
|
|||
/** |
|||
* 所属区域 |
|||
*/ |
|||
private String area; |
|||
|
|||
/** |
|||
* 运维公司 |
|||
*/ |
|||
private String ioCompany; |
|||
|
|||
/** |
|||
* 运维人员 |
|||
*/ |
|||
private String ioPerson; |
|||
|
|||
/** |
|||
* 监理类型 |
|||
*/ |
|||
private String monitorType; |
|||
|
|||
/** |
|||
* 监理公司 |
|||
*/ |
|||
private String monitorCompany; |
|||
|
|||
/** |
|||
* 删除标志 |
|||
*/ |
|||
@TableLogic |
|||
private Long delFlag; |
|||
|
|||
|
|||
} |
@ -0,0 +1,89 @@ |
|||
package org.dromara.demo.domain.bo; |
|||
|
|||
import org.dromara.demo.domain.PlanInfo; |
|||
import org.dromara.common.mybatis.core.domain.BaseEntity; |
|||
import org.dromara.common.core.validate.AddGroup; |
|||
import org.dromara.common.core.validate.EditGroup; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import jakarta.validation.constraints.*; |
|||
import java.util.Date; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
/** |
|||
* 计划管理业务对象 plan_info |
|||
* |
|||
* @author GJH |
|||
* @date 2025-07-03 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@AutoMapper(target = PlanInfo.class, reverseConvertGenerate = false) |
|||
public class PlanInfoBo extends BaseEntity { |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
//@NotBlank(message = "主键ID不能为空", groups = { EditGroup.class })
|
|||
private String id; |
|||
|
|||
/** |
|||
* 计划号 |
|||
*/ |
|||
//@NotBlank(message = "计划号不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String planNum; |
|||
|
|||
/** |
|||
* 计划日期 |
|||
*/ |
|||
//@NotNull(message = "计划日期不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
@JsonFormat(pattern = "yyyy-MM-dd") |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd") |
|||
private Date planDate; |
|||
|
|||
/** |
|||
* 子站名称 |
|||
*/ |
|||
//@NotBlank(message = "子站名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String station; |
|||
|
|||
/** |
|||
* 子站状态 |
|||
*/ |
|||
//@NotBlank(message = "子站状态不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String status; |
|||
|
|||
/** |
|||
* 所属区域 |
|||
*/ |
|||
//@NotBlank(message = "所属区域不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String area; |
|||
|
|||
/** |
|||
* 运维公司 |
|||
*/ |
|||
//@NotBlank(message = "运维公司不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String ioCompany; |
|||
|
|||
/** |
|||
* 运维人员 |
|||
*/ |
|||
//@NotBlank(message = "运维人员不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String ioPerson; |
|||
|
|||
/** |
|||
* 监理类型 |
|||
*/ |
|||
//@NotBlank(message = "监理类型不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String monitorType; |
|||
|
|||
/** |
|||
* 监理公司 |
|||
*/ |
|||
//@NotBlank(message = "监理公司不能为空", groups = { AddGroup.class, EditGroup.class })
|
|||
private String monitorCompany; |
|||
|
|||
|
|||
} |
@ -0,0 +1,97 @@ |
|||
package org.dromara.demo.domain.vo; |
|||
|
|||
import java.util.Date; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.dromara.demo.domain.PlanInfo; |
|||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
|||
import com.alibaba.excel.annotation.ExcelProperty; |
|||
import org.dromara.common.excel.annotation.ExcelDictFormat; |
|||
import org.dromara.common.excel.convert.ExcelDictConvert; |
|||
import io.github.linpeilie.annotations.AutoMapper; |
|||
import lombok.Data; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import java.io.Serial; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 计划管理视图对象 plan_info |
|||
* |
|||
* @author GJH |
|||
* @date 2025-07-03 |
|||
*/ |
|||
@Data |
|||
@ExcelIgnoreUnannotated |
|||
@AutoMapper(target = PlanInfo.class) |
|||
public class PlanInfoVo implements Serializable { |
|||
|
|||
@Serial |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
@ExcelProperty(value = "主键ID") |
|||
private String id; |
|||
|
|||
/** |
|||
* 计划号 |
|||
*/ |
|||
@ExcelProperty(value = "计划号") |
|||
private String planNum; |
|||
|
|||
/** |
|||
* 计划日期 |
|||
*/ |
|||
@ExcelProperty(value = "计划日期") |
|||
@JsonFormat(pattern = "yyyy-MM-dd") |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd") |
|||
private Date planDate; |
|||
|
|||
/** |
|||
* 子站名称 |
|||
*/ |
|||
@ExcelProperty(value = "子站名称") |
|||
private String station; |
|||
|
|||
/** |
|||
* 子站状态 |
|||
*/ |
|||
@ExcelProperty(value = "子站状态") |
|||
private String status; |
|||
|
|||
/** |
|||
* 所属区域 |
|||
*/ |
|||
@ExcelProperty(value = "所属区域") |
|||
private String area; |
|||
|
|||
/** |
|||
* 运维公司 |
|||
*/ |
|||
@ExcelProperty(value = "运维公司") |
|||
private String ioCompany; |
|||
|
|||
/** |
|||
* 运维人员 |
|||
*/ |
|||
@ExcelProperty(value = "运维人员") |
|||
private String ioPerson; |
|||
|
|||
/** |
|||
* 监理类型 |
|||
*/ |
|||
@ExcelProperty(value = "监理类型") |
|||
private String monitorType; |
|||
|
|||
/** |
|||
* 监理公司 |
|||
*/ |
|||
@ExcelProperty(value = "监理公司") |
|||
private String monitorCompany; |
|||
|
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package org.dromara.demo.mapper; |
|||
|
|||
import org.dromara.demo.domain.PlanInfo; |
|||
import org.dromara.demo.domain.vo.PlanInfoVo; |
|||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
|||
|
|||
/** |
|||
* 计划管理Mapper接口 |
|||
* |
|||
* @author GJH |
|||
* @date 2025-07-03 |
|||
*/ |
|||
public interface PlanInfoMapper extends BaseMapperPlus<PlanInfo, PlanInfoVo> { |
|||
|
|||
} |
@ -0,0 +1,68 @@ |
|||
package org.dromara.demo.service; |
|||
|
|||
import org.dromara.demo.domain.vo.PlanInfoVo; |
|||
import org.dromara.demo.domain.bo.PlanInfoBo; |
|||
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|||
import org.dromara.common.mybatis.core.page.PageQuery; |
|||
|
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 计划管理Service接口 |
|||
* |
|||
* @author GJH |
|||
* @date 2025-07-03 |
|||
*/ |
|||
public interface IPlanInfoService { |
|||
|
|||
/** |
|||
* 查询计划管理 |
|||
* |
|||
* @param id 主键 |
|||
* @return 计划管理 |
|||
*/ |
|||
PlanInfoVo queryById(String id); |
|||
|
|||
/** |
|||
* 分页查询计划管理列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 计划管理分页列表 |
|||
*/ |
|||
TableDataInfo<PlanInfoVo> queryPageList(PlanInfoBo bo, PageQuery pageQuery); |
|||
|
|||
/** |
|||
* 查询符合条件的计划管理列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 计划管理列表 |
|||
*/ |
|||
List<PlanInfoVo> queryList(PlanInfoBo bo); |
|||
|
|||
/** |
|||
* 新增计划管理 |
|||
* |
|||
* @param bo 计划管理 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
Boolean insertByBo(PlanInfoBo bo); |
|||
|
|||
/** |
|||
* 修改计划管理 |
|||
* |
|||
* @param bo 计划管理 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
Boolean updateByBo(PlanInfoBo bo); |
|||
|
|||
/** |
|||
* 校验并批量删除计划管理信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid); |
|||
} |
@ -0,0 +1,137 @@ |
|||
package org.dromara.demo.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.demo.domain.bo.PlanInfoBo; |
|||
import org.dromara.demo.domain.vo.PlanInfoVo; |
|||
import org.dromara.demo.domain.PlanInfo; |
|||
import org.dromara.demo.mapper.PlanInfoMapper; |
|||
import org.dromara.demo.service.IPlanInfoService; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Collection; |
|||
|
|||
/** |
|||
* 计划管理Service业务层处理 |
|||
* |
|||
* @author GJH |
|||
* @date 2025-07-03 |
|||
*/ |
|||
@RequiredArgsConstructor |
|||
@Service |
|||
public class PlanInfoServiceImpl implements IPlanInfoService { |
|||
|
|||
private final PlanInfoMapper baseMapper; |
|||
|
|||
/** |
|||
* 查询计划管理 |
|||
* |
|||
* @param id 主键 |
|||
* @return 计划管理 |
|||
*/ |
|||
@Override |
|||
public PlanInfoVo queryById(String id){ |
|||
return baseMapper.selectVoById(id); |
|||
} |
|||
|
|||
/** |
|||
* 分页查询计划管理列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @param pageQuery 分页参数 |
|||
* @return 计划管理分页列表 |
|||
*/ |
|||
@Override |
|||
public TableDataInfo<PlanInfoVo> queryPageList(PlanInfoBo bo, PageQuery pageQuery) { |
|||
LambdaQueryWrapper<PlanInfo> lqw = buildQueryWrapper(bo); |
|||
Page<PlanInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
|||
return TableDataInfo.build(result); |
|||
} |
|||
|
|||
/** |
|||
* 查询符合条件的计划管理列表 |
|||
* |
|||
* @param bo 查询条件 |
|||
* @return 计划管理列表 |
|||
*/ |
|||
@Override |
|||
public List<PlanInfoVo> queryList(PlanInfoBo bo) { |
|||
LambdaQueryWrapper<PlanInfo> lqw = buildQueryWrapper(bo); |
|||
return baseMapper.selectVoList(lqw); |
|||
} |
|||
|
|||
private LambdaQueryWrapper<PlanInfo> buildQueryWrapper(PlanInfoBo bo) { |
|||
Map<String, Object> params = bo.getParams(); |
|||
LambdaQueryWrapper<PlanInfo> lqw = Wrappers.lambdaQuery(); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getPlanNum()), PlanInfo::getPlanNum, bo.getPlanNum()); |
|||
lqw.eq(bo.getPlanDate() != null, PlanInfo::getPlanDate, bo.getPlanDate()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getStation()), PlanInfo::getStation, bo.getStation()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), PlanInfo::getStatus, bo.getStatus()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getArea()), PlanInfo::getArea, bo.getArea()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getIoCompany()), PlanInfo::getIoCompany, bo.getIoCompany()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getIoPerson()), PlanInfo::getIoPerson, bo.getIoPerson()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getMonitorType()), PlanInfo::getMonitorType, bo.getMonitorType()); |
|||
lqw.eq(StringUtils.isNotBlank(bo.getMonitorCompany()), PlanInfo::getMonitorCompany, bo.getMonitorCompany()); |
|||
return lqw; |
|||
} |
|||
|
|||
/** |
|||
* 新增计划管理 |
|||
* |
|||
* @param bo 计划管理 |
|||
* @return 是否新增成功 |
|||
*/ |
|||
@Override |
|||
public Boolean insertByBo(PlanInfoBo bo) { |
|||
PlanInfo add = MapstructUtils.convert(bo, PlanInfo.class); |
|||
validEntityBeforeSave(add); |
|||
boolean flag = baseMapper.insert(add) > 0; |
|||
if (flag) { |
|||
bo.setId(add.getId()); |
|||
} |
|||
return flag; |
|||
} |
|||
|
|||
/** |
|||
* 修改计划管理 |
|||
* |
|||
* @param bo 计划管理 |
|||
* @return 是否修改成功 |
|||
*/ |
|||
@Override |
|||
public Boolean updateByBo(PlanInfoBo bo) { |
|||
PlanInfo update = MapstructUtils.convert(bo, PlanInfo.class); |
|||
validEntityBeforeSave(update); |
|||
return baseMapper.updateById(update) > 0; |
|||
} |
|||
|
|||
/** |
|||
* 保存前的数据校验 |
|||
*/ |
|||
private void validEntityBeforeSave(PlanInfo entity){ |
|||
//TODO 做一些数据校验,如唯一约束
|
|||
} |
|||
|
|||
/** |
|||
* 校验并批量删除计划管理信息 |
|||
* |
|||
* @param ids 待删除的主键集合 |
|||
* @param isValid 是否进行有效性校验 |
|||
* @return 是否删除成功 |
|||
*/ |
|||
@Override |
|||
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) { |
|||
if(isValid){ |
|||
//TODO 做一些业务上的校验,判断是否需要校验
|
|||
} |
|||
return baseMapper.deleteByIds(ids) > 0; |
|||
} |
|||
} |
Loading…
Reference in new issue