| @@ -17,17 +17,23 @@ interface DeliveryOrderRepository : AbstractRepository<DeliveryOrder, Long> { | |||||
| fun findByIdAndDeletedIsFalse(id: Serializable): DeliveryOrder? | fun findByIdAndDeletedIsFalse(id: Serializable): DeliveryOrder? | ||||
| fun findAllByCodeAndDeletedIsFalse(code: String): List<DeliveryOrderInfo> | |||||
| fun findAllByCodeContainsAndDeletedIsFalse(code: String?): List<DeliveryOrderInfo> | |||||
| fun findAllByShopNameAndDeletedIsFalse(shopName: String): List<DeliveryOrderInfo> | |||||
| fun findAllByShopNameContainsAndDeletedIsFalse(shopName: String?): List<DeliveryOrderInfo> | |||||
| fun findAllByStatusAndDeletedIsFalse(status: DeliveryOrderStatus): List<DeliveryOrderInfo> | |||||
| fun findAllByStatusAndDeletedIsFalse(status: DeliveryOrderStatus?): List<DeliveryOrderInfo> | |||||
| fun findByOrderDateBetweenAndDeletedIsFalse(start: LocalDateTime?, end: LocalDateTime?) : List<DeliveryOrderInfo> | |||||
| fun findByOrderDateBetweenAndDeletedIsFalse(startDate: LocalDateTime?, endDate: LocalDateTime?) : List<DeliveryOrderInfo> | |||||
| fun findAllByCodeContainsAndShopNameContainsAndStatusAndOrderDateBetween(code: String?, shopName: String?, status: DeliveryOrderStatus?, startDate: LocalDateTime?, endDate: LocalDateTime?) : List<DeliveryOrderInfo> | |||||
| fun findAllByCodeContainsAndShopNameContainsAndStatus(code: String?, shopName: String?, status: DeliveryOrderStatus?): List<DeliveryOrderInfo>; | |||||
| fun findAllByCodeContainsAndShopNameContainsAndStatusAndOrderDateBetweenAndDeletedIsFalse(code: String?, shopName: String?, status: DeliveryOrderStatus?, startDate: LocalDateTime?, endDate: LocalDateTime?) : List<DeliveryOrderInfo>; | |||||
| fun findAllBy() : List<DeliveryOrderInfo>; | fun findAllBy() : List<DeliveryOrderInfo>; | ||||
| } | |||||
| fun findAllByCodeContainsAndShopNameContainsAndDeletedIsFalse(code: String?, shopName: String?) : List<DeliveryOrderInfo>; | |||||
| fun findAllByCodeContainsAndShopNameContainsAndStatusAndDeletedIsFalse(code: String?, shopName: String?, staus: DeliveryOrderStatus?) : List<DeliveryOrderInfo>; | |||||
| fun findAllByCodeContainsAndShopNameContainsAndOrderDateBetweenAndDeletedIsFalse(code: String?, shopName: String?, startDate: LocalDateTime?, endDate: LocalDateTime?) : List<DeliveryOrderInfo>; | |||||
| } | |||||
| @@ -80,12 +80,12 @@ open class DeliveryOrderService( | |||||
| } | } | ||||
| ) | ) | ||||
| } | } | ||||
| open fun searchByCode(code: String) : List<DeliveryOrderInfo> { | |||||
| return deliveryOrderRepository.findAllByCodeAndDeletedIsFalse(code); | |||||
| open fun searchByCode(code: String?) : List<DeliveryOrderInfo> { | |||||
| return deliveryOrderRepository.findAllByCodeContainsAndDeletedIsFalse(code); | |||||
| } | } | ||||
| open fun searchByShopName(shopName: String) : List<DeliveryOrderInfo> { | open fun searchByShopName(shopName: String) : List<DeliveryOrderInfo> { | ||||
| return deliveryOrderRepository.findAllByShopNameAndDeletedIsFalse(shopName); | |||||
| return deliveryOrderRepository.findAllByShopNameContainsAndDeletedIsFalse(shopName); | |||||
| } | } | ||||
| open fun searchByStatus(status: DeliveryOrderStatus): List<DeliveryOrderInfo> { | open fun searchByStatus(status: DeliveryOrderStatus): List<DeliveryOrderInfo> { | ||||
| @@ -96,13 +96,27 @@ open class DeliveryOrderService( | |||||
| return deliveryOrderRepository.findByOrderDateBetweenAndDeletedIsFalse(start, end); | return deliveryOrderRepository.findByOrderDateBetweenAndDeletedIsFalse(start, end); | ||||
| } | } | ||||
| open fun searchDO(code: String?, shopName: String?, status: DeliveryOrderStatus?, startDate: LocalDateTime?, endDate: LocalDateTime?):List<DeliveryOrderInfo> { | |||||
| if(status == null || startDate == null || endDate ==null){ | |||||
| return deliveryOrderRepository.findAllBy(); | |||||
| } | |||||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndStatusAndOrderDateBetween(code, shopName, status, startDate, endDate); | |||||
| open fun searchAll(code: String?, shopName: String?, status: DeliveryOrderStatus?, startDate: LocalDateTime?, endDate: LocalDateTime?):List<DeliveryOrderInfo> { | |||||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndStatusAndOrderDateBetweenAndDeletedIsFalse(code, shopName, status, startDate, endDate); | |||||
| } | |||||
| open fun getFullList(): List<DeliveryOrderInfo>{ | |||||
| return deliveryOrderRepository.findAllBy(); | |||||
| } | } | ||||
| open fun searchCodeAndShopName(code: String?, shopName: String?) : List<DeliveryOrderInfo> { | |||||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndDeletedIsFalse(code, shopName); | |||||
| } | |||||
| open fun searchWithoutDate(code: String?, shopName: String?, status: DeliveryOrderStatus?) : List<DeliveryOrderInfo> { | |||||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndStatusAndDeletedIsFalse(code, shopName, status); | |||||
| } | |||||
| open fun searchWithoutStatus(code: String?, shopName: String?, startDate: LocalDateTime?, endDate: LocalDateTime?) : List<DeliveryOrderInfo> { | |||||
| return deliveryOrderRepository.findAllByCodeContainsAndShopNameContainsAndOrderDateBetweenAndDeletedIsFalse(code, shopName, startDate, endDate); | |||||
| } | |||||
| open fun updateDeliveryOrderStatus(request: SaveDeliveryOrderStatusRequest): SaveDeliveryOrderResponse { | open fun updateDeliveryOrderStatus(request: SaveDeliveryOrderStatusRequest): SaveDeliveryOrderResponse { | ||||
| @@ -57,11 +57,36 @@ class DeliveryOrderController( | |||||
| @GetMapping("/search-DO/{code}&{shopName}&{status}&{startDate}&{endDate}") | @GetMapping("/search-DO/{code}&{shopName}&{status}&{startDate}&{endDate}") | ||||
| fun searchDO(@PathVariable code: String?, @PathVariable shopName: String?, @PathVariable status: DeliveryOrderStatus?, @PathVariable startDate: LocalDateTime? , @PathVariable endDate: LocalDateTime?): List<DeliveryOrderInfo>{ | fun searchDO(@PathVariable code: String?, @PathVariable shopName: String?, @PathVariable status: DeliveryOrderStatus?, @PathVariable startDate: LocalDateTime? , @PathVariable endDate: LocalDateTime?): List<DeliveryOrderInfo>{ | ||||
| return deliveryOrderService.searchDO(code, shopName, status, startDate, endDate); | |||||
| if(code != null || shopName != null){ | |||||
| if(startDate!=null || endDate!=null){ | |||||
| if(status!=null){ | |||||
| //ALL | |||||
| return deliveryOrderService.searchAll(code, shopName, status, startDate, endDate); | |||||
| } | |||||
| else{ | |||||
| //WITHOUT STATUS | |||||
| return deliveryOrderService.searchWithoutStatus(code, shopName, startDate, endDate); | |||||
| } | |||||
| } | |||||
| if(startDate==null && endDate==null){ | |||||
| if(status!=null){ | |||||
| //WITHOUT DATE (CODE + SHOPNAME + STATUS) | |||||
| return deliveryOrderService.searchWithoutDate(code, shopName, status); | |||||
| } | |||||
| else{ | |||||
| //WITHOUT DATE + STATUS (CODE + SHOPNAME) | |||||
| return deliveryOrderService.searchCodeAndShopName(code, shopName); | |||||
| } | |||||
| } | |||||
| } | |||||
| //INITIALIZATION | |||||
| return deliveryOrderService.getFullList(); | |||||
| } | } | ||||
| @PostMapping("/update-status") | @PostMapping("/update-status") | ||||
| fun updateDoStatus(@RequestBody request: SaveDeliveryOrderStatusRequest): SaveDeliveryOrderResponse { | fun updateDoStatus(@RequestBody request: SaveDeliveryOrderStatusRequest): SaveDeliveryOrderResponse { | ||||
| return deliveryOrderService.updateDeliveryOrderStatus(request); | return deliveryOrderService.updateDeliveryOrderStatus(request); | ||||