Commit 99a8a65898696c80921d5756f39130973df5d11e
Merge remote-tracking branch 'origin/master' into dev
Showing
31 changed files
with
1331 additions
and
1 deletions
pom.xml
| ... | ... | @@ -49,6 +49,7 @@ |
| 49 | 49 | <spring.boot.version>3.5.5</spring.boot.version> |
| 50 | 50 | <mapstruct.version>1.6.3</mapstruct.version> |
| 51 | 51 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 52 | + <maven.build.timestamp.format>yyyyMMdd-HHmm</maven.build.timestamp.format> | |
| 52 | 53 | </properties> |
| 53 | 54 | |
| 54 | 55 | <dependencyManagement> | ... | ... |
urbanops-dependencies/pom.xml
| ... | ... | @@ -76,6 +76,7 @@ |
| 76 | 76 | <jimureport.version>2.1.1</jimureport.version> |
| 77 | 77 | <jimubi.version>2.1.0</jimubi.version> |
| 78 | 78 | <weixin-java.version>4.7.7-20250808.182223</weixin-java.version> |
| 79 | + <maven.build.timestamp.format>yyyyMMdd-HHmm</maven.build.timestamp.format> | |
| 79 | 80 | </properties> |
| 80 | 81 | |
| 81 | 82 | <dependencyManagement> | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialname/MaterialNameController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialname; | |
| 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.materialname.vo.*; | |
| 29 | +import com.zteits.urbanops.module.garden.dal.dataobject.materialname.MaterialNameDO; | |
| 30 | +import com.zteits.urbanops.module.garden.service.materialname.MaterialNameService; | |
| 31 | + | |
| 32 | +@Tag(name = "管理后台 - 物料名称") | |
| 33 | +@RestController | |
| 34 | +@RequestMapping("/garden/material-name") | |
| 35 | +@Validated | |
| 36 | +public class MaterialNameController { | |
| 37 | + | |
| 38 | + @Resource | |
| 39 | + private MaterialNameService materialNameService; | |
| 40 | + | |
| 41 | + @PostMapping("/create") | |
| 42 | + @Operation(summary = "创建物料名称") | |
| 43 | + @PreAuthorize("@ss.hasPermission('garden:material-name:create')") | |
| 44 | + public CommonResult<Long> createMaterialName(@Valid @RequestBody MaterialNameSaveReqVO createReqVO) { | |
| 45 | + return success(materialNameService.createMaterialName(createReqVO)); | |
| 46 | + } | |
| 47 | + | |
| 48 | + @PutMapping("/update") | |
| 49 | + @Operation(summary = "更新物料名称") | |
| 50 | + @PreAuthorize("@ss.hasPermission('garden:material-name:update')") | |
| 51 | + public CommonResult<Boolean> updateMaterialName(@Valid @RequestBody MaterialNameSaveReqVO updateReqVO) { | |
| 52 | + materialNameService.updateMaterialName(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:material-name:delete')") | |
| 60 | + public CommonResult<Boolean> deleteMaterialName(@RequestParam("id") Long id) { | |
| 61 | + materialNameService.deleteMaterialName(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:material-name:delete')") | |
| 69 | + public CommonResult<Boolean> deleteMaterialNameList(@RequestParam("ids") List<Long> ids) { | |
| 70 | + materialNameService.deleteMaterialNameListByIds(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:material-name:query')") | |
| 78 | + public CommonResult<MaterialNameRespVO> getMaterialName(@RequestParam("id") Long id) { | |
| 79 | + MaterialNameDO materialName = materialNameService.getMaterialName(id); | |
| 80 | + return success(BeanUtils.toBean(materialName, MaterialNameRespVO.class)); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @GetMapping("/page") | |
| 84 | + @Operation(summary = "获得物料名称分页") | |
| 85 | + @PreAuthorize("@ss.hasPermission('garden:material-name:query')") | |
| 86 | + public CommonResult<PageResult<MaterialNameRespVO>> getMaterialNamePage(@Valid MaterialNamePageReqVO pageReqVO) { | |
| 87 | + PageResult<MaterialNameDO> pageResult = materialNameService.getMaterialNamePage(pageReqVO); | |
| 88 | + return success(BeanUtils.toBean(pageResult, MaterialNameRespVO.class)); | |
| 89 | + } | |
| 90 | + | |
| 91 | + @GetMapping("/export-excel") | |
| 92 | + @Operation(summary = "导出物料名称 Excel") | |
| 93 | + @PreAuthorize("@ss.hasPermission('garden:material-name:export')") | |
| 94 | + @ApiAccessLog(operateType = EXPORT) | |
| 95 | + public void exportMaterialNameExcel(@Valid MaterialNamePageReqVO pageReqVO, | |
| 96 | + HttpServletResponse response) throws IOException { | |
| 97 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 98 | + List<MaterialNameDO> list = materialNameService.getMaterialNamePage(pageReqVO).getList(); | |
| 99 | + // 导出 Excel | |
| 100 | + ExcelUtils.write(response, "物料名称.xls", "数据", MaterialNameRespVO.class, | |
| 101 | + BeanUtils.toBean(list, MaterialNameRespVO.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/materialname/vo/MaterialNamePageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialname.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 MaterialNamePageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @Schema(description = "物料名称ID", example = "14631") | |
| 17 | + private Long materialId; | |
| 18 | + | |
| 19 | + @Schema(description = "物料名称", example = "张三") | |
| 20 | + private String materialName; | |
| 21 | + | |
| 22 | + @Schema(description = "备注", example = "你猜") | |
| 23 | + private String remark; | |
| 24 | + | |
| 25 | + @Schema(description = "创建时间") | |
| 26 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 27 | + private LocalDateTime[] createTime; | |
| 28 | + | |
| 29 | + @Schema(description = "部门ID", example = "23084") | |
| 30 | + private Long deptId; | |
| 31 | + | |
| 32 | +} | |
| 0 | 33 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialname/vo/MaterialNameRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialname.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 MaterialNameRespVO { | |
| 14 | + | |
| 15 | + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32592") | |
| 16 | + @ExcelProperty("自增主键") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "物料名称ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14631") | |
| 20 | + @ExcelProperty("物料名称ID") | |
| 21 | + private Long materialId; | |
| 22 | + | |
| 23 | + @Schema(description = "物料名称", example = "张三") | |
| 24 | + @ExcelProperty("物料名称") | |
| 25 | + private String materialName; | |
| 26 | + | |
| 27 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") | |
| 28 | + @ExcelProperty("备注") | |
| 29 | + private String remark; | |
| 30 | + | |
| 31 | + @Schema(description = "创建时间") | |
| 32 | + @ExcelProperty("创建时间") | |
| 33 | + private LocalDateTime createTime; | |
| 34 | + | |
| 35 | + @Schema(description = "部门ID", example = "23084") | |
| 36 | + @ExcelProperty("部门ID") | |
| 37 | + private Long deptId; | |
| 38 | + | |
| 39 | +} | |
| 0 | 40 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialname/vo/MaterialNameSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialname.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 MaterialNameSaveReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32592") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + @Schema(description = "物料名称ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "14631") | |
| 16 | + @NotNull(message = "物料名称ID不能为空") | |
| 17 | + private Long materialId; | |
| 18 | + | |
| 19 | + @Schema(description = "物料名称", example = "张三") | |
| 20 | + private String materialName; | |
| 21 | + | |
| 22 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") | |
| 23 | + @NotEmpty(message = "备注不能为空") | |
| 24 | + private String remark; | |
| 25 | + | |
| 26 | + @Schema(description = "部门ID", example = "23084") | |
| 27 | + private Long deptId; | |
| 28 | + | |
| 29 | +} | |
| 0 | 30 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialspecification/MaterialSpecificationController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialspecification; | |
| 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.materialspecification.vo.*; | |
| 29 | +import com.zteits.urbanops.module.garden.dal.dataobject.materialspecification.MaterialSpecificationDO; | |
| 30 | +import com.zteits.urbanops.module.garden.service.materialspecification.MaterialSpecificationService; | |
| 31 | + | |
| 32 | +@Tag(name = "管理后台 - 物料规格") | |
| 33 | +@RestController | |
| 34 | +@RequestMapping("/garden/material-specification") | |
| 35 | +@Validated | |
| 36 | +public class MaterialSpecificationController { | |
| 37 | + | |
| 38 | + @Resource | |
| 39 | + private MaterialSpecificationService materialSpecificationService; | |
| 40 | + | |
| 41 | + @PostMapping("/create") | |
| 42 | + @Operation(summary = "创建物料规格") | |
| 43 | + @PreAuthorize("@ss.hasPermission('garden:material-specification:create')") | |
| 44 | + public CommonResult<Long> createMaterialSpecification(@Valid @RequestBody MaterialSpecificationSaveReqVO createReqVO) { | |
| 45 | + return success(materialSpecificationService.createMaterialSpecification(createReqVO)); | |
| 46 | + } | |
| 47 | + | |
| 48 | + @PutMapping("/update") | |
| 49 | + @Operation(summary = "更新物料规格") | |
| 50 | + @PreAuthorize("@ss.hasPermission('garden:material-specification:update')") | |
| 51 | + public CommonResult<Boolean> updateMaterialSpecification(@Valid @RequestBody MaterialSpecificationSaveReqVO updateReqVO) { | |
| 52 | + materialSpecificationService.updateMaterialSpecification(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:material-specification:delete')") | |
| 60 | + public CommonResult<Boolean> deleteMaterialSpecification(@RequestParam("id") Long id) { | |
| 61 | + materialSpecificationService.deleteMaterialSpecification(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:material-specification:delete')") | |
| 69 | + public CommonResult<Boolean> deleteMaterialSpecificationList(@RequestParam("ids") List<Long> ids) { | |
| 70 | + materialSpecificationService.deleteMaterialSpecificationListByIds(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:material-specification:query')") | |
| 78 | + public CommonResult<MaterialSpecificationRespVO> getMaterialSpecification(@RequestParam("id") Long id) { | |
| 79 | + MaterialSpecificationDO materialSpecification = materialSpecificationService.getMaterialSpecification(id); | |
| 80 | + return success(BeanUtils.toBean(materialSpecification, MaterialSpecificationRespVO.class)); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @GetMapping("/page") | |
| 84 | + @Operation(summary = "获得物料规格分页") | |
| 85 | + @PreAuthorize("@ss.hasPermission('garden:material-specification:query')") | |
| 86 | + public CommonResult<PageResult<MaterialSpecificationRespVO>> getMaterialSpecificationPage(@Valid MaterialSpecificationPageReqVO pageReqVO) { | |
| 87 | + PageResult<MaterialSpecificationDO> pageResult = materialSpecificationService.getMaterialSpecificationPage(pageReqVO); | |
| 88 | + return success(BeanUtils.toBean(pageResult, MaterialSpecificationRespVO.class)); | |
| 89 | + } | |
| 90 | + | |
| 91 | + @GetMapping("/export-excel") | |
| 92 | + @Operation(summary = "导出物料规格 Excel") | |
| 93 | + @PreAuthorize("@ss.hasPermission('garden:material-specification:export')") | |
| 94 | + @ApiAccessLog(operateType = EXPORT) | |
| 95 | + public void exportMaterialSpecificationExcel(@Valid MaterialSpecificationPageReqVO pageReqVO, | |
| 96 | + HttpServletResponse response) throws IOException { | |
| 97 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 98 | + List<MaterialSpecificationDO> list = materialSpecificationService.getMaterialSpecificationPage(pageReqVO).getList(); | |
| 99 | + // 导出 Excel | |
| 100 | + ExcelUtils.write(response, "物料规格.xls", "数据", MaterialSpecificationRespVO.class, | |
| 101 | + BeanUtils.toBean(list, MaterialSpecificationRespVO.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/materialspecification/vo/MaterialSpecificationPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialspecification.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 MaterialSpecificationPageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @Schema(description = "规格编码") | |
| 17 | + private String specCode; | |
| 18 | + | |
| 19 | + @Schema(description = "规格名称") | |
| 20 | + private String specifications; | |
| 21 | + | |
| 22 | + @Schema(description = "备注", example = "你猜") | |
| 23 | + private String remark; | |
| 24 | + | |
| 25 | + @Schema(description = "创建时间") | |
| 26 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 27 | + private LocalDateTime[] createTime; | |
| 28 | + | |
| 29 | + @Schema(description = "部门ID", example = "18158") | |
| 30 | + private Long deptId; | |
| 31 | + | |
| 32 | +} | |
| 0 | 33 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialspecification/vo/MaterialSpecificationRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialspecification.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 MaterialSpecificationRespVO { | |
| 14 | + | |
| 15 | + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "15081") | |
| 16 | + @ExcelProperty("自增主键") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "规格编码") | |
| 20 | + @ExcelProperty("规格编码") | |
| 21 | + private String specCode; | |
| 22 | + | |
| 23 | + @Schema(description = "规格名称", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 24 | + @ExcelProperty("规格名称") | |
| 25 | + private String specifications; | |
| 26 | + | |
| 27 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") | |
| 28 | + @ExcelProperty("备注") | |
| 29 | + private String remark; | |
| 30 | + | |
| 31 | + @Schema(description = "创建时间") | |
| 32 | + @ExcelProperty("创建时间") | |
| 33 | + private LocalDateTime createTime; | |
| 34 | + | |
| 35 | + @Schema(description = "部门ID", example = "18158") | |
| 36 | + @ExcelProperty("部门ID") | |
| 37 | + private Long deptId; | |
| 38 | + | |
| 39 | +} | |
| 0 | 40 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialspecification/vo/MaterialSpecificationSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialspecification.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 MaterialSpecificationSaveReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "15081") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + @Schema(description = "规格编码") | |
| 16 | + private String specCode; | |
| 17 | + | |
| 18 | + @Schema(description = "规格名称", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 19 | + @NotEmpty(message = "规格名称不能为空") | |
| 20 | + private String specifications; | |
| 21 | + | |
| 22 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") | |
| 23 | + @NotEmpty(message = "备注不能为空") | |
| 24 | + private String remark; | |
| 25 | + | |
| 26 | + @Schema(description = "部门ID", example = "18158") | |
| 27 | + private Long deptId; | |
| 28 | + | |
| 29 | +} | |
| 0 | 30 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialunit/MaterialUnitController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialunit; | |
| 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.materialunit.vo.*; | |
| 29 | +import com.zteits.urbanops.module.garden.dal.dataobject.materialunit.MaterialUnitDO; | |
| 30 | +import com.zteits.urbanops.module.garden.service.materialunit.MaterialUnitService; | |
| 31 | + | |
| 32 | +@Tag(name = "管理后台 - 物料单位") | |
| 33 | +@RestController | |
| 34 | +@RequestMapping("/garden/material-unit") | |
| 35 | +@Validated | |
| 36 | +public class MaterialUnitController { | |
| 37 | + | |
| 38 | + @Resource | |
| 39 | + private MaterialUnitService materialUnitService; | |
| 40 | + | |
| 41 | + @PostMapping("/create") | |
| 42 | + @Operation(summary = "创建物料单位") | |
| 43 | + @PreAuthorize("@ss.hasPermission('garden:material-unit:create')") | |
| 44 | + public CommonResult<Long> createMaterialUnit(@Valid @RequestBody MaterialUnitSaveReqVO createReqVO) { | |
| 45 | + return success(materialUnitService.createMaterialUnit(createReqVO)); | |
| 46 | + } | |
| 47 | + | |
| 48 | + @PutMapping("/update") | |
| 49 | + @Operation(summary = "更新物料单位") | |
| 50 | + @PreAuthorize("@ss.hasPermission('garden:material-unit:update')") | |
| 51 | + public CommonResult<Boolean> updateMaterialUnit(@Valid @RequestBody MaterialUnitSaveReqVO updateReqVO) { | |
| 52 | + materialUnitService.updateMaterialUnit(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:material-unit:delete')") | |
| 60 | + public CommonResult<Boolean> deleteMaterialUnit(@RequestParam("id") Long id) { | |
| 61 | + materialUnitService.deleteMaterialUnit(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:material-unit:delete')") | |
| 69 | + public CommonResult<Boolean> deleteMaterialUnitList(@RequestParam("ids") List<Long> ids) { | |
| 70 | + materialUnitService.deleteMaterialUnitListByIds(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:material-unit:query')") | |
| 78 | + public CommonResult<MaterialUnitRespVO> getMaterialUnit(@RequestParam("id") Long id) { | |
| 79 | + MaterialUnitDO materialUnit = materialUnitService.getMaterialUnit(id); | |
| 80 | + return success(BeanUtils.toBean(materialUnit, MaterialUnitRespVO.class)); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @GetMapping("/page") | |
| 84 | + @Operation(summary = "获得物料单位分页") | |
| 85 | + @PreAuthorize("@ss.hasPermission('garden:material-unit:query')") | |
| 86 | + public CommonResult<PageResult<MaterialUnitRespVO>> getMaterialUnitPage(@Valid MaterialUnitPageReqVO pageReqVO) { | |
| 87 | + PageResult<MaterialUnitDO> pageResult = materialUnitService.getMaterialUnitPage(pageReqVO); | |
| 88 | + return success(BeanUtils.toBean(pageResult, MaterialUnitRespVO.class)); | |
| 89 | + } | |
| 90 | + | |
| 91 | + @GetMapping("/export-excel") | |
| 92 | + @Operation(summary = "导出物料单位 Excel") | |
| 93 | + @PreAuthorize("@ss.hasPermission('garden:material-unit:export')") | |
| 94 | + @ApiAccessLog(operateType = EXPORT) | |
| 95 | + public void exportMaterialUnitExcel(@Valid MaterialUnitPageReqVO pageReqVO, | |
| 96 | + HttpServletResponse response) throws IOException { | |
| 97 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 98 | + List<MaterialUnitDO> list = materialUnitService.getMaterialUnitPage(pageReqVO).getList(); | |
| 99 | + // 导出 Excel | |
| 100 | + ExcelUtils.write(response, "物料单位.xls", "数据", MaterialUnitRespVO.class, | |
| 101 | + BeanUtils.toBean(list, MaterialUnitRespVO.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/materialunit/vo/MaterialUnitPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialunit.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 MaterialUnitPageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @Schema(description = "单位ID", example = "22342") | |
| 17 | + private Long unitId; | |
| 18 | + | |
| 19 | + @Schema(description = "单位名称", example = "张三") | |
| 20 | + private String unitName; | |
| 21 | + | |
| 22 | + @Schema(description = "备注", example = "你说的对") | |
| 23 | + private String remark; | |
| 24 | + | |
| 25 | + @Schema(description = "创建时间") | |
| 26 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 27 | + private LocalDateTime[] createTime; | |
| 28 | + | |
| 29 | + @Schema(description = "部门ID", example = "8809") | |
| 30 | + private Long deptId; | |
| 31 | + | |
| 32 | +} | |
| 0 | 33 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialunit/vo/MaterialUnitRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialunit.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 MaterialUnitRespVO { | |
| 14 | + | |
| 15 | + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "8413") | |
| 16 | + @ExcelProperty("自增主键") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "单位ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22342") | |
| 20 | + @ExcelProperty("单位ID") | |
| 21 | + private Long unitId; | |
| 22 | + | |
| 23 | + @Schema(description = "单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | |
| 24 | + @ExcelProperty("单位名称") | |
| 25 | + private String unitName; | |
| 26 | + | |
| 27 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") | |
| 28 | + @ExcelProperty("备注") | |
| 29 | + private String remark; | |
| 30 | + | |
| 31 | + @Schema(description = "创建时间") | |
| 32 | + @ExcelProperty("创建时间") | |
| 33 | + private LocalDateTime createTime; | |
| 34 | + | |
| 35 | + @Schema(description = "部门ID", example = "8809") | |
| 36 | + @ExcelProperty("部门ID") | |
| 37 | + private Long deptId; | |
| 38 | + | |
| 39 | +} | |
| 0 | 40 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialunit/vo/MaterialUnitSaveReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.admin.materialunit.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 MaterialUnitSaveReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "8413") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + @Schema(description = "单位ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22342") | |
| 16 | + @NotNull(message = "单位ID不能为空") | |
| 17 | + private Long unitId; | |
| 18 | + | |
| 19 | + @Schema(description = "单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | |
| 20 | + @NotEmpty(message = "单位名称不能为空") | |
| 21 | + private String unitName; | |
| 22 | + | |
| 23 | + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") | |
| 24 | + @NotEmpty(message = "备注不能为空") | |
| 25 | + private String remark; | |
| 26 | + | |
| 27 | + @Schema(description = "部门ID", example = "8809") | |
| 28 | + private Long deptId; | |
| 29 | + | |
| 30 | +} | |
| 0 | 31 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/materialname/MaterialNameDO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.dataobject.materialname; | |
| 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_material_name") | |
| 16 | +@KeySequence("garden_material_name_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 MaterialNameDO extends BaseDO { | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 自增主键 | |
| 27 | + */ | |
| 28 | + @TableId | |
| 29 | + private Long id; | |
| 30 | + /** | |
| 31 | + * 物料名称ID | |
| 32 | + */ | |
| 33 | + private Long materialId; | |
| 34 | + /** | |
| 35 | + * 物料名称 | |
| 36 | + */ | |
| 37 | + private String materialName; | |
| 38 | + /** | |
| 39 | + * 备注 | |
| 40 | + */ | |
| 41 | + private String remark; | |
| 42 | + /** | |
| 43 | + * 部门ID | |
| 44 | + */ | |
| 45 | + private Long deptId; | |
| 46 | + | |
| 47 | + | |
| 48 | +} | |
| 0 | 49 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/materialspecification/MaterialSpecificationDO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.dataobject.materialspecification; | |
| 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_material_specification") | |
| 16 | +@KeySequence("garden_material_specification_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 MaterialSpecificationDO extends BaseDO { | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 自增主键 | |
| 27 | + */ | |
| 28 | + @TableId | |
| 29 | + private Long id; | |
| 30 | + /** | |
| 31 | + * 规格编码 | |
| 32 | + */ | |
| 33 | + private String specCode; | |
| 34 | + /** | |
| 35 | + * 规格名称 | |
| 36 | + */ | |
| 37 | + private String specifications; | |
| 38 | + /** | |
| 39 | + * 备注 | |
| 40 | + */ | |
| 41 | + private String remark; | |
| 42 | + /** | |
| 43 | + * 部门ID | |
| 44 | + */ | |
| 45 | + private Long deptId; | |
| 46 | + | |
| 47 | + | |
| 48 | +} | |
| 0 | 49 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/dataobject/materialunit/MaterialUnitDO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.dataobject.materialunit; | |
| 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_material_unit") | |
| 16 | +@KeySequence("garden_material_unit_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 MaterialUnitDO extends BaseDO { | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 自增主键 | |
| 27 | + */ | |
| 28 | + @TableId | |
| 29 | + private Long id; | |
| 30 | + /** | |
| 31 | + * 单位ID | |
| 32 | + */ | |
| 33 | + private Long unitId; | |
| 34 | + /** | |
| 35 | + * 单位名称 | |
| 36 | + */ | |
| 37 | + private String unitName; | |
| 38 | + /** | |
| 39 | + * 备注 | |
| 40 | + */ | |
| 41 | + private String remark; | |
| 42 | + /** | |
| 43 | + * 部门ID | |
| 44 | + */ | |
| 45 | + private Long deptId; | |
| 46 | + | |
| 47 | + | |
| 48 | +} | |
| 0 | 49 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/materialname/MaterialNameMapper.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.mysql.materialname; | |
| 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.materialname.MaterialNameDO; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | +import com.zteits.urbanops.module.garden.controller.admin.materialname.vo.*; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 物料名称 Mapper | |
| 14 | + * | |
| 15 | + * @author 超级管理员 | |
| 16 | + */ | |
| 17 | +@Mapper | |
| 18 | +public interface MaterialNameMapper extends BaseMapperX<MaterialNameDO> { | |
| 19 | + | |
| 20 | + default PageResult<MaterialNameDO> selectPage(MaterialNamePageReqVO reqVO) { | |
| 21 | + return selectPage(reqVO, new LambdaQueryWrapperX<MaterialNameDO>() | |
| 22 | + .eqIfPresent(MaterialNameDO::getMaterialId, reqVO.getMaterialId()) | |
| 23 | + .likeIfPresent(MaterialNameDO::getMaterialName, reqVO.getMaterialName()) | |
| 24 | + .eqIfPresent(MaterialNameDO::getRemark, reqVO.getRemark()) | |
| 25 | + .betweenIfPresent(MaterialNameDO::getCreateTime, reqVO.getCreateTime()) | |
| 26 | + .eqIfPresent(MaterialNameDO::getDeptId, reqVO.getDeptId()) | |
| 27 | + .orderByDesc(MaterialNameDO::getId)); | |
| 28 | + } | |
| 29 | + | |
| 30 | +} | |
| 0 | 31 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/materialspecification/MaterialSpecificationMapper.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.mysql.materialspecification; | |
| 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.materialspecification.MaterialSpecificationDO; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | +import com.zteits.urbanops.module.garden.controller.admin.materialspecification.vo.*; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 物料规格 Mapper | |
| 14 | + * | |
| 15 | + * @author 超级管理员 | |
| 16 | + */ | |
| 17 | +@Mapper | |
| 18 | +public interface MaterialSpecificationMapper extends BaseMapperX<MaterialSpecificationDO> { | |
| 19 | + | |
| 20 | + default PageResult<MaterialSpecificationDO> selectPage(MaterialSpecificationPageReqVO reqVO) { | |
| 21 | + return selectPage(reqVO, new LambdaQueryWrapperX<MaterialSpecificationDO>() | |
| 22 | + .eqIfPresent(MaterialSpecificationDO::getSpecCode, reqVO.getSpecCode()) | |
| 23 | + .eqIfPresent(MaterialSpecificationDO::getSpecifications, reqVO.getSpecifications()) | |
| 24 | + .eqIfPresent(MaterialSpecificationDO::getRemark, reqVO.getRemark()) | |
| 25 | + .betweenIfPresent(MaterialSpecificationDO::getCreateTime, reqVO.getCreateTime()) | |
| 26 | + .eqIfPresent(MaterialSpecificationDO::getDeptId, reqVO.getDeptId()) | |
| 27 | + .orderByDesc(MaterialSpecificationDO::getId)); | |
| 28 | + } | |
| 29 | + | |
| 30 | +} | |
| 0 | 31 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/materialunit/MaterialUnitMapper.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.dal.mysql.materialunit; | |
| 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.materialunit.MaterialUnitDO; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | +import com.zteits.urbanops.module.garden.controller.admin.materialunit.vo.*; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 物料单位 Mapper | |
| 14 | + * | |
| 15 | + * @author 超级管理员 | |
| 16 | + */ | |
| 17 | +@Mapper | |
| 18 | +public interface MaterialUnitMapper extends BaseMapperX<MaterialUnitDO> { | |
| 19 | + | |
| 20 | + default PageResult<MaterialUnitDO> selectPage(MaterialUnitPageReqVO reqVO) { | |
| 21 | + return selectPage(reqVO, new LambdaQueryWrapperX<MaterialUnitDO>() | |
| 22 | + .eqIfPresent(MaterialUnitDO::getUnitId, reqVO.getUnitId()) | |
| 23 | + .likeIfPresent(MaterialUnitDO::getUnitName, reqVO.getUnitName()) | |
| 24 | + .eqIfPresent(MaterialUnitDO::getRemark, reqVO.getRemark()) | |
| 25 | + .betweenIfPresent(MaterialUnitDO::getCreateTime, reqVO.getCreateTime()) | |
| 26 | + .eqIfPresent(MaterialUnitDO::getDeptId, reqVO.getDeptId()) | |
| 27 | + .orderByDesc(MaterialUnitDO::getId)); | |
| 28 | + } | |
| 29 | + | |
| 30 | +} | |
| 0 | 31 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/ErrorCodeConstants.java
| ... | ... | @@ -114,6 +114,10 @@ public interface ErrorCodeConstants { |
| 114 | 114 | |
| 115 | 115 | ErrorCode MATERIAL_INVENTORY_OUT_NOT_EXISTS = new ErrorCode(1-100-004-005, "物料出库不存在"); |
| 116 | 116 | ErrorCode MATERIAL_INVENTORY_NOT_EXISTS = new ErrorCode(1-100-004-006, "物料库存不存在"); |
| 117 | + ErrorCode MATERIAL_NAME_NOT_EXISTS = new ErrorCode(1-100-004-007, "物料名称不存在"); | |
| 118 | + | |
| 119 | + ErrorCode MATERIAL_SPECIFICATION_NOT_EXISTS = new ErrorCode(1-100-004-010, "物料规格不存在"); | |
| 120 | + ErrorCode MATERIAL_UNIT_NOT_EXISTS = new ErrorCode(1-100-004-011, "物料单位不存在"); | |
| 117 | 121 | |
| 118 | 122 | ErrorCode OLDTREES_NOT_EXISTS = new ErrorCode(1-100-005-001, "古树名木不存在"); |
| 119 | 123 | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialname/MaterialNameService.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.materialname; | |
| 2 | + | |
| 3 | +import java.util.*; | |
| 4 | +import jakarta.validation.*; | |
| 5 | +import com.zteits.urbanops.module.garden.controller.admin.materialname.vo.*; | |
| 6 | +import com.zteits.urbanops.module.garden.dal.dataobject.materialname.MaterialNameDO; | |
| 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 MaterialNameService { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 创建物料名称 | |
| 19 | + * | |
| 20 | + * @param createReqVO 创建信息 | |
| 21 | + * @return 编号 | |
| 22 | + */ | |
| 23 | + Long createMaterialName(@Valid MaterialNameSaveReqVO createReqVO); | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 更新物料名称 | |
| 27 | + * | |
| 28 | + * @param updateReqVO 更新信息 | |
| 29 | + */ | |
| 30 | + void updateMaterialName(@Valid MaterialNameSaveReqVO updateReqVO); | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 删除物料名称 | |
| 34 | + * | |
| 35 | + * @param id 编号 | |
| 36 | + */ | |
| 37 | + void deleteMaterialName(Long id); | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 批量删除物料名称 | |
| 41 | + * | |
| 42 | + * @param ids 编号 | |
| 43 | + */ | |
| 44 | + void deleteMaterialNameListByIds(List<Long> ids); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 获得物料名称 | |
| 48 | + * | |
| 49 | + * @param id 编号 | |
| 50 | + * @return 物料名称 | |
| 51 | + */ | |
| 52 | + MaterialNameDO getMaterialName(Long id); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 获得物料名称分页 | |
| 56 | + * | |
| 57 | + * @param pageReqVO 分页查询 | |
| 58 | + * @return 物料名称分页 | |
| 59 | + */ | |
| 60 | + PageResult<MaterialNameDO> getMaterialNamePage(MaterialNamePageReqVO pageReqVO); | |
| 61 | + | |
| 62 | +} | |
| 0 | 63 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialname/MaterialNameServiceImpl.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.materialname; | |
| 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.materialname.vo.*; | |
| 11 | +import com.zteits.urbanops.module.garden.dal.dataobject.materialname.MaterialNameDO; | |
| 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.materialname.MaterialNameMapper; | |
| 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 MaterialNameServiceImpl implements MaterialNameService { | |
| 31 | + | |
| 32 | + @Resource | |
| 33 | + private MaterialNameMapper materialNameMapper; | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public Long createMaterialName(MaterialNameSaveReqVO createReqVO) { | |
| 37 | + // 插入 | |
| 38 | + MaterialNameDO materialName = BeanUtils.toBean(createReqVO, MaterialNameDO.class); | |
| 39 | + materialNameMapper.insert(materialName); | |
| 40 | + | |
| 41 | + // 返回 | |
| 42 | + return materialName.getId(); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public void updateMaterialName(MaterialNameSaveReqVO updateReqVO) { | |
| 47 | + // 校验存在 | |
| 48 | + validateMaterialNameExists(updateReqVO.getId()); | |
| 49 | + // 更新 | |
| 50 | + MaterialNameDO updateObj = BeanUtils.toBean(updateReqVO, MaterialNameDO.class); | |
| 51 | + materialNameMapper.updateById(updateObj); | |
| 52 | + } | |
| 53 | + | |
| 54 | + @Override | |
| 55 | + public void deleteMaterialName(Long id) { | |
| 56 | + // 校验存在 | |
| 57 | + validateMaterialNameExists(id); | |
| 58 | + // 删除 | |
| 59 | + materialNameMapper.deleteById(id); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @Override | |
| 63 | + public void deleteMaterialNameListByIds(List<Long> ids) { | |
| 64 | + // 删除 | |
| 65 | + materialNameMapper.deleteByIds(ids); | |
| 66 | + } | |
| 67 | + | |
| 68 | + | |
| 69 | + private void validateMaterialNameExists(Long id) { | |
| 70 | + if (materialNameMapper.selectById(id) == null) { | |
| 71 | + throw exception(MATERIAL_NAME_NOT_EXISTS); | |
| 72 | + } | |
| 73 | + } | |
| 74 | + | |
| 75 | + @Override | |
| 76 | + public MaterialNameDO getMaterialName(Long id) { | |
| 77 | + return materialNameMapper.selectById(id); | |
| 78 | + } | |
| 79 | + | |
| 80 | + @Override | |
| 81 | + public PageResult<MaterialNameDO> getMaterialNamePage(MaterialNamePageReqVO pageReqVO) { | |
| 82 | + return materialNameMapper.selectPage(pageReqVO); | |
| 83 | + } | |
| 84 | + | |
| 85 | +} | |
| 0 | 86 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialspecification/MaterialSpecificationService.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.materialspecification; | |
| 2 | + | |
| 3 | +import java.util.*; | |
| 4 | +import jakarta.validation.*; | |
| 5 | +import com.zteits.urbanops.module.garden.controller.admin.materialspecification.vo.*; | |
| 6 | +import com.zteits.urbanops.module.garden.dal.dataobject.materialspecification.MaterialSpecificationDO; | |
| 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 MaterialSpecificationService { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 创建物料规格 | |
| 19 | + * | |
| 20 | + * @param createReqVO 创建信息 | |
| 21 | + * @return 编号 | |
| 22 | + */ | |
| 23 | + Long createMaterialSpecification(@Valid MaterialSpecificationSaveReqVO createReqVO); | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 更新物料规格 | |
| 27 | + * | |
| 28 | + * @param updateReqVO 更新信息 | |
| 29 | + */ | |
| 30 | + void updateMaterialSpecification(@Valid MaterialSpecificationSaveReqVO updateReqVO); | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 删除物料规格 | |
| 34 | + * | |
| 35 | + * @param id 编号 | |
| 36 | + */ | |
| 37 | + void deleteMaterialSpecification(Long id); | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 批量删除物料规格 | |
| 41 | + * | |
| 42 | + * @param ids 编号 | |
| 43 | + */ | |
| 44 | + void deleteMaterialSpecificationListByIds(List<Long> ids); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 获得物料规格 | |
| 48 | + * | |
| 49 | + * @param id 编号 | |
| 50 | + * @return 物料规格 | |
| 51 | + */ | |
| 52 | + MaterialSpecificationDO getMaterialSpecification(Long id); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 获得物料规格分页 | |
| 56 | + * | |
| 57 | + * @param pageReqVO 分页查询 | |
| 58 | + * @return 物料规格分页 | |
| 59 | + */ | |
| 60 | + PageResult<MaterialSpecificationDO> getMaterialSpecificationPage(MaterialSpecificationPageReqVO pageReqVO); | |
| 61 | + | |
| 62 | +} | |
| 0 | 63 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialspecification/MaterialSpecificationServiceImpl.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.materialspecification; | |
| 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.materialspecification.vo.*; | |
| 11 | +import com.zteits.urbanops.module.garden.dal.dataobject.materialspecification.MaterialSpecificationDO; | |
| 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.materialspecification.MaterialSpecificationMapper; | |
| 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 MaterialSpecificationServiceImpl implements MaterialSpecificationService { | |
| 31 | + | |
| 32 | + @Resource | |
| 33 | + private MaterialSpecificationMapper materialSpecificationMapper; | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public Long createMaterialSpecification(MaterialSpecificationSaveReqVO createReqVO) { | |
| 37 | + // 插入 | |
| 38 | + MaterialSpecificationDO materialSpecification = BeanUtils.toBean(createReqVO, MaterialSpecificationDO.class); | |
| 39 | + materialSpecificationMapper.insert(materialSpecification); | |
| 40 | + | |
| 41 | + // 返回 | |
| 42 | + return materialSpecification.getId(); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public void updateMaterialSpecification(MaterialSpecificationSaveReqVO updateReqVO) { | |
| 47 | + // 校验存在 | |
| 48 | + validateMaterialSpecificationExists(updateReqVO.getId()); | |
| 49 | + // 更新 | |
| 50 | + MaterialSpecificationDO updateObj = BeanUtils.toBean(updateReqVO, MaterialSpecificationDO.class); | |
| 51 | + materialSpecificationMapper.updateById(updateObj); | |
| 52 | + } | |
| 53 | + | |
| 54 | + @Override | |
| 55 | + public void deleteMaterialSpecification(Long id) { | |
| 56 | + // 校验存在 | |
| 57 | + validateMaterialSpecificationExists(id); | |
| 58 | + // 删除 | |
| 59 | + materialSpecificationMapper.deleteById(id); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @Override | |
| 63 | + public void deleteMaterialSpecificationListByIds(List<Long> ids) { | |
| 64 | + // 删除 | |
| 65 | + materialSpecificationMapper.deleteByIds(ids); | |
| 66 | + } | |
| 67 | + | |
| 68 | + | |
| 69 | + private void validateMaterialSpecificationExists(Long id) { | |
| 70 | + if (materialSpecificationMapper.selectById(id) == null) { | |
| 71 | + throw exception(MATERIAL_SPECIFICATION_NOT_EXISTS); | |
| 72 | + } | |
| 73 | + } | |
| 74 | + | |
| 75 | + @Override | |
| 76 | + public MaterialSpecificationDO getMaterialSpecification(Long id) { | |
| 77 | + return materialSpecificationMapper.selectById(id); | |
| 78 | + } | |
| 79 | + | |
| 80 | + @Override | |
| 81 | + public PageResult<MaterialSpecificationDO> getMaterialSpecificationPage(MaterialSpecificationPageReqVO pageReqVO) { | |
| 82 | + return materialSpecificationMapper.selectPage(pageReqVO); | |
| 83 | + } | |
| 84 | + | |
| 85 | +} | |
| 0 | 86 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialunit/MaterialUnitService.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.materialunit; | |
| 2 | + | |
| 3 | +import java.util.*; | |
| 4 | +import jakarta.validation.*; | |
| 5 | +import com.zteits.urbanops.module.garden.controller.admin.materialunit.vo.*; | |
| 6 | +import com.zteits.urbanops.module.garden.dal.dataobject.materialunit.MaterialUnitDO; | |
| 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 MaterialUnitService { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 创建物料单位 | |
| 19 | + * | |
| 20 | + * @param createReqVO 创建信息 | |
| 21 | + * @return 编号 | |
| 22 | + */ | |
| 23 | + Long createMaterialUnit(@Valid MaterialUnitSaveReqVO createReqVO); | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 更新物料单位 | |
| 27 | + * | |
| 28 | + * @param updateReqVO 更新信息 | |
| 29 | + */ | |
| 30 | + void updateMaterialUnit(@Valid MaterialUnitSaveReqVO updateReqVO); | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 删除物料单位 | |
| 34 | + * | |
| 35 | + * @param id 编号 | |
| 36 | + */ | |
| 37 | + void deleteMaterialUnit(Long id); | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 批量删除物料单位 | |
| 41 | + * | |
| 42 | + * @param ids 编号 | |
| 43 | + */ | |
| 44 | + void deleteMaterialUnitListByIds(List<Long> ids); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 获得物料单位 | |
| 48 | + * | |
| 49 | + * @param id 编号 | |
| 50 | + * @return 物料单位 | |
| 51 | + */ | |
| 52 | + MaterialUnitDO getMaterialUnit(Long id); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 获得物料单位分页 | |
| 56 | + * | |
| 57 | + * @param pageReqVO 分页查询 | |
| 58 | + * @return 物料单位分页 | |
| 59 | + */ | |
| 60 | + PageResult<MaterialUnitDO> getMaterialUnitPage(MaterialUnitPageReqVO pageReqVO); | |
| 61 | + | |
| 62 | +} | |
| 0 | 63 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialunit/MaterialUnitServiceImpl.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.service.materialunit; | |
| 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.materialunit.vo.*; | |
| 11 | +import com.zteits.urbanops.module.garden.dal.dataobject.materialunit.MaterialUnitDO; | |
| 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.materialunit.MaterialUnitMapper; | |
| 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 MaterialUnitServiceImpl implements MaterialUnitService { | |
| 31 | + | |
| 32 | + @Resource | |
| 33 | + private MaterialUnitMapper materialUnitMapper; | |
| 34 | + | |
| 35 | + @Override | |
| 36 | + public Long createMaterialUnit(MaterialUnitSaveReqVO createReqVO) { | |
| 37 | + // 插入 | |
| 38 | + MaterialUnitDO materialUnit = BeanUtils.toBean(createReqVO, MaterialUnitDO.class); | |
| 39 | + materialUnitMapper.insert(materialUnit); | |
| 40 | + | |
| 41 | + // 返回 | |
| 42 | + return materialUnit.getId(); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public void updateMaterialUnit(MaterialUnitSaveReqVO updateReqVO) { | |
| 47 | + // 校验存在 | |
| 48 | + validateMaterialUnitExists(updateReqVO.getId()); | |
| 49 | + // 更新 | |
| 50 | + MaterialUnitDO updateObj = BeanUtils.toBean(updateReqVO, MaterialUnitDO.class); | |
| 51 | + materialUnitMapper.updateById(updateObj); | |
| 52 | + } | |
| 53 | + | |
| 54 | + @Override | |
| 55 | + public void deleteMaterialUnit(Long id) { | |
| 56 | + // 校验存在 | |
| 57 | + validateMaterialUnitExists(id); | |
| 58 | + // 删除 | |
| 59 | + materialUnitMapper.deleteById(id); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @Override | |
| 63 | + public void deleteMaterialUnitListByIds(List<Long> ids) { | |
| 64 | + // 删除 | |
| 65 | + materialUnitMapper.deleteByIds(ids); | |
| 66 | + } | |
| 67 | + | |
| 68 | + | |
| 69 | + private void validateMaterialUnitExists(Long id) { | |
| 70 | + if (materialUnitMapper.selectById(id) == null) { | |
| 71 | + throw exception(MATERIAL_UNIT_NOT_EXISTS); | |
| 72 | + } | |
| 73 | + } | |
| 74 | + | |
| 75 | + @Override | |
| 76 | + public MaterialUnitDO getMaterialUnit(Long id) { | |
| 77 | + return materialUnitMapper.selectById(id); | |
| 78 | + } | |
| 79 | + | |
| 80 | + @Override | |
| 81 | + public PageResult<MaterialUnitDO> getMaterialUnitPage(MaterialUnitPageReqVO pageReqVO) { | |
| 82 | + return materialUnitMapper.selectPage(pageReqVO); | |
| 83 | + } | |
| 84 | + | |
| 85 | +} | |
| 0 | 86 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/resources/mapper/materialname/MaterialNameMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="com.zteits.urbanops.module.garden.dal.mysql.materialname.MaterialNameMapper"> | |
| 4 | + | |
| 5 | + <!-- | |
| 6 | + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | |
| 7 | + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | |
| 8 | + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | |
| 9 | + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | |
| 10 | + --> | |
| 11 | + | |
| 12 | +</mapper> | |
| 0 | 13 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/resources/mapper/materialspecification/MaterialSpecificationMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="com.zteits.urbanops.module.garden.dal.mysql.materialspecification.MaterialSpecificationMapper"> | |
| 4 | + | |
| 5 | + <!-- | |
| 6 | + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | |
| 7 | + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | |
| 8 | + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | |
| 9 | + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | |
| 10 | + --> | |
| 11 | + | |
| 12 | +</mapper> | |
| 0 | 13 | \ No newline at end of file | ... | ... |
urbanops-module-garden/src/main/resources/mapper/materialunit/MaterialUnitMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="com.zteits.urbanops.module.garden.dal.mysql.materialunit.MaterialUnitMapper"> | |
| 4 | + | |
| 5 | + <!-- | |
| 6 | + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 | |
| 7 | + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 | |
| 8 | + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 | |
| 9 | + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ | |
| 10 | + --> | |
| 11 | + | |
| 12 | +</mapper> | |
| 0 | 13 | \ No newline at end of file | ... | ... |
urbanops-server/pom.xml