Commit ce393c8817e50ff5dc4895ac05d1c4733bab59ba
1 parent
8efd4176
养护频次提交+增加获取二级部门接口
Showing
11 changed files
with
481 additions
and
0 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/PlanRateController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.planrate; | |
| 2 | + | |
| 3 | +import org.springframework.web.bind.annotation.*; | |
| 4 | +import jakarta.annotation.Resource; | |
| 5 | +import org.springframework.validation.annotation.Validated; | |
| 6 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 7 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 8 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 9 | +import io.swagger.v3.oas.annotations.Operation; | |
| 10 | + | |
| 11 | +import jakarta.validation.constraints.*; | |
| 12 | +import jakarta.validation.*; | |
| 13 | +import jakarta.servlet.http.*; | |
| 14 | +import java.util.*; | |
| 15 | +import java.io.IOException; | |
| 16 | + | |
| 17 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 18 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 19 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | |
| 20 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 21 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | |
| 22 | + | |
| 23 | +import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; | |
| 24 | + | |
| 25 | +import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; | |
| 26 | +import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.*; | |
| 27 | + | |
| 28 | +import com.zteits.urbanops.module.garden.controller.admin.planrate.vo.*; | |
| 29 | +import com.zteits.urbanops.module.garden.dal.dataobject.planrate.PlanRateDO; | |
| 30 | +import com.zteits.urbanops.module.garden.service.planrate.PlanRateService; | |
| 31 | + | |
| 32 | +@Tag(name = "管理后台 - 计划频次") | |
| 33 | +@RestController | |
| 34 | +@RequestMapping("/garden/plan-rate") | |
| 35 | +@Validated | |
| 36 | +public class PlanRateController { | |
| 37 | + | |
| 38 | + @Resource | |
| 39 | + private PlanRateService planRateService; | |
| 40 | + | |
| 41 | + @PostMapping("/create") | |
| 42 | + @Operation(summary = "创建计划频次") | |
| 43 | + @PreAuthorize("@ss.hasPermission('garden:plan-rate:create')") | |
| 44 | + public CommonResult<Long> createPlanRate(@Valid @RequestBody PlanRateSaveReqVO createReqVO) { | |
| 45 | + return success(planRateService.createPlanRate(createReqVO)); | |
| 46 | + } | |
| 47 | + | |
| 48 | + @PutMapping("/update") | |
| 49 | + @Operation(summary = "更新计划频次") | |
| 50 | + @PreAuthorize("@ss.hasPermission('garden:plan-rate:update')") | |
| 51 | + public CommonResult<Boolean> updatePlanRate(@Valid @RequestBody PlanRateSaveReqVO updateReqVO) { | |
| 52 | + planRateService.updatePlanRate(updateReqVO); | |
| 53 | + return success(true); | |
| 54 | + } | |
| 55 | + | |
| 56 | + @DeleteMapping("/delete") | |
| 57 | + @Operation(summary = "删除计划频次") | |
| 58 | + @Parameter(name = "id", description = "编号", required = true) | |
| 59 | + @PreAuthorize("@ss.hasPermission('garden:plan-rate:delete')") | |
| 60 | + public CommonResult<Boolean> deletePlanRate(@RequestParam("id") Long id) { | |
| 61 | + planRateService.deletePlanRate(id); | |
| 62 | + return success(true); | |
| 63 | + } | |
| 64 | + | |
| 65 | + @DeleteMapping("/delete-list") | |
| 66 | + @Parameter(name = "ids", description = "编号", required = true) | |
| 67 | + @Operation(summary = "批量删除计划频次") | |
| 68 | + @PreAuthorize("@ss.hasPermission('garden:plan-rate:delete')") | |
| 69 | + public CommonResult<Boolean> deletePlanRateList(@RequestParam("ids") List<Long> ids) { | |
| 70 | + planRateService.deletePlanRateListByIds(ids); | |
| 71 | + return success(true); | |
| 72 | + } | |
| 73 | + | |
| 74 | + @GetMapping("/get") | |
| 75 | + @Operation(summary = "获得计划频次") | |
| 76 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 77 | + @PreAuthorize("@ss.hasPermission('garden:plan-rate:query')") | |
| 78 | + public CommonResult<PlanRateRespVO> getPlanRate(@RequestParam("id") Long id) { | |
| 79 | + PlanRateDO planRate = planRateService.getPlanRate(id); | |
| 80 | + return success(BeanUtils.toBean(planRate, PlanRateRespVO.class)); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @GetMapping("/page") | |
| 84 | + @Operation(summary = "获得计划频次分页") | |
| 85 | + @PreAuthorize("@ss.hasPermission('garden:plan-rate:query')") | |
| 86 | + public CommonResult<PageResult<PlanRateRespVO>> getPlanRatePage(@Valid PlanRatePageReqVO pageReqVO) { | |
| 87 | + PageResult<PlanRateDO> pageResult = planRateService.getPlanRatePage(pageReqVO); | |
| 88 | + return success(BeanUtils.toBean(pageResult, PlanRateRespVO.class)); | |
| 89 | + } | |
| 90 | + | |
| 91 | + @GetMapping("/export-excel") | |
| 92 | + @Operation(summary = "导出计划频次 Excel") | |
| 93 | + @PreAuthorize("@ss.hasPermission('garden:plan-rate:export')") | |
| 94 | + @ApiAccessLog(operateType = EXPORT) | |
| 95 | + public void exportPlanRateExcel(@Valid PlanRatePageReqVO pageReqVO, | |
| 96 | + HttpServletResponse response) throws IOException { | |
| 97 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 98 | + List<PlanRateDO> list = planRateService.getPlanRatePage(pageReqVO).getList(); | |
| 99 | + // 导出 Excel | |
| 100 | + ExcelUtils.write(response, "计划频次.xls", "数据", PlanRateRespVO.class, | |
| 101 | + BeanUtils.toBean(list, PlanRateRespVO.class)); | |
| 102 | + } | |
| 103 | + | |
| 104 | +} | |
| 0 | 105 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/vo/PlanRatePageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.planrate.vo; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - 计划频次分页 Request VO") | |
| 13 | +@Data | |
| 14 | +public class PlanRatePageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @Schema(description = "业务线: yl-园林;wy-物业:sz-市政") | |
| 17 | + private String busiLine; | |
| 18 | + | |
| 19 | + @Schema(description = "养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;", example = "13649") | |
| 20 | + private Integer planTypeId; | |
| 21 | + | |
| 22 | + @Schema(description = "级别: 10:特级;11:一级:12:二级;13:三级", example = "14661") | |
| 23 | + private Integer levelId; | |
| 24 | + | |
| 25 | + @Schema(description = "次数 如:1/3等") | |
| 26 | + private String rate; | |
| 27 | + | |
| 28 | + @Schema(description = "周期ID: 1:日/次;2:周/次;3:月/次;4:年/次", example = "17826") | |
| 29 | + private Integer cycleId; | |
| 30 | + | |
| 31 | + @Schema(description = "是否为标准计划: 1:是;2:否") | |
| 32 | + private Integer stdPlan; | |
| 33 | + | |
| 34 | + @Schema(description = "创建时间") | |
| 35 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 36 | + private LocalDateTime[] createTime; | |
| 37 | + | |
| 38 | +} | |
| 0 | 39 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/vo/PlanRateRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.planrate.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | +import cn.idev.excel.annotation.*; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - 计划频次 Response VO") | |
| 11 | +@Data | |
| 12 | +@ExcelIgnoreUnannotated | |
| 13 | +public class PlanRateRespVO { | |
| 14 | + | |
| 15 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "11435") | |
| 16 | + @ExcelProperty("ID") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "业务线: yl-园林;wy-物业:sz-市政", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 20 | + @ExcelProperty("业务线: yl-园林;wy-物业:sz-市政") | |
| 21 | + private String busiLine; | |
| 22 | + | |
| 23 | + @Schema(description = "养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;", requiredMode = Schema.RequiredMode.REQUIRED, example = "13649") | |
| 24 | + @ExcelProperty("养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;") | |
| 25 | + private Integer planTypeId; | |
| 26 | + | |
| 27 | + @Schema(description = "级别: 10:特级;11:一级:12:二级;13:三级", requiredMode = Schema.RequiredMode.REQUIRED, example = "14661") | |
| 28 | + @ExcelProperty("级别: 10:特级;11:一级:12:二级;13:三级") | |
| 29 | + private Integer levelId; | |
| 30 | + | |
| 31 | + @Schema(description = "次数 如:1/3等") | |
| 32 | + @ExcelProperty("次数 如:1/3等") | |
| 33 | + private String rate; | |
| 34 | + | |
| 35 | + @Schema(description = "周期ID: 1:日/次;2:周/次;3:月/次;4:年/次", requiredMode = Schema.RequiredMode.REQUIRED, example = "17826") | |
| 36 | + @ExcelProperty("周期ID: 1:日/次;2:周/次;3:月/次;4:年/次") | |
| 37 | + private Integer cycleId; | |
| 38 | + | |
| 39 | + @Schema(description = "是否为标准计划: 1:是;2:否", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 40 | + @ExcelProperty("是否为标准计划: 1:是;2:否") | |
| 41 | + private Integer stdPlan; | |
| 42 | + | |
| 43 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 44 | + @ExcelProperty("创建时间") | |
| 45 | + private LocalDateTime createTime; | |
| 46 | + | |
| 47 | +} | |
| 0 | 48 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/vo/PlanRateSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.planrate.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.*; | |
| 5 | +import java.util.*; | |
| 6 | +import jakarta.validation.constraints.*; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - 计划频次新增/修改 Request VO") | |
| 9 | +@Data | |
| 10 | +public class PlanRateSaveReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "11435") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + @Schema(description = "业务线: yl-园林;wy-物业:sz-市政", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 16 | + @NotEmpty(message = "业务线: yl-园林;wy-物业:sz-市政不能为空") | |
| 17 | + private String busiLine; | |
| 18 | + | |
| 19 | + @Schema(description = "养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;", requiredMode = Schema.RequiredMode.REQUIRED, example = "13649") | |
| 20 | + @NotNull(message = "养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;不能为空") | |
| 21 | + private Integer planTypeId; | |
| 22 | + | |
| 23 | + @Schema(description = "级别: 10:特级;11:一级:12:二级;13:三级", requiredMode = Schema.RequiredMode.REQUIRED, example = "14661") | |
| 24 | + @NotNull(message = "级别: 10:特级;11:一级:12:二级;13:三级不能为空") | |
| 25 | + private Integer levelId; | |
| 26 | + | |
| 27 | + @Schema(description = "次数 如:1/3等") | |
| 28 | + private String rate; | |
| 29 | + | |
| 30 | + @Schema(description = "周期ID: 1:日/次;2:周/次;3:月/次;4:年/次", requiredMode = Schema.RequiredMode.REQUIRED, example = "17826") | |
| 31 | + @NotNull(message = "周期ID: 1:日/次;2:周/次;3:月/次;4:年/次不能为空") | |
| 32 | + private Integer cycleId; | |
| 33 | + | |
| 34 | + @Schema(description = "是否为标准计划: 1:是;2:否", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 35 | + @NotNull(message = "是否为标准计划: 1:是;2:否不能为空") | |
| 36 | + private Integer stdPlan; | |
| 37 | + | |
| 38 | +} | |
| 0 | 39 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/planrate/PlanRateDO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.dataobject.planrate; | |
| 2 | + | |
| 3 | +import lombok.*; | |
| 4 | +import java.util.*; | |
| 5 | +import java.time.LocalDateTime; | |
| 6 | +import java.time.LocalDateTime; | |
| 7 | +import com.baomidou.mybatisplus.annotation.*; | |
| 8 | +import com.zteits.urbanops.framework.mybatis.core.dataobject.BaseDO; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 计划频次 DO | |
| 12 | + * | |
| 13 | + * @author 超级管理员 | |
| 14 | + */ | |
| 15 | +@TableName("garden_plan_rate") | |
| 16 | +@KeySequence("garden_plan_rate_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 17 | +@Data | |
| 18 | +@EqualsAndHashCode(callSuper = true) | |
| 19 | +@ToString(callSuper = true) | |
| 20 | +@Builder | |
| 21 | +@NoArgsConstructor | |
| 22 | +@AllArgsConstructor | |
| 23 | +public class PlanRateDO extends BaseDO { | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * ID | |
| 27 | + */ | |
| 28 | + @TableId | |
| 29 | + private Long id; | |
| 30 | + /** | |
| 31 | + * 业务线: yl-园林;wy-物业:sz-市政 | |
| 32 | + */ | |
| 33 | + private String busiLine; | |
| 34 | + /** | |
| 35 | + * 养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视; | |
| 36 | + */ | |
| 37 | + private Integer planTypeId; | |
| 38 | + /** | |
| 39 | + * 级别: 10:特级;11:一级:12:二级;13:三级 | |
| 40 | + */ | |
| 41 | + private Integer levelId; | |
| 42 | + /** | |
| 43 | + * 次数 如:1/3等 | |
| 44 | + */ | |
| 45 | + private String rate; | |
| 46 | + /** | |
| 47 | + * 周期ID: 1:日/次;2:周/次;3:月/次;4:年/次 | |
| 48 | + */ | |
| 49 | + private Integer cycleId; | |
| 50 | + /** | |
| 51 | + * 是否为标准计划: 1:是;2:否 | |
| 52 | + */ | |
| 53 | + private Integer stdPlan; | |
| 54 | + | |
| 55 | + | |
| 56 | +} | |
| 0 | 57 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/planrate/PlanRateMapper.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.mysql.planrate; | |
| 2 | + | |
| 3 | +import java.util.*; | |
| 4 | + | |
| 5 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 6 | +import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 7 | +import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; | |
| 8 | +import com.zteits.urbanops.module.garden.dal.dataobject.planrate.PlanRateDO; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | +import com.zteits.urbanops.module.garden.controller.admin.planrate.vo.*; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 计划频次 Mapper | |
| 14 | + * | |
| 15 | + * @author 超级管理员 | |
| 16 | + */ | |
| 17 | +@Mapper | |
| 18 | +public interface PlanRateMapper extends BaseMapperX<PlanRateDO> { | |
| 19 | + | |
| 20 | + default PageResult<PlanRateDO> selectPage(PlanRatePageReqVO reqVO) { | |
| 21 | + return selectPage(reqVO, new LambdaQueryWrapperX<PlanRateDO>() | |
| 22 | + .eqIfPresent(PlanRateDO::getBusiLine, reqVO.getBusiLine()) | |
| 23 | + .eqIfPresent(PlanRateDO::getPlanTypeId, reqVO.getPlanTypeId()) | |
| 24 | + .eqIfPresent(PlanRateDO::getLevelId, reqVO.getLevelId()) | |
| 25 | + .eqIfPresent(PlanRateDO::getRate, reqVO.getRate()) | |
| 26 | + .eqIfPresent(PlanRateDO::getCycleId, reqVO.getCycleId()) | |
| 27 | + .eqIfPresent(PlanRateDO::getStdPlan, reqVO.getStdPlan()) | |
| 28 | + .betweenIfPresent(PlanRateDO::getCreateTime, reqVO.getCreateTime()) | |
| 29 | + .orderByDesc(PlanRateDO::getId)); | |
| 30 | + } | |
| 31 | + | |
| 32 | +} | |
| 0 | 33 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/planrate/PlanRateService.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.planrate; | |
| 2 | + | |
| 3 | +import java.util.*; | |
| 4 | +import jakarta.validation.*; | |
| 5 | +import com.zteits.urbanops.module.garden.controller.admin.planrate.vo.*; | |
| 6 | +import com.zteits.urbanops.module.garden.dal.dataobject.planrate.PlanRateDO; | |
| 7 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 8 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 计划频次 Service 接口 | |
| 12 | + * | |
| 13 | + * @author 超级管理员 | |
| 14 | + */ | |
| 15 | +public interface PlanRateService { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 创建计划频次 | |
| 19 | + * | |
| 20 | + * @param createReqVO 创建信息 | |
| 21 | + * @return 编号 | |
| 22 | + */ | |
| 23 | + Long createPlanRate(@Valid PlanRateSaveReqVO createReqVO); | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 更新计划频次 | |
| 27 | + * | |
| 28 | + * @param updateReqVO 更新信息 | |
| 29 | + */ | |
| 30 | + void updatePlanRate(@Valid PlanRateSaveReqVO updateReqVO); | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 删除计划频次 | |
| 34 | + * | |
| 35 | + * @param id 编号 | |
| 36 | + */ | |
| 37 | + void deletePlanRate(Long id); | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 批量删除计划频次 | |
| 41 | + * | |
| 42 | + * @param ids 编号 | |
| 43 | + */ | |
| 44 | + void deletePlanRateListByIds(List<Long> ids); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 获得计划频次 | |
| 48 | + * | |
| 49 | + * @param id 编号 | |
| 50 | + * @return 计划频次 | |
| 51 | + */ | |
| 52 | + PlanRateDO getPlanRate(Long id); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 获得计划频次分页 | |
| 56 | + * | |
| 57 | + * @param pageReqVO 分页查询 | |
| 58 | + * @return 计划频次分页 | |
| 59 | + */ | |
| 60 | + PageResult<PlanRateDO> getPlanRatePage(PlanRatePageReqVO pageReqVO); | |
| 61 | + | |
| 62 | +} | |
| 0 | 63 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/planrate/PlanRateServiceImpl.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.planrate; | |
| 2 | + | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import org.springframework.stereotype.Service; | |
| 5 | +import jakarta.annotation.Resource; | |
| 6 | +import org.springframework.validation.annotation.Validated; | |
| 7 | +import org.springframework.transaction.annotation.Transactional; | |
| 8 | + | |
| 9 | +import java.util.*; | |
| 10 | +import com.zteits.urbanops.module.garden.controller.admin.planrate.vo.*; | |
| 11 | +import com.zteits.urbanops.module.garden.dal.dataobject.planrate.PlanRateDO; | |
| 12 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | |
| 13 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | |
| 14 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 15 | + | |
| 16 | +import com.zteits.urbanops.module.garden.dal.mysql.planrate.PlanRateMapper; | |
| 17 | + | |
| 18 | +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 19 | +import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.convertList; | |
| 20 | +import static com.zteits.urbanops.framework.common.util.collection.CollectionUtils.diffList; | |
| 21 | +import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.*; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * 计划频次 Service 实现类 | |
| 25 | + * | |
| 26 | + * @author 超级管理员 | |
| 27 | + */ | |
| 28 | +@Service | |
| 29 | +@Validated | |
| 30 | +public class PlanRateServiceImpl implements PlanRateService { | |
| 31 | + | |
| 32 | + @Resource | |
| 33 | + private PlanRateMapper planRateMapper; | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public Long createPlanRate(PlanRateSaveReqVO createReqVO) { | |
| 37 | + // 插入 | |
| 38 | + PlanRateDO planRate = BeanUtils.toBean(createReqVO, PlanRateDO.class); | |
| 39 | + planRateMapper.insert(planRate); | |
| 40 | + | |
| 41 | + // 返回 | |
| 42 | + return planRate.getId(); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public void updatePlanRate(PlanRateSaveReqVO updateReqVO) { | |
| 47 | + // 校验存在 | |
| 48 | + validatePlanRateExists(updateReqVO.getId()); | |
| 49 | + // 更新 | |
| 50 | + PlanRateDO updateObj = BeanUtils.toBean(updateReqVO, PlanRateDO.class); | |
| 51 | + planRateMapper.updateById(updateObj); | |
| 52 | + } | |
| 53 | + | |
| 54 | + @Override | |
| 55 | + public void deletePlanRate(Long id) { | |
| 56 | + // 校验存在 | |
| 57 | + validatePlanRateExists(id); | |
| 58 | + // 删除 | |
| 59 | + planRateMapper.deleteById(id); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @Override | |
| 63 | + public void deletePlanRateListByIds(List<Long> ids) { | |
| 64 | + // 删除 | |
| 65 | + planRateMapper.deleteByIds(ids); | |
| 66 | + } | |
| 67 | + | |
| 68 | + | |
| 69 | + private void validatePlanRateExists(Long id) { | |
| 70 | + if (planRateMapper.selectById(id) == null) { | |
| 71 | + //throw exception(PLAN_RATE_NOT_EXISTS); | |
| 72 | + } | |
| 73 | + } | |
| 74 | + | |
| 75 | + @Override | |
| 76 | + public PlanRateDO getPlanRate(Long id) { | |
| 77 | + return planRateMapper.selectById(id); | |
| 78 | + } | |
| 79 | + | |
| 80 | + @Override | |
| 81 | + public PageResult<PlanRateDO> getPlanRatePage(PlanRatePageReqVO pageReqVO) { | |
| 82 | + return planRateMapper.selectPage(pageReqVO); | |
| 83 | + } | |
| 84 | + | |
| 85 | +} | |
| 0 | 86 | \ No newline at end of file | ... | ... |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/controller/admin/dept/DeptController.java
| ... | ... | @@ -90,4 +90,12 @@ public class DeptController { |
| 90 | 90 | return success(BeanUtils.toBean(dept, DeptRespVO.class)); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | + @GetMapping("/sub-list") | |
| 94 | + @Operation(summary = "获取二级部门列表") | |
| 95 | + @PreAuthorize("@ss.hasPermission('system:dept:query')") | |
| 96 | + public CommonResult<List<DeptRespVO>> getSubDeptList() { | |
| 97 | + List<DeptDO> list = deptService.getSubDeptList(); | |
| 98 | + return success(BeanUtils.toBean(list, DeptRespVO.class)); | |
| 99 | + } | |
| 100 | + | |
| 93 | 101 | } | ... | ... |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/dept/DeptService.java
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/dept/DeptServiceImpl.java
| ... | ... | @@ -178,6 +178,11 @@ public class DeptServiceImpl implements DeptService { |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | @Override |
| 181 | + public List<DeptDO> getSubDeptList() { | |
| 182 | + return deptMapper.selectList(DeptDO::getParentId,100); | |
| 183 | + } | |
| 184 | + | |
| 185 | + @Override | |
| 181 | 186 | public List<DeptDO> getDeptList(DeptListReqVO reqVO) { |
| 182 | 187 | List<DeptDO> list = deptMapper.selectList(reqVO); |
| 183 | 188 | list.sort(Comparator.comparing(DeptDO::getSort)); | ... | ... |