Commit 06c721fd6f5409f2369c9909a3cd2b0dffc799bd
1 parent
ad88168c
字典api新增接口获取单个字典值
Showing
11 changed files
with
72 additions
and
5 deletions
urbanops-framework/urbanops-common/src/main/java/com/zteits/urbanops/framework/common/biz/system/dict/DictDataCommonApi.java
| ... | ... | @@ -19,6 +19,15 @@ public interface DictDataCommonApi { |
| 19 | 19 | */ |
| 20 | 20 | List<DictDataRespDTO> getDictDataList(String dictType); |
| 21 | 21 | |
| 22 | + /** | |
| 23 | + * 获得指定字典类型的字典数据列表 | |
| 24 | + * | |
| 25 | + * @param dictType 字典类型 | |
| 26 | + * @param value 字典值 | |
| 27 | + * @return 字典数据列表 | |
| 28 | + */ | |
| 29 | + DictDataRespDTO getDictData(String dictType, String value ); | |
| 30 | + | |
| 22 | 31 | |
| 23 | 32 | |
| 24 | 33 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/PlanRateDetailController.java
| ... | ... | @@ -80,8 +80,7 @@ public class PlanRateDetailController { |
| 80 | 80 | public CommonResult<PlanRateDetailRespVO> getPlanRateValue(@RequestParam("busi_Line") @NotBlank String busiLine, |
| 81 | 81 | @RequestParam("plan_type_id") @NotNull Integer planTypeId, |
| 82 | 82 | @RequestParam("level_id") @NotNull Integer levelId) { |
| 83 | - PlanRateDetailDO detail = planRateDetailService.getPlanRateValue(busiLine, planTypeId, levelId ); | |
| 84 | - return success(BeanUtils.toBean(detail, PlanRateDetailRespVO.class)); | |
| 83 | + return success(planRateDetailService.getPlanRateValue(busiLine, planTypeId, levelId )); | |
| 85 | 84 | } |
| 86 | 85 | |
| 87 | 86 | @GetMapping("/page") | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/vo/PlanRateDetailRespVO.java
| ... | ... | @@ -43,6 +43,10 @@ public class PlanRateDetailRespVO { |
| 43 | 43 | @ExcelProperty("周期ID: 1:日/次;2:周/次;3:月/次;4:年/次") |
| 44 | 44 | private Integer cycleId; |
| 45 | 45 | |
| 46 | + @Schema(description = "周期名称: 1:日/次;2:周/次;3:月/次;4:年/次", requiredMode = Schema.RequiredMode.REQUIRED, example = "11235") | |
| 47 | + @ExcelProperty("周期名称: 1:日/次;2:周/次;3:月/次;4:年/次") | |
| 48 | + private String cycleName; | |
| 49 | + | |
| 46 | 50 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 47 | 51 | @ExcelProperty("创建时间") |
| 48 | 52 | private LocalDateTime createTime; | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/PlanConstants.java
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/planrate/PlanRateDetailService.java
| ... | ... | @@ -65,6 +65,6 @@ public interface PlanRateDetailService { |
| 65 | 65 | * @param levelId 道路等级 |
| 66 | 66 | * @return 对象 |
| 67 | 67 | */ |
| 68 | - PlanRateDetailDO getPlanRateValue(String busiLine,Integer planTypeId,Integer levelId); | |
| 68 | + PlanRateDetailRespVO getPlanRateValue(String busiLine,Integer planTypeId,Integer levelId); | |
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/planrate/PlanRateDetailServiceImpl.java
| 1 | 1 | package com.zteits.urbanops.module.garden.service.planrate; |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 4 | +import com.zteits.urbanops.framework.common.biz.system.dict.dto.DictDataRespDTO; | |
| 4 | 5 | import com.zteits.urbanops.module.garden.dal.dataobject.planrate.PlanRateDO; |
| 5 | 6 | import com.zteits.urbanops.module.garden.dal.mysql.planrate.PlanRateMapper; |
| 7 | +import com.zteits.urbanops.module.system.api.dict.DictDataApi; | |
| 6 | 8 | import org.springframework.stereotype.Service; |
| 7 | 9 | import jakarta.annotation.Resource; |
| 8 | 10 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -16,7 +18,9 @@ import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 16 | 18 | import com.zteits.urbanops.module.garden.dal.mysql.planrate.PlanRateDetailMapper; |
| 17 | 19 | |
| 18 | 20 | import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 21 | +import static com.zteits.urbanops.framework.common.util.object.BeanUtils.copyProperties; | |
| 19 | 22 | import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.PLAN_RATE_NOT_EXISTS; |
| 23 | +import static com.zteits.urbanops.module.garden.enums.PlanConstants.CYCLE_ID_TYPE; | |
| 20 | 24 | |
| 21 | 25 | /** |
| 22 | 26 | * 计划频次明细 Service 实现类 |
| ... | ... | @@ -33,6 +37,9 @@ public class PlanRateDetailServiceImpl implements PlanRateDetailService { |
| 33 | 37 | @Resource |
| 34 | 38 | private PlanRateDetailMapper planRateDetailMapper; |
| 35 | 39 | |
| 40 | + @Resource | |
| 41 | + private DictDataApi dictDataApi; | |
| 42 | + | |
| 36 | 43 | @Override |
| 37 | 44 | public Long createPlanRateDetail(PlanRateDetailSaveReqVO createReqVO) { |
| 38 | 45 | // 插入 |
| ... | ... | @@ -85,14 +92,20 @@ public class PlanRateDetailServiceImpl implements PlanRateDetailService { |
| 85 | 92 | |
| 86 | 93 | |
| 87 | 94 | @Override |
| 88 | - public PlanRateDetailDO getPlanRateValue(String busiLine, Integer planTypeId, Integer levelId) { | |
| 95 | + public PlanRateDetailRespVO getPlanRateValue(String busiLine, Integer planTypeId, Integer levelId) { | |
| 89 | 96 | QueryWrapper<PlanRateDetailDO> sql = new QueryWrapper<>(); |
| 90 | 97 | sql.lambda().eq(PlanRateDetailDO::getBusiLine, busiLine).eq(PlanRateDetailDO::getPlanTypeId, planTypeId).eq(PlanRateDetailDO::getLevelId, levelId); |
| 91 | 98 | PlanRateDetailDO planRateDetailDO = planRateDetailMapper.selectOne(sql); |
| 92 | 99 | if (planRateDetailDO == null) { |
| 93 | 100 | throw exception(PLAN_RATE_NOT_EXISTS); |
| 94 | 101 | } |
| 95 | - return planRateDetailDO; | |
| 102 | + PlanRateDetailRespVO respVO = new PlanRateDetailRespVO(); | |
| 103 | + BeanUtils.copyProperties(planRateDetailDO, respVO); | |
| 104 | + DictDataRespDTO dictData = dictDataApi.getDictData(CYCLE_ID_TYPE, planRateDetailDO.getCycleId() + ""); | |
| 105 | + if (dictData != null) { | |
| 106 | + respVO.setCycleName(dictData.getLabel()); | |
| 107 | + } | |
| 108 | + return respVO; | |
| 96 | 109 | } |
| 97 | 110 | |
| 98 | 111 | } |
| 99 | 112 | \ No newline at end of file | ... | ... |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/api/dict/DictDataApiImpl.java
| ... | ... | @@ -32,4 +32,12 @@ public class DictDataApiImpl implements DictDataApi { |
| 32 | 32 | return BeanUtils.toBean(list, DictDataRespDTO.class); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | + @Override | |
| 36 | + public DictDataRespDTO getDictData(String dictType, String value) { | |
| 37 | + DictDataRespDTO dto = new DictDataRespDTO(); | |
| 38 | + DictDataDO dictData = dictDataService.getDictData(dictType, value); | |
| 39 | + BeanUtils.copyProperties(dictData, dto); | |
| 40 | + return dto; | |
| 41 | + } | |
| 42 | + | |
| 35 | 43 | } | ... | ... |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/controller/admin/permission/RoleController.java
| ... | ... | @@ -18,6 +18,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; |
| 18 | 18 | import jakarta.annotation.Resource; |
| 19 | 19 | import jakarta.servlet.http.HttpServletResponse; |
| 20 | 20 | import jakarta.validation.Valid; |
| 21 | +import jakarta.validation.constraints.NotBlank; | |
| 21 | 22 | import org.springframework.security.access.prepost.PreAuthorize; |
| 22 | 23 | import org.springframework.validation.annotation.Validated; |
| 23 | 24 | import org.springframework.web.bind.annotation.*; |
| ... | ... | @@ -80,6 +81,14 @@ public class RoleController { |
| 80 | 81 | return success(BeanUtils.toBean(role, RoleRespVO.class)); |
| 81 | 82 | } |
| 82 | 83 | |
| 84 | + @GetMapping("/get/busi-line") | |
| 85 | + @Operation(summary = "通过业务线查询角色列表") | |
| 86 | + @Parameter(name = "busi_line", description = "业务线", required = true) | |
| 87 | + @PreAuthorize("@ss.hasPermission('system:role:query')") | |
| 88 | + public CommonResult<List<RoleRespVO>> getRoleListByBusiLine(@RequestParam("busi_line") @NotBlank String busiLine) { | |
| 89 | + return success(roleService.getRoleListByBusiLine(busiLine)); | |
| 90 | + } | |
| 91 | + | |
| 83 | 92 | @GetMapping("/page") |
| 84 | 93 | @Operation(summary = "获得角色分页") |
| 85 | 94 | @PreAuthorize("@ss.hasPermission('system:role:query')") | ... | ... |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/dal/dataobject/permission/RoleDO.java
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/permission/RoleService.java
| ... | ... | @@ -2,6 +2,7 @@ package com.zteits.urbanops.module.system.service.permission; |
| 2 | 2 | |
| 3 | 3 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 4 | 4 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RolePageReqVO; |
| 5 | +import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleRespVO; | |
| 5 | 6 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleSaveReqVO; |
| 6 | 7 | import com.zteits.urbanops.module.system.dal.dataobject.permission.RoleDO; |
| 7 | 8 | import jakarta.validation.Valid; |
| ... | ... | @@ -128,4 +129,10 @@ public interface RoleService { |
| 128 | 129 | */ |
| 129 | 130 | void validateRoleList(Collection<Long> ids); |
| 130 | 131 | |
| 132 | + /** | |
| 133 | + * 通过业务线查询角色列表 | |
| 134 | + * @param busiLine 业务线 | |
| 135 | + * @return | |
| 136 | + */ | |
| 137 | + List<RoleRespVO> getRoleListByBusiLine(String busiLine); | |
| 131 | 138 | } | ... | ... |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/permission/RoleServiceImpl.java
| ... | ... | @@ -5,11 +5,13 @@ import cn.hutool.core.collection.CollectionUtil; |
| 5 | 5 | import cn.hutool.core.util.ObjUtil; |
| 6 | 6 | import cn.hutool.core.util.ObjectUtil; |
| 7 | 7 | import cn.hutool.extra.spring.SpringUtil; |
| 8 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 8 | 9 | import com.zteits.urbanops.framework.common.enums.CommonStatusEnum; |
| 9 | 10 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 10 | 11 | import com.zteits.urbanops.framework.common.util.collection.CollectionUtils; |
| 11 | 12 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 12 | 13 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RolePageReqVO; |
| 14 | +import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleRespVO; | |
| 13 | 15 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleSaveReqVO; |
| 14 | 16 | import com.zteits.urbanops.module.system.dal.dataobject.permission.RoleDO; |
| 15 | 17 | import com.zteits.urbanops.module.system.dal.mysql.permission.RoleMapper; |
| ... | ... | @@ -262,6 +264,14 @@ public class RoleServiceImpl implements RoleService { |
| 262 | 264 | }); |
| 263 | 265 | } |
| 264 | 266 | |
| 267 | + @Override | |
| 268 | + public List<RoleRespVO> getRoleListByBusiLine(String busiLine) { | |
| 269 | + QueryWrapper<RoleDO> sql = new QueryWrapper<>(); | |
| 270 | + sql.lambda().eq(RoleDO::getBusiLine, busiLine); | |
| 271 | + List<RoleDO> roleDOS = roleMapper.selectList(sql); | |
| 272 | + return BeanUtils.toBean(roleDOS, RoleRespVO.class); | |
| 273 | + } | |
| 274 | + | |
| 265 | 275 | /** |
| 266 | 276 | * 获得自身的代理对象,解决 AOP 生效问题 |
| 267 | 277 | * | ... | ... |