Skip to content

Commit c74e66c

Browse files
authored
Merge pull request #76 from Jzow/master
Add Project Unit API and supports kotlin jackson, remove redundant empty judgments
2 parents 7027d8c + bb8b140 commit c74e66c

29 files changed

+666
-76
lines changed

api/src/main/java/com/wansensoft/api/product/ProductAttributeController.kt

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
*/
113
package com.wansensoft.api.product
214

315
import com.baomidou.mybatisplus.extension.plugins.pagination.Page

api/src/main/java/com/wansensoft/api/product/ProductCategoryController.kt

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
*/
113
package com.wansensoft.api.product
214

315
import com.wansensoft.dto.product.AddOrUpdateProductCategoryDTO
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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.bo
14+
15+
import com.fasterxml.jackson.core.JsonGenerator
16+
import com.fasterxml.jackson.databind.JsonSerializer
17+
import com.fasterxml.jackson.databind.SerializerProvider
18+
import java.math.BigDecimal
19+
import java.math.RoundingMode
20+
21+
class BigDecimalSerializerBO : JsonSerializer<BigDecimal>() {
22+
override fun serialize(value: BigDecimal?, gen: JsonGenerator, serializers: SerializerProvider) {
23+
if (value != null) {
24+
val scaledValue = value.setScale(3, RoundingMode.HALF_UP)
25+
if (scaledValue.stripTrailingZeros().scale() <= 0) {
26+
gen.writeNumber(scaledValue.toBigInteger())
27+
} else {
28+
gen.writeNumber(scaledValue)
29+
}
30+
} else {
31+
gen.writeNull()
32+
}
33+
}
34+
}

domain/src/main/java/com/wansensoft/bo/SmsInfoBO.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
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+
*/
113
package com.wansensoft.bo;
214

3-
import lombok.AllArgsConstructor;
415
import lombok.Builder;
516
import lombok.Data;
6-
import lombok.NoArgsConstructor;
717

818
@Data
919
@Builder

domain/src/main/java/com/wansensoft/dto/department/AddOrUpdateDeptDTO.kt

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
*/
113
package com.wansensoft.dto.department
214

315
import lombok.Data

domain/src/main/java/com/wansensoft/dto/department/DeptListDTO.java

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
*/
113
package com.wansensoft.dto.department;
214

315
import com.wansensoft.dto.PageSizeDTO;

domain/src/main/java/com/wansensoft/dto/product/AddOrUpdateProductAttributeDTO.kt

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
*/
113
package com.wansensoft.dto.product
214

315
import lombok.Data

domain/src/main/java/com/wansensoft/dto/product/AddOrUpdateProductCategoryDTO.kt

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
*/
113
package com.wansensoft.dto.product
214

315
import lombok.Data

api/src/main/java/com/wansensoft/api/product/ProductUnitController.java domain/src/main/java/com/wansensoft/dto/product/AddOrUpdateProductUnitDTO.kt

+20-15
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,27 @@
1010
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
1111
* and limitations under the License.
1212
*/
13-
package com.wansensoft.api.product;
13+
package com.wansensoft.dto.product
1414

15-
import org.springframework.web.bind.annotation.RequestMapping;
15+
import java.math.BigDecimal
1616

17-
import org.springframework.web.bind.annotation.RestController;
17+
data class AddOrUpdateProductUnitDTO (
1818

19-
/**
20-
* <p>
21-
* 多单位表 前端控制器
22-
* </p>
23-
*
24-
* @author James Zow
25-
* @since 2023-09-05
26-
*/
27-
@RestController
28-
@RequestMapping("/product-unit")
29-
public class ProductUnitController {
19+
val id : Long? = null,
20+
21+
var basicUnit: String? = null,
22+
23+
var otherUnit: String? = null,
24+
25+
var otherUnitTwo: String? = null,
26+
27+
var otherUnitThree: String? = null,
28+
29+
var ratio: BigDecimal? = null,
30+
31+
var ratioTwo: BigDecimal? = null,
32+
33+
var ratioThree: BigDecimal? = null,
3034

31-
}
35+
var status: Int? = null
36+
)

domain/src/main/java/com/wansensoft/dto/product/ProductAttributeQueryDTO.kt

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
*/
113
package com.wansensoft.dto.product
214

315
import com.wansensoft.dto.PageSizeDTO

service/src/main/java/com/wansensoft/service/product/IProductUnitService.java domain/src/main/java/com/wansensoft/dto/product/ProductUnitQueryDTO.kt

+7-10
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@
1010
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
1111
* and limitations under the License.
1212
*/
13-
package com.wansensoft.service.product;
13+
package com.wansensoft.dto.product
1414

15-
import com.wansensoft.entities.product.ProductUnit;
16-
import com.baomidou.mybatisplus.extension.service.IService;
15+
import com.wansensoft.dto.PageSizeDTO
1716

18-
/**
19-
* <p>
20-
* 多单位表 服务类
21-
* </p>
22-
*/
23-
public interface IProductUnitService extends IService<ProductUnit> {
17+
data class ProductUnitQueryDTO (
18+
19+
val page: PageSizeDTO? = null,
2420

25-
}
21+
val computeUnit: String? = null,
22+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.wansensoft.dto.product
2+
3+
data class ProductUnitStatusDTO(
4+
5+
val id: Long? = null,
6+
7+
var status: Int? = null
8+
)

domain/src/main/java/com/wansensoft/dto/role/AddOrUpdateRoleDTO.kt

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
*/
113
package com.wansensoft.dto.role
214

315
import com.wansensoft.dto.PageSizeDTO

domain/src/main/java/com/wansensoft/dto/role/RoleListDTO.java

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
*/
113
package com.wansensoft.dto.role;
214

315
import com.wansensoft.dto.PageSizeDTO;

domain/src/main/java/com/wansensoft/dto/role/RolePermissionDTO.kt

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
*/
113
package com.wansensoft.dto.role
214

315
import lombok.Data

domain/src/main/java/com/wansensoft/dto/user/AddOrUpdateUserDTO.java

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
*/
113
package com.wansensoft.dto.user;
214

315
import lombok.Data;

domain/src/main/java/com/wansensoft/dto/user/MobileLoginDTO.java

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
*/
113
package com.wansensoft.dto.user;
214

315
import lombok.Data;

domain/src/main/java/com/wansensoft/dto/user/UserListDTO.java

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
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+
*/
113
package com.wansensoft.dto.user;
214

315
import com.wansensoft.dto.PageSizeDTO;

0 commit comments

Comments
 (0)