Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Project Unit API and supports kotlin jackson, remove redundant empty judgments #76

Merged
merged 9 commits into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.api.product

import com.baomidou.mybatisplus.extension.plugins.pagination.Page
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.api.product

import com.wansensoft.dto.product.AddOrUpdateProductCategoryDTO
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.api.product

import com.baomidou.mybatisplus.extension.plugins.pagination.Page
import com.wansensoft.dto.product.AddOrUpdateProductUnitDTO
import com.wansensoft.dto.product.ProductUnitQueryDTO
import com.wansensoft.dto.product.ProductUnitStatusDTO
import com.wansensoft.service.product.ProductUnitService
import com.wansensoft.utils.response.Response
import com.wansensoft.vo.product.ProductUnitVO
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("/product/unit")
class ProductUnitController(private val productUnitService: ProductUnitService) {

@PostMapping("/list")
fun productUnitList(@RequestBody productUnitQuery: ProductUnitQueryDTO): Response<Page<ProductUnitVO>> {
return productUnitService.productUnitList(productUnitQuery)
}

@PostMapping("/addOrUpdate")
fun addOrUpdateProductUnit(@RequestBody productUnit: AddOrUpdateProductUnitDTO): Response<String> {
return productUnitService.addOrUpdateProductUnit(productUnit)
}

@DeleteMapping("/deleteBatch")
fun deleteProductUnit(@RequestParam ids: List<Long>): Response<String> {
return productUnitService.deleteProductUnit(ids)
}

@PostMapping("/updateUnitStatus")
fun updateUnitStatus(@RequestBody productUnitStatus: ProductUnitStatusDTO): Response<String> {
return productUnitService.updateUnitStatus(productUnitStatus)
}
}
34 changes: 34 additions & 0 deletions domain/src/main/java/com/wansensoft/bo/BigDecimalSerializerBO.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.bo

import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.databind.JsonSerializer
import com.fasterxml.jackson.databind.SerializerProvider
import java.math.BigDecimal
import java.math.RoundingMode

class BigDecimalSerializerBO : JsonSerializer<BigDecimal>() {
override fun serialize(value: BigDecimal?, gen: JsonGenerator, serializers: SerializerProvider) {
if (value != null) {
val scaledValue = value.setScale(3, RoundingMode.HALF_UP)
if (scaledValue.stripTrailingZeros().scale() <= 0) {
gen.writeNumber(scaledValue.toBigInteger())
} else {
gen.writeNumber(scaledValue)
}
} else {
gen.writeNull()
}
}
}
14 changes: 12 additions & 2 deletions domain/src/main/java/com/wansensoft/bo/SmsInfoBO.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.bo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.dto.department

import lombok.Data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.dto.department;

import com.wansensoft.dto.PageSizeDTO;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.dto.product

import lombok.Data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.dto.product

import lombok.Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,27 @@
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.api.product;
package com.wansensoft.dto.product

import org.springframework.web.bind.annotation.RequestMapping;
import java.math.BigDecimal

import org.springframework.web.bind.annotation.RestController;
data class AddOrUpdateProductUnitDTO (

/**
* <p>
* 多单位表 前端控制器
* </p>
*
* @author James Zow
* @since 2023-09-05
*/
@RestController
@RequestMapping("/product-unit")
public class ProductUnitController {
val id : Long? = null,

var basicUnit: String? = null,

var otherUnit: String? = null,

var otherUnitTwo: String? = null,

var otherUnitThree: String? = null,

var ratio: BigDecimal? = null,

var ratioTwo: BigDecimal? = null,

var ratioThree: BigDecimal? = null,

}
var status: Int? = null
)
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.dto.product

import com.wansensoft.dto.PageSizeDTO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.service.product;
package com.wansensoft.dto.product

import com.wansensoft.entities.product.ProductUnit;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wansensoft.dto.PageSizeDTO

/**
* <p>
* 多单位表 服务类
* </p>
*/
public interface IProductUnitService extends IService<ProductUnit> {
data class ProductUnitQueryDTO (

val page: PageSizeDTO? = null,

}
val computeUnit: String? = null,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.wansensoft.dto.product

data class ProductUnitStatusDTO(

val id: Long? = null,

var status: Int? = null
)
12 changes: 12 additions & 0 deletions domain/src/main/java/com/wansensoft/dto/role/AddOrUpdateRoleDTO.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.dto.role

import com.wansensoft.dto.PageSizeDTO
Expand Down
12 changes: 12 additions & 0 deletions domain/src/main/java/com/wansensoft/dto/role/RoleListDTO.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.dto.role;

import com.wansensoft.dto.PageSizeDTO;
Expand Down
12 changes: 12 additions & 0 deletions domain/src/main/java/com/wansensoft/dto/role/RolePermissionDTO.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.dto.role

import lombok.Data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.dto.user;

import lombok.Data;
Expand Down
12 changes: 12 additions & 0 deletions domain/src/main/java/com/wansensoft/dto/user/MobileLoginDTO.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.dto.user;

import lombok.Data;
Expand Down
12 changes: 12 additions & 0 deletions domain/src/main/java/com/wansensoft/dto/user/UserListDTO.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
* Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansensoft.dto.user;

import com.wansensoft.dto.PageSizeDTO;
Expand Down
Loading