1
+ /*
2
+ * Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
5
+ * with the License. A copy of the License is located at
6
+ *
7
+ * http://opensource.wansenai.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
10
+ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
13
+ package com.wansensoft.api.product
14
+
15
+ import com.baomidou.mybatisplus.extension.plugins.pagination.Page
16
+ import com.wansensoft.dto.product.AddOrUpdateProductUnitDTO
17
+ import com.wansensoft.dto.product.ProductUnitQueryDTO
18
+ import com.wansensoft.dto.product.ProductUnitStatusDTO
19
+ import com.wansensoft.service.product.ProductUnitService
20
+ import com.wansensoft.utils.response.Response
21
+ import com.wansensoft.vo.product.ProductUnitVO
22
+ import org.springframework.web.bind.annotation.*
23
+
24
+ @RestController
25
+ @RequestMapping(" /product/unit" )
26
+ class ProductUnitController (private val productUnitService : ProductUnitService ) {
27
+
28
+ @PostMapping(" /list" )
29
+ fun productUnitList (@RequestBody productUnitQuery : ProductUnitQueryDTO ): Response <Page <ProductUnitVO >> {
30
+ return productUnitService.productUnitList(productUnitQuery)
31
+ }
32
+
33
+ @PostMapping(" /addOrUpdate" )
34
+ fun addOrUpdateProductUnit (@RequestBody productUnit : AddOrUpdateProductUnitDTO ): Response <String > {
35
+ return productUnitService.addOrUpdateProductUnit(productUnit)
36
+ }
37
+
38
+ @DeleteMapping(" /deleteBatch" )
39
+ fun deleteProductUnit (@RequestParam ids : List <Long >): Response <String > {
40
+ return productUnitService.deleteProductUnit(ids)
41
+ }
42
+
43
+ @PostMapping(" /updateUnitStatus" )
44
+ fun updateUnitStatus (@RequestBody productUnitStatus : ProductUnitStatusDTO ): Response <String > {
45
+ return productUnitService.updateUnitStatus(productUnitStatus)
46
+ }
47
+ }
0 commit comments