diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/controller/admin/RepairProjectController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/controller/admin/RepairProjectController.java index e254afe9..00b2d455 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/controller/admin/RepairProjectController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/controller/admin/RepairProjectController.java @@ -1,16 +1,14 @@ package cn.iocoder.yudao.module.project.controller.admin; -import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; -import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.module.project.entity.RepairProject; import cn.iocoder.yudao.module.project.service.RepairProjectService; import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO; import cn.iocoder.yudao.module.project.vo.RepairProjectRespVO; import cn.iocoder.yudao.module.project.vo.RepairProjectSaveReqVO; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; @@ -19,12 +17,8 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; -import java.io.IOException; -import java.util.List; -import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Tag(name = "管理后台 - 维修项目") @@ -36,21 +30,46 @@ public class RepairProjectController { @Resource private RepairProjectService repairProjectService; + /** + * 创建维修项目 + * + * @param createReqVO RepairProjectSaveReqVO实体 + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 14:56 2024/9/12 + **/ @PostMapping("/create") @Operation(summary = "创建维修项目") @PreAuthorize("@ss.hasPermission('repair:project:create')") - public CommonResult createRepairProject(@Valid @RequestBody RepairProjectSaveReqVO createReqVO) { - return success(repairProjectService.createRepairProject(createReqVO)); + public CommonResult createRepairProject(@Valid @RequestBody RepairProjectSaveReqVO createReqVO) { + repairProjectService.saveRepairProject(createReqVO); + return success(true); } + /** + * 更新维修项目 + * + * @param updateReqVO RepairProjectSaveReqVO实体 + * @return cn.iocoder.yudao.framewor.k.common.pojo.CommonResult + * @author PQZ + * @date 14:56 2024/9/12 + **/ @PutMapping("/update") @Operation(summary = "更新维修项目") @PreAuthorize("@ss.hasPermission('repair:project:update')") public CommonResult updateRepairProject(@Valid @RequestBody RepairProjectSaveReqVO updateReqVO) { - repairProjectService.updateRepairProject(updateReqVO); + repairProjectService.saveRepairProject(updateReqVO); return success(true); } + /** + * 删除维修项目 + * + * @param id 维修项目id + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 14:59 2024/9/12 + **/ @DeleteMapping("/delete") @Operation(summary = "删除维修项目") @Parameter(name = "id", description = "编号", required = true) @@ -60,6 +79,14 @@ public class RepairProjectController { return success(true); } + /** + * 根据维修项目id获取维修项目 + * + * @param id 维修项目id + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + * @author PQZ + * @date 14:59 2024/9/12 + **/ @GetMapping("/get") @Operation(summary = "获得维修项目") @Parameter(name = "id", description = "编号", required = true, example = "1024") @@ -69,25 +96,25 @@ public class RepairProjectController { return success(BeanUtils.toBean(repairProject, RepairProjectRespVO.class)); } + + /** + * 分页获取维修项目分页 + * + * @param pageReqVO RepairProjectPageReqVO + * @param pageNo 分页参数 + * @param pageSize 分页参数 + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult> + * @author PQZ + * @date 15:04 2024/9/12 + **/ @GetMapping("/page") @Operation(summary = "获得维修项目分页") @PreAuthorize("@ss.hasPermission('repair:project:query')") - public CommonResult> getRepairProjectPage(@Valid RepairProjectPageReqVO pageReqVO) { - PageResult pageResult = repairProjectService.getRepairProjectPage(pageReqVO); - return success(BeanUtils.toBean(pageResult, RepairProjectRespVO.class)); - } - - @GetMapping("/export-excel") - @Operation(summary = "导出维修项目 Excel") - @PreAuthorize("@ss.hasPermission('repair:project:export')") - @ApiAccessLog(operateType = EXPORT) - public void exportRepairProjectExcel(@Valid RepairProjectPageReqVO pageReqVO, - HttpServletResponse response) throws IOException { - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); - List list = repairProjectService.getRepairProjectPage(pageReqVO).getList(); - // 导出 Excel - ExcelUtils.write(response, "维修项目.xls", "数据", RepairProjectRespVO.class, - BeanUtils.toBean(list, RepairProjectRespVO.class)); + public CommonResult> getRepairProjectPage(RepairProjectPageReqVO pageReqVO, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { + Page page = new Page<>(pageNo, pageSize); + return success(repairProjectService.queryListPage(pageReqVO,page)); } } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/entity/RepairProject.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/entity/RepairProject.java index 576c2e7b..17cc2a9e 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/entity/RepairProject.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/entity/RepairProject.java @@ -58,6 +58,8 @@ public class RepairProject extends TenantBaseDO { * 工时 */ private String manHour; + /**供应商*/ + private String corpId; /** * 是否自助(0否1是) */ diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/mapper/RepairProjectMapper.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/mapper/RepairProjectMapper.java index 8b2b259c..a35fbe10 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/mapper/RepairProjectMapper.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/mapper/RepairProjectMapper.java @@ -1,8 +1,13 @@ package cn.iocoder.yudao.module.project.mapper; import cn.iocoder.yudao.module.project.entity.RepairProject; +import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO; +import cn.iocoder.yudao.module.project.vo.RepairProjectRespVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 维修项目 Mapper @@ -12,4 +17,15 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface RepairProjectMapper extends BaseMapper { + /** + * 分页查询维修项目信息 + * + * @param pageReqVO RepairProjectPageReqVO实体 + * @param page 分页参数故 + * @return com.baomidou.mybatisplus.core.metadata.IPage + * @author PQZ + * @date 15:13 2024/9/12 + **/ + IPage selectListPage(@Param("entity") RepairProjectPageReqVO pageReqVO, Page page); + } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/RepairProjectService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/RepairProjectService.java index 6fe81843..248175b7 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/RepairProjectService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/RepairProjectService.java @@ -1,14 +1,14 @@ package cn.iocoder.yudao.module.project.service; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.project.entity.RepairProject; import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO; +import cn.iocoder.yudao.module.project.vo.RepairProjectRespVO; import cn.iocoder.yudao.module.project.vo.RepairProjectSaveReqVO; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; -import javax.validation.Valid; - /** * 维修项目 Service 接口 * @@ -17,41 +17,43 @@ import javax.validation.Valid; public interface RepairProjectService extends IService { /** - * 创建维修项目 + * 保存维修项目 * - * @param createReqVO 创建信息 - * @return 编号 - */ - String createRepairProject(@Valid RepairProjectSaveReqVO createReqVO); - - /** - * 更新维修项目 - * - * @param updateReqVO 更新信息 - */ - void updateRepairProject(@Valid RepairProjectSaveReqVO updateReqVO); + * @param saveReqVO RepairProjectSaveReqVO实体 + * @author PQZ + * @date 14:51 2024/9/12 + **/ + void saveRepairProject(RepairProjectSaveReqVO saveReqVO); /** * 删除维修项目 * - * @param id 编号 - */ + * @param id 维修项目id + * @author PQZ + * @date 15:08 2024/9/12 + **/ void deleteRepairProject(String id); /** - * 获得维修项目 + * 根据id获取维修项目 * - * @param id 编号 - * @return 维修项目 - */ + * @param id 维修项目id + * @return cn.iocoder.yudao.module.project.entity.RepairProject + * @author PQZ + * @date 15:08 2024/9/12 + **/ RepairProject getRepairProject(String id); /** - * 获得维修项目分页 + * 分页查询维修项目 * - * @param pageReqVO 分页查询 - * @return 维修项目分页 - */ - PageResult getRepairProjectPage(RepairProjectPageReqVO pageReqVO); + * @param pageReqVO RepairProjectPageReqVO实体 + * @param page 分页参数 + * @return com.baomidou.mybatisplus.core.metadata.IPage + * @author PQZ + * @date 15:08 2024/9/12 + **/ + IPage queryListPage(RepairProjectPageReqVO pageReqVO, Page page); + } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/impl/RepairProjectServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/impl/RepairProjectServiceImpl.java index c0e04f32..8e7cc44a 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/impl/RepairProjectServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/impl/RepairProjectServiceImpl.java @@ -1,12 +1,14 @@ package cn.iocoder.yudao.module.project.service.impl; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.project.entity.RepairProject; import cn.iocoder.yudao.module.project.mapper.RepairProjectMapper; import cn.iocoder.yudao.module.project.service.RepairProjectService; import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO; +import cn.iocoder.yudao.module.project.vo.RepairProjectRespVO; import cn.iocoder.yudao.module.project.vo.RepairProjectSaveReqVO; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -25,46 +27,59 @@ public class RepairProjectServiceImpl extends ServiceImpl + * @author PQZ + * @date 15:08 2024/9/12 + **/ @Override - public PageResult getRepairProjectPage(RepairProjectPageReqVO pageReqVO) { - return null; + public IPage queryListPage(RepairProjectPageReqVO pageReqVO, Page page) { + return repairProjectMapper.selectListPage(pageReqVO,page); } + } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairProjectPageReqVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairProjectPageReqVO.java index 03a6a043..83bbaab8 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairProjectPageReqVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairProjectPageReqVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.project.vo; +import cn.iocoder.yudao.module.project.entity.RepairProject; import lombok.*; import java.util.*; import io.swagger.v3.oas.annotations.media.Schema; @@ -14,43 +15,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class RepairProjectPageReqVO extends PageParam { +public class RepairProjectPageReqVO extends RepairProject { - @Schema(description = "名称", example = "王五") - private String name; - - @Schema(description = "成本") - private Long cost; - - @Schema(description = "规格") - private String spec; - - @Schema(description = "售价", example = "16985") - private BigDecimal price; - - @Schema(description = "编码") - private String code; - - @Schema(description = "单位") - private String unit; - - @Schema(description = "分类", example = "1") - private String type; - - @Schema(description = "工时") - private String manHour; - - @Schema(description = "是否自助(0否1是)") - private String isSelf; - - @Schema(description = "是否允许分店公用此产品(0否1是)") - private String isPublic; - - @Schema(description = "备注", example = "你说的对") - private String remark; - - @Schema(description = "创建时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime[] createTime; } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairProjectRespVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairProjectRespVO.java index a33ecf76..d2db34ff 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairProjectRespVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairProjectRespVO.java @@ -1,68 +1,23 @@ package cn.iocoder.yudao.module.project.vo; +import cn.iocoder.yudao.module.project.entity.RepairProject; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; + import java.util.*; import java.math.BigDecimal; + import org.springframework.format.annotation.DateTimeFormat; + import java.time.LocalDateTime; + import com.alibaba.excel.annotation.*; @Schema(description = "管理后台 - 维修项目 Response VO") @Data @ExcelIgnoreUnannotated -public class RepairProjectRespVO { - - @Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "2050") - @ExcelProperty("主键标识") - private String id; - - @Schema(description = "名称", example = "王五") - @ExcelProperty("名称") - private String name; - - @Schema(description = "成本") - @ExcelProperty("成本") - private Long cost; - - @Schema(description = "规格") - @ExcelProperty("规格") - private String spec; - - @Schema(description = "售价", example = "16985") - @ExcelProperty("售价") - private BigDecimal price; - - @Schema(description = "编码") - @ExcelProperty("编码") - private String code; - - @Schema(description = "单位") - @ExcelProperty("单位") - private String unit; - - @Schema(description = "分类", example = "1") - @ExcelProperty("分类") - private String type; - - @Schema(description = "工时") - @ExcelProperty("工时") - private String manHour; - - @Schema(description = "是否自助(0否1是)") - @ExcelProperty("是否自助(0否1是)") - private String isSelf; - - @Schema(description = "是否允许分店公用此产品(0否1是)") - @ExcelProperty("是否允许分店公用此产品(0否1是)") - private String isPublic; - - @Schema(description = "备注", example = "你说的对") - @ExcelProperty("备注") - private String remark; - - @Schema(description = "创建时间") - @ExcelProperty("创建时间") - private LocalDateTime createTime; +public class RepairProjectRespVO extends RepairProject { + /**所属分类*/ + private String typeName; } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairProjectSaveReqVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairProjectSaveReqVO.java index f1f4e808..e925a006 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairProjectSaveReqVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairProjectSaveReqVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.project.vo; +import cn.iocoder.yudao.module.project.entity.RepairProject; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; @@ -8,42 +9,8 @@ import java.math.BigDecimal; @Schema(description = "管理后台 - 维修项目新增/修改 Request VO") @Data -public class RepairProjectSaveReqVO { +public class RepairProjectSaveReqVO extends RepairProject { - @Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "2050") - private String id; - @Schema(description = "名称", example = "王五") - private String name; - - @Schema(description = "成本") - private Long cost; - - @Schema(description = "规格") - private String spec; - - @Schema(description = "售价", example = "16985") - private BigDecimal price; - - @Schema(description = "编码") - private String code; - - @Schema(description = "单位") - private String unit; - - @Schema(description = "分类", example = "1") - private String type; - - @Schema(description = "工时") - private String manHour; - - @Schema(description = "是否自助(0否1是)") - private String isSelf; - - @Schema(description = "是否允许分店公用此产品(0否1是)") - private String isPublic; - - @Schema(description = "备注", example = "你说的对") - private String remark; } \ No newline at end of file diff --git a/dl-module-repair/src/main/resources/mapper/project/RepairProjectMapper.xml b/dl-module-repair/src/main/resources/mapper/project/RepairProjectMapper.xml index 3973a873..e2314d79 100644 --- a/dl-module-repair/src/main/resources/mapper/project/RepairProjectMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/project/RepairProjectMapper.xml @@ -9,4 +9,28 @@ 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ --> + \ No newline at end of file