diff --git a/samples/web-csr/dressca-backend/.vscode/launch.json b/samples/web-csr/dressca-backend/.vscode/launch.json index 1f81dd98a..abb5d5e46 100644 --- a/samples/web-csr/dressca-backend/.vscode/launch.json +++ b/samples/web-csr/dressca-backend/.vscode/launch.json @@ -2,12 +2,23 @@ "configurations": [ { "type": "java", - "name": "Spring Boot-WebApplication", + "name": "Spring Boot-WebApplication", "request": "launch", "cwd": "${workspaceFolder}", "console": "internalConsole", - "mainClass": "com.dressca.web.WebApplication", - "projectName": "web", + "mainClass": "com.dressca.web.consumer.WebApplication", + "projectName": "web-consumer", + "args": "", + "envFile": "${workspaceFolder}/.env" + }, + { + "type": "java", + "name": "Spring Boot-WebApplication", + "request": "launch", + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "mainClass": "com.dressca.web.admin.WebApplication", + "projectName": "web-admin", "args": "", "envFile": "${workspaceFolder}/.env" }, diff --git a/samples/web-csr/dressca-backend/api-docs/web-admin/api-specification.json b/samples/web-csr/dressca-backend/api-docs/web-admin/api-specification.json new file mode 100644 index 000000000..f35400fc8 --- /dev/null +++ b/samples/web-csr/dressca-backend/api-docs/web-admin/api-specification.json @@ -0,0 +1,686 @@ +{ + "openapi": "3.0.1", + "info": { + "description": "ECサイトDressca", + "title": "Dressca", + "version": "v1" + }, + "servers": [ + { + "url": "http://localhost:8081", + "description": "Generated server url" + } + ], + "tags": [ + { + "description": "カタログブランドの情報にアクセスするAPI", + "name": "CatalogBrands" + }, + { + "description": "ログイン中のユーザーの情報を取得します。", + "name": "Users" + }, + { + "description": "カタログアイテムの情報にアクセスする API コントローラーです.", + "name": "CatalogItems" + }, + { + "description": "Monitor and interact", + "externalDocs": { + "description": "Spring Boot Actuator Web API Documentation", + "url": "https://docs.spring.io/spring-boot/docs/current/actuator-api/html/" + }, + "name": "Actuator" + }, + { + "description": "アセットの情報にアクセスするAPI", + "name": "Assets" + }, + { + "description": "カタログカテゴリの情報にアクセスするAPI", + "name": "CatalogCategories" + } + ], + "paths": { + "/api": { + "get": { + "operationId": "links", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/Link" + } + } + } + }, + "application/vnd.spring-boot.actuator.v2+json": { + "schema": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/Link" + } + } + } + }, + "application/vnd.spring-boot.actuator.v3+json": { + "schema": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/Link" + } + } + } + } + }, + "description": "OK" + } + }, + "summary": "Actuator root web endpoint", + "tags": [ + "Actuator" + ] + } + }, + "/api/assets/{assetCode}": { + "get": { + "description": "与えられたアセットコードに対応するアセットを返却する.", + "operationId": "get", + "parameters": [ + { + "description": "アセットコード", + "in": "path", + "name": "assetCode", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "image/*": { + "schema": { + "type": "string", + "format": "binary" + } + } + }, + "description": "成功." + }, + "404": { + "description": "アセットコードに対応するアセットがない." + } + }, + "summary": "アセットを取得する.", + "tags": [ + "Assets" + ] + } + }, + "/api/catalog-brands": { + "get": { + "description": "カタログブランドの一覧を取得する.", + "operationId": "getCatalogBrands", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CatalogBrandResponse" + } + } + } + }, + "description": "成功" + } + }, + "summary": "カタログブランドの一覧を取得する.", + "tags": [ + "CatalogBrands" + ] + } + }, + "/api/catalog-categories": { + "get": { + "description": "カタログカテゴリの一覧を取得します.", + "operationId": "getCatalogCategories", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CatalogCategoryResponse" + } + } + } + }, + "description": "成功" + } + }, + "summary": "カタログカテゴリの一覧を取得します.", + "tags": [ + "CatalogCategories" + ] + } + }, + "/api/catalog-items": { + "get": { + "description": "カタログアイテムを検索して返します.", + "operationId": "getByQuery", + "parameters": [ + { + "in": "query", + "name": "brandId", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "default": 0 + } + }, + { + "in": "query", + "name": "categoryId", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "default": 0 + } + }, + { + "in": "query", + "name": "page", + "required": false, + "schema": { + "type": "integer", + "format": "int32", + "default": 0 + } + }, + { + "in": "query", + "name": "pageSize", + "required": false, + "schema": { + "type": "integer", + "format": "int32", + "default": 20 + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PagedListOfCatalogItemResponse" + } + } + }, + "description": "成功" + }, + "400": { + "description": "リクエストエラー" + }, + "401": { + "description": "未認証エラー" + }, + "404": { + "description": "リソースアクセスエラー" + } + }, + "summary": "カタログアイテムを検索して返します.", + "tags": [ + "CatalogItems" + ] + }, + "post": { + "description": "カタログにアイテムを追加します。", + "operationId": "postCatalogItem", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PostCatalogItemRequest" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "成功。" + }, + "401": { + "description": "未認証エラー" + }, + "404": { + "description": "リソースアクセスエラー" + } + }, + "summary": "カタログにアイテムを追加します。", + "tags": [ + "CatalogItems" + ] + } + }, + "/api/catalog-items/{catalogItemId}": { + "delete": { + "description": "カタログから指定したカタログアイテム ID のアイテムを削除します。", + "operationId": "deleteCatalogItem", + "parameters": [ + { + "in": "path", + "name": "catalogItemId", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "成功." + }, + "401": { + "description": "未認証エラー" + }, + "404": { + "description": "対象のIDが存在しない。" + } + }, + "summary": "カタログから指定したカタログアイテム ID のアイテムを削除します。", + "tags": [ + "CatalogItems" + ] + }, + "put": { + "description": "指定したIDのカタログアイテムの情報を更新します。", + "operationId": "putCatalogItem", + "parameters": [ + { + "in": "path", + "name": "catalogItemId", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PutCatalogItemRequest" + } + } + }, + "required": true + }, + "responses": { + "204": { + "description": "成功." + }, + "401": { + "description": "未認証エラー" + }, + "404": { + "description": "対象のIDが存在しない。" + }, + "409": { + "description": "更新の競合が発生。" + } + }, + "summary": "指定したIDのカタログアイテムの情報を更新します。", + "tags": [ + "CatalogItems" + ] + } + }, + "/api/catalog-items/{id}": { + "get": { + "description": "指定したIDのカタログアイテムを返します。", + "operationId": "getById", + "parameters": [ + { + "in": "path", + "name": "id", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PagedListOfCatalogItemResponse" + } + } + }, + "description": "成功" + }, + "401": { + "description": "未認証エラー" + }, + "404": { + "description": "対象のIDが存在しない。" + } + }, + "summary": "指定したIDのカタログアイテムを返します。", + "tags": [ + "CatalogItems" + ] + } + }, + "/api/health": { + "get": { + "operationId": "health", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + }, + "application/vnd.spring-boot.actuator.v2+json": { + "schema": { + "type": "object" + } + }, + "application/vnd.spring-boot.actuator.v3+json": { + "schema": { + "type": "object" + } + } + }, + "description": "OK" + } + }, + "summary": "Actuator web endpoint \u0027health\u0027", + "tags": [ + "Actuator" + ] + } + }, + "/api/health/**": { + "get": { + "operationId": "health-path", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + }, + "application/vnd.spring-boot.actuator.v2+json": { + "schema": { + "type": "object" + } + }, + "application/vnd.spring-boot.actuator.v3+json": { + "schema": { + "type": "object" + } + } + }, + "description": "OK" + } + }, + "summary": "Actuator web endpoint \u0027health-path\u0027", + "tags": [ + "Actuator" + ] + } + }, + "/api/users": { + "get": { + "description": "ユーザーの情報。", + "operationId": "getLoginUser", + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserResponse" + } + } + }, + "description": "成功." + }, + "401": { + "description": "未認証エラー." + } + }, + "summary": "ログイン中のユーザーの情報を取得します。", + "tags": [ + "Users" + ] + } + } + }, + "components": { + "schemas": { + "CatalogBrandResponse": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ] + }, + "CatalogCategoryResponse": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ] + }, + "CatalogItemResponse": { + "type": "object", + "properties": { + "assetCodes": { + "type": "array", + "items": { + "type": "string" + } + }, + "catalogBrandId": { + "type": "integer", + "format": "int64" + }, + "catalogCategoryId": { + "type": "integer", + "format": "int64" + }, + "description": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "price": { + "type": "number" + }, + "productCode": { + "type": "string" + } + }, + "required": [ + "catalogBrandId", + "catalogCategoryId", + "description", + "id", + "name", + "price", + "productCode" + ] + }, + "Link": { + "type": "object", + "properties": { + "href": { + "type": "string" + }, + "templated": { + "type": "boolean" + } + } + }, + "PagedListOfCatalogItemResponse": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CatalogItemResponse" + } + }, + "page": { + "type": "integer", + "format": "int32" + }, + "pageSize": { + "type": "integer", + "format": "int32" + }, + "totalCount": { + "type": "integer", + "format": "int32" + } + } + }, + "PostCatalogItemRequest": { + "type": "object", + "properties": { + "catalogBrandId": { + "type": "integer", + "format": "int64" + }, + "catalogCategoryId": { + "type": "integer", + "format": "int64" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "price": { + "type": "integer", + "format": "int64" + }, + "productCode": { + "type": "string" + }, + "rowVersion": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "catalogBrandId", + "catalogCategoryId", + "description", + "name", + "price", + "productCode" + ] + }, + "PutCatalogItemRequest": { + "type": "object", + "properties": { + "catalogBrandId": { + "type": "integer", + "format": "int64" + }, + "catalogCategoryId": { + "type": "integer", + "format": "int64" + }, + "description": { + "type": "string" + }, + "name": { + "type": "string" + }, + "price": { + "type": "integer", + "format": "int64" + }, + "productCode": { + "type": "string" + } + }, + "required": [ + "catalogBrandId", + "catalogCategoryId", + "description", + "name", + "price", + "productCode" + ] + }, + "UserResponse": { + "type": "object", + "properties": { + "role": { + "type": "string" + }, + "userName": { + "type": "string" + } + }, + "required": [ + "role", + "userName" + ] + } + } + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/api-docs/api-specification.json b/samples/web-csr/dressca-backend/api-docs/web-consumer/api-specification.json similarity index 100% rename from samples/web-csr/dressca-backend/api-docs/api-specification.json rename to samples/web-csr/dressca-backend/api-docs/web-consumer/api-specification.json diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/CatalogApplicationService.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/CatalogApplicationService.java index f0cd22be4..a63850804 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/CatalogApplicationService.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/applicationservice/CatalogApplicationService.java @@ -1,5 +1,7 @@ package com.dressca.applicationcore.applicationservice; +import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.List; import java.util.Locale; import org.slf4j.Logger; @@ -8,21 +10,25 @@ import org.springframework.context.MessageSource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import com.dressca.applicationcore.authorization.PermissionDeniedException; +import com.dressca.applicationcore.authorization.UserStore; import com.dressca.applicationcore.catalog.CatalogBrand; +import com.dressca.applicationcore.catalog.CatalogBrandNotFoundException; import com.dressca.applicationcore.catalog.CatalogBrandRepository; import com.dressca.applicationcore.catalog.CatalogCategory; +import com.dressca.applicationcore.catalog.CatalogCategoryNotFoundException; import com.dressca.applicationcore.catalog.CatalogCategoryRepository; import com.dressca.applicationcore.catalog.CatalogItem; +import com.dressca.applicationcore.catalog.CatalogNotFoundException; import com.dressca.applicationcore.catalog.CatalogRepository; import com.dressca.systemcommon.constant.MessageIdConstant; import com.dressca.systemcommon.constant.SystemPropertyConstants; -import lombok.AllArgsConstructor; +import com.dressca.systemcommon.exception.OptimisticLockingFailureException; /** * カタログ情報に関するビジネスユースケースを実現するサービスです。 */ @Service -@AllArgsConstructor @Transactional(rollbackFor = Exception.class) public class CatalogApplicationService { @@ -31,27 +37,192 @@ public class CatalogApplicationService { private CatalogRepository catalogRepository; private CatalogBrandRepository brandRepository; - private CatalogCategoryRepository catalogCategoryRepository; + private CatalogCategoryRepository categoryRepository; + private UserStore userStore; + + /** + * コンストラクタ。 + * + * @param messages メッセージ + * @param catalogRepository カタログリポジトリ。 + * @param brandRepository カタログブランドリポジトリ。 + * @param categoryRepository カタログカテゴリリポジトリ。 + */ + public CatalogApplicationService(MessageSource messages, CatalogRepository catalogRepository, + CatalogBrandRepository brandRepository, CatalogCategoryRepository categoryRepository) { + this.messages = messages; + this.catalogRepository = catalogRepository; + this.brandRepository = brandRepository; + this.categoryRepository = categoryRepository; + } + + @Autowired(required = false) + public void setUserStore(UserStore userStore) { + this.userStore = userStore; + } private static final Logger apLog = LoggerFactory.getLogger(SystemPropertyConstants.APPLICATION_LOG_LOGGER); /** - * 条件に一致するカタログ情報を取得します。 + * 指定したIdのカタログアイテムを取得します。 + * + * @param id カタログアイテムID + * @return 条件に一致するカタログアイテム。 + * @throws CatalogNotFoundException カタログアイテムが見つからなかった場合。 + * @throws PermissionDeniedException 取得権限がない場合。 + */ + public CatalogItem getCatalogItem(long id) throws CatalogNotFoundException, PermissionDeniedException { + apLog.debug(messages.getMessage(MessageIdConstant.D_CATALOG0005_LOG, new Object[] { id }, Locale.getDefault())); + + if (!this.userStore.isInRole("ROLE_ADMIN")) { + throw new PermissionDeniedException("getCatalogItem"); + } + + CatalogItem item = this.catalogRepository.findById(id); + if (item == null) { + throw new CatalogNotFoundException(id); + } + return item; + } + + /** + * 利用者が条件に一致するカタログ情報を取得します。 + * + * @param brandId ブランドID + * @param categoryId カテゴリID + * @param page ページ + * @param pageSize ページサイズ + * @return 条件に一致するカタログ情報のリスト。存在しない場合は空のリスト。 + */ + public List getCatalogItemsByConsumer(long brandId, long categoryId, int page, int pageSize) { + + apLog.debug(messages.getMessage(MessageIdConstant.D_CATALOG0001_LOG, + new Object[] { brandId, categoryId, page, pageSize }, Locale.getDefault())); + + return this.catalogRepository.findByBrandIdAndCategoryId(brandId, categoryId, page, pageSize); + } + + /** + * 管理者が条件に一致するカタログ情報を取得します。 * * @param brandId ブランドID * @param categoryId カテゴリID * @param page ページ * @param pageSize ページサイズ * @return 条件に一致するカタログ情報のリスト。存在しない場合は空のリスト。 + * @throws PermissionDeniedException 取得権限がない場合。 */ - public List getCatalogItems(long brandId, long categoryId, int page, int pageSize) { + public List getCatalogItemsByAdmin(long brandId, long categoryId, int page, int pageSize) + throws PermissionDeniedException { apLog.debug(messages.getMessage(MessageIdConstant.D_CATALOG0001_LOG, new Object[] { brandId, categoryId, page, pageSize }, Locale.getDefault())); + if (!this.userStore.isInRole("ROLE_ADMIN")) { + throw new PermissionDeniedException("getCatalogItemsByAdmin"); + } + return this.catalogRepository.findByBrandIdAndCategoryId(brandId, categoryId, page, pageSize); } + /** + * カタログにアイテムを追加します。 + * + * @param name 商品名 + * @param description 説明 + * @param price 単価 + * @param productCode 商品コード + * @param catalogBrandId ブランドID + * @param catalogCategoryId カテゴリID + * @return 追加したカタログアイテム。 + * @throws PermissionDeniedException 追加権限がない場合。 + */ + public CatalogItem addItemToCatalog(String name, String description, BigDecimal price, String productCode, + long catalogCategoryId, long catalogBrandId) throws PermissionDeniedException { + apLog.debug(messages.getMessage(MessageIdConstant.D_CATALOG0006_LOG, new Object[] {}, Locale.getDefault())); + + if (!this.userStore.isInRole("ROLE_ADMIN")) { + throw new PermissionDeniedException("addItemToCatalog"); + } + + // 0は仮の値で、DBにINSERTされる時にDBによって自動採番される + CatalogItem item = new CatalogItem(0, name, description, price, productCode, catalogCategoryId, catalogBrandId); + item.setRowVersion(LocalDateTime.now()); + CatalogItem catalogItemAdded = this.catalogRepository.add(item); + return catalogItemAdded; + } + + /** + * カタログからアイテムを削除します。 + * + * @param id 削除対象のカタログアイテムのID。 + * @throws PermissionDeniedException 削除権限がない場合。 + * @throws CatalogNotFoundException 削除対象のカタログアイテムが存在しなかった場合。 + * + */ + public void deleteItemFromCatalog(long id) throws CatalogNotFoundException, PermissionDeniedException { + apLog.debug(messages.getMessage(MessageIdConstant.D_CATALOG0007_LOG, new Object[] { id }, Locale.getDefault())); + if (!this.userStore.isInRole("ROLE_ADMIN")) { + throw new PermissionDeniedException("deleteItemFromCatalog"); + } + CatalogItem item = this.catalogRepository.findById(id); + if (item == null) { + throw new CatalogNotFoundException(id); + } + this.catalogRepository.remove(item); + } + + /** + * カタログアイテムを更新します。 + * + * @param id 更新対象のカタログアイテムID。 + * @param name 商品名。 + * @param description 説明。 + * @param price 価格。 + * @param productCode 商品コード。 + * @param catalogCategoryId カテゴリID。 + * @param catalogBrandId ブランドID。 + * @throws CatalogNotFoundException 更新対象のカタログアイテムが存在しなかった場合。 + * @throws PermissionDeniedException 更新権限がない場合。 + * @throws CatalogBrandNotFoundException 更新対象のカタログブランドが存在しなかった場合。 + * @throws CatalogCategoryNotFoundException 更新対象のカタログカテゴリが存在しなかった場合。 + * @throws OptimisticLockingFailureException 楽観ロックエラーの場合。 + */ + public void updateCatalogItem(long id, String name, String description, BigDecimal price, String productCode, + long catalogCategoryId, long catalogBrandId) + throws CatalogNotFoundException, PermissionDeniedException, CatalogBrandNotFoundException, + CatalogCategoryNotFoundException, OptimisticLockingFailureException { + + apLog.debug(messages.getMessage(MessageIdConstant.D_CATALOG0008_LOG, new Object[] { id }, Locale.getDefault())); + + if (!this.userStore.isInRole("ROLE_ADMIN")) { + throw new PermissionDeniedException("updateCatalogItem"); + } + CatalogItem currentCatalogItem = catalogRepository.findById(id); + if (currentCatalogItem == null) { + throw new CatalogNotFoundException(id); + } + + CatalogCategory catalogCategory = categoryRepository.findById(catalogCategoryId); + if (catalogCategory == null) { + throw new CatalogCategoryNotFoundException(catalogCategoryId); + } + + CatalogBrand catalogBrand = brandRepository.findById(catalogBrandId); + if (catalogBrand == null) { + throw new CatalogBrandNotFoundException(catalogBrandId); + } + + CatalogItem item = new CatalogItem(id, name, description, price, productCode, catalogCategoryId, catalogBrandId); + // 変更前の行バージョンを取得し、変更対象のカタログアイテムに追加 + item.setRowVersion(currentCatalogItem.getRowVersion()); + + int updateRowCount = this.catalogRepository.update(item); + if (updateRowCount == 0) { + throw new OptimisticLockingFailureException(id); + } + } + /** * 条件に一致するカテゴリの件数を取得します。 * @@ -88,6 +259,6 @@ public List getCategories() { apLog.debug(messages.getMessage(MessageIdConstant.D_CATALOG0004_LOG, new Object[] {}, Locale.getDefault())); - return this.catalogCategoryRepository.getAll(); + return this.categoryRepository.getAll(); } } diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/authorization/PermissionDeniedException.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/authorization/PermissionDeniedException.java new file mode 100644 index 000000000..a00e8f838 --- /dev/null +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/authorization/PermissionDeniedException.java @@ -0,0 +1,20 @@ +package com.dressca.applicationcore.authorization; + +import com.dressca.systemcommon.constant.ExceptionIdConstant; +import com.dressca.systemcommon.exception.LogicException; + +/** + * ユーザーに実行権限がないことを表す例外です。 + */ +public class PermissionDeniedException extends LogicException { + /** + * 実行を試みた操作を指定して + * {@link PermissionDeniedException} クラスの新しいインスタンスを初期化します。 + * + * @param operationName 実行を試みた操作 + */ + public PermissionDeniedException(String operationName) { + super(null, ExceptionIdConstant.E_CATALOG0004, new String[] { String.valueOf(operationName) }, + new String[] { String.valueOf(operationName) }); + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/authorization/UserStore.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/authorization/UserStore.java new file mode 100644 index 000000000..87b1e933c --- /dev/null +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/authorization/UserStore.java @@ -0,0 +1,13 @@ +package com.dressca.applicationcore.authorization; + +/** + * ユーザーのセッション情報のインターフェース。 + */ +public interface UserStore { + + public String loginUserName(); + + public String loginUserRole(); + + public boolean isInRole(String role); +} diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogBrandNotFoundException.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogBrandNotFoundException.java new file mode 100644 index 000000000..8f9386b86 --- /dev/null +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogBrandNotFoundException.java @@ -0,0 +1,23 @@ +package com.dressca.applicationcore.catalog; + +import com.dressca.systemcommon.constant.ExceptionIdConstant; +import com.dressca.systemcommon.exception.LogicException; + +/** + * カタログブランドが存在しないことを表す例外です。 + */ +public class CatalogBrandNotFoundException extends LogicException { + + /** + * 見つからなかったカタログブランド Id を指定して + * {@link CatalogItemNotExistingInRepositoryException} クラスの新しいインスタンスを初期化します。 + * + * @param catalogBrandId 見つからなかったカタログブランド Id 。 + */ + public CatalogBrandNotFoundException(long catalogBrandId) { + super(null, ExceptionIdConstant.E_CATALOG0002, new String[] { String.valueOf( + catalogBrandId) }, + new String[] { String.valueOf(catalogBrandId) }); + } + +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogBrandRepository.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogBrandRepository.java index 7bfcc02f4..48ad827ac 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogBrandRepository.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogBrandRepository.java @@ -12,4 +12,11 @@ public interface CatalogBrandRepository { * @return カタログブランドのリスト */ List getAll(); + + /** + * 指定した ID のカタログブランドを取得します。 + * + * @return 条件に一致するカタログブランド。 + */ + CatalogBrand findById(long id); } diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogCategoryNotFoundException.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogCategoryNotFoundException.java new file mode 100644 index 000000000..d3d2cc4f9 --- /dev/null +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogCategoryNotFoundException.java @@ -0,0 +1,23 @@ +package com.dressca.applicationcore.catalog; + +import com.dressca.systemcommon.constant.ExceptionIdConstant; +import com.dressca.systemcommon.exception.LogicException; + +/** + * カタログカテゴリが存在しないことを表す例外です。 + */ +public class CatalogCategoryNotFoundException extends LogicException { + + /** + * 見つからなかったカタログカテゴリ Id を指定して + * {@link CatalogItemNotExistingInRepositoryException} クラスの新しいインスタンスを初期化します。 + * + * @param catalogCategoryId 見つからなかったカタログカテゴリ Id 。 + */ + public CatalogCategoryNotFoundException(long catalogCategoryId) { + super(null, ExceptionIdConstant.E_CATALOG0003, new String[] { String.valueOf( + catalogCategoryId) }, + new String[] { String.valueOf(catalogCategoryId) }); + } + +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogCategoryRepository.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogCategoryRepository.java index 7b15bc679..ec832e836 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogCategoryRepository.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogCategoryRepository.java @@ -12,4 +12,11 @@ public interface CatalogCategoryRepository { * @return カタログカテゴリのリスト */ List getAll(); + + /** + * 指定した ID のカタログカテゴリを取得します。 + * + * @return 条件に一致するカタログカテゴリ。 + */ + CatalogCategory findById(long id); } diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogItem.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogItem.java index 706a2a73d..f06bafe98 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogItem.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogItem.java @@ -1,6 +1,7 @@ package com.dressca.applicationcore.catalog; import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import lombok.Data; @@ -27,6 +28,7 @@ public class CatalogItem { private String productCode; private long catalogCategoryId; private long catalogBrandId; + private LocalDateTime rowVersion; /** * コンストラクタ。 @@ -36,7 +38,7 @@ public class CatalogItem { * @param description 商品紹介 * @param price 単価 * @param productCode プロダクトコード - * @param catalogCategoryId カタログ商品ID + * @param catalogCategoryId カタログカテゴリID * @param catalogBrandId カタログブランドID */ public CatalogItem(long id, @NonNull String name, @NonNull String description, diff --git a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogRepository.java b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogRepository.java index 5070afc5a..522119932 100644 --- a/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogRepository.java +++ b/samples/web-csr/dressca-backend/application-core/src/main/java/com/dressca/applicationcore/catalog/CatalogRepository.java @@ -51,4 +51,35 @@ List findByBrandIdAndCategoryId(long brandId, long categoryId, int * @param pageSize データ取得行数の最大値 */ List findWithPaging(int skipRows, int pageSize); + + /** + * 指定した ID のカタログアイテムを取得します。 + * + * @param id カタログアイテムID + * @return 条件に一致するカタログアイテム + */ + CatalogItem findById(long id); + + /** + * カタログアイテムを追加します。 + * + * @param item カタログアイテム + * @return 追加されたカタログアイテム + */ + CatalogItem add(CatalogItem item); + + /** + * カタログアイテムを削除します。 + * + * @param item カタログアイテム + */ + int remove(CatalogItem item); + + /** + * カタログアイテムを更新します。 + * + * @param item カタログアイテム + */ + int update(CatalogItem item); + } diff --git a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java index 7b263b017..e5463d78b 100644 --- a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java +++ b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java @@ -8,7 +8,6 @@ import java.util.Optional; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; @@ -47,8 +46,7 @@ void setUp() { } @Test - @DisplayName("testGetAssetResourceInfo_01_正常系_存在するアセットコード") - void testGetAssetResourceInfo_01_正常系_存在するアセットコード() throws AssetNotFoundException { + void testGetAssetResourceInfo_正常系_存在するアセットコード() throws AssetNotFoundException { // テスト用の入力データ String assetCode = "ExistAssetCode"; @@ -70,8 +68,7 @@ void setUp() { } @Test - @DisplayName("testGetAssetResourceInfo_02_異常系_リポジトリに存在しないアセットコード") - void testGetAssetResourceInfo_02_異常系_リポジトリに存在しないアセットコード() { + void testGetAssetResourceInfo_異常系_リポジトリに存在しないアセットコード() { // テスト用の入力データ String assetCode = "NotExistAssetCode"; @@ -90,8 +87,7 @@ void setUp() { } @Test - @DisplayName("testGetAssetResourceInfo_03_異常系_ストアに存在しないアセットコード") - void testGetAssetResourceInfo_03_異常系_ストアに存在しないアセットコード() { + void testGetAssetResourceInfo_異常系_ストアに存在しないアセットコード() { // テスト用の入力データ String assetCode = "NotExistAssetCode"; diff --git a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/CatalogApplicationServiceTest.java b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/CatalogApplicationServiceTest.java index 196a3610c..209d615fc 100644 --- a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/CatalogApplicationServiceTest.java +++ b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/applicationservice/CatalogApplicationServiceTest.java @@ -1,7 +1,10 @@ package com.dressca.applicationcore.applicationservice; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -12,18 +15,25 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.function.Executable; import org.mockito.Mock; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration; import org.springframework.context.MessageSource; import org.springframework.test.context.junit.jupiter.SpringExtension; +import com.dressca.applicationcore.authorization.PermissionDeniedException; +import com.dressca.applicationcore.authorization.UserStore; import com.dressca.applicationcore.catalog.CatalogBrand; +import com.dressca.applicationcore.catalog.CatalogBrandNotFoundException; import com.dressca.applicationcore.catalog.CatalogBrandRepository; import com.dressca.applicationcore.catalog.CatalogCategory; +import com.dressca.applicationcore.catalog.CatalogCategoryNotFoundException; import com.dressca.applicationcore.catalog.CatalogCategoryRepository; import com.dressca.applicationcore.catalog.CatalogItem; +import com.dressca.applicationcore.catalog.CatalogNotFoundException; import com.dressca.applicationcore.catalog.CatalogRepository; +import com.dressca.systemcommon.exception.OptimisticLockingFailureException; /** * {@link CatalogApplicationService}の動作をテストするクラスです。 @@ -36,7 +46,9 @@ public class CatalogApplicationServiceTest { @Mock private CatalogBrandRepository brandRepository; @Mock - private CatalogCategoryRepository catalogCategoryRepository; + private CatalogCategoryRepository categoryRepository; + @Mock + private UserStore userStore; @Autowired private MessageSource messages; @@ -45,23 +57,300 @@ public class CatalogApplicationServiceTest { @BeforeEach void setUp() { - service = new CatalogApplicationService(messages, catalogRepository, brandRepository, catalogCategoryRepository); + service = new CatalogApplicationService(messages, catalogRepository, brandRepository, categoryRepository); + service.setUserStore(this.userStore); } @Test - void testGetCatalogItems_正常系_リポジトリのfindByBrandIdAndCategoryIdを1回呼出す() { + void testGetCatalogItemsByAdmin_正常系_リポジトリのfindByBrandIdAndCategoryIdを1回呼出す() throws PermissionDeniedException { // Arrange - List catalogItems = List.of(createCatalogItem(1L)); - when(this.catalogRepository.findByBrandIdAndCategoryId(anyLong(), anyLong(), anyInt(), anyInt())) - .thenReturn(catalogItems); + when(this.userStore.isInRole(anyString())).thenReturn(true); - // Act - service.getCatalogItems(1L, 1L, 1, 10); + // Action + service.getCatalogItemsByAdmin(1L, 1L, 0, 20); // Assert - verify(this.catalogRepository, times(1)).findByBrandIdAndCategoryId(anyLong(), anyLong(), - anyInt(), anyInt()); + verify(this.catalogRepository, times(1)).findByBrandIdAndCategoryId(anyLong(), anyLong(), anyInt(), anyInt()); + } + + @Test + void testGetCatalogItemsByAdmin_異常系_カタログアイテムの一覧を取得する権限がない() { + // Arrange + when(this.userStore.isInRole(anyString())).thenReturn(false); + // Action + Executable action = () -> { + service.getCatalogItemsByAdmin(1L, 1L, 0, 20); + }; + + // Assert + assertThrows(PermissionDeniedException.class, action); + } + + @Test + void testGetCatalogItem_正常系_リポジトリのfindByIdを1回呼出す() throws CatalogNotFoundException, PermissionDeniedException { + // Arrange + long targetId = 1L; + CatalogItem catalogItem = createCatalogItem(targetId); + when(this.catalogRepository.findById(anyLong())).thenReturn(catalogItem); + when(this.userStore.isInRole(anyString())).thenReturn(true); + + // Action + service.getCatalogItem(1L); + + // Assert + verify(this.catalogRepository, times(1)).findById(anyLong()); + } + + @Test + void testGetCatalogItem_異常系_対象のアイテムが存在しない() { + // Arrange + when(this.catalogRepository.findById(anyLong())).thenReturn(null); + when(this.userStore.isInRole(anyString())).thenReturn(true); + + // Action + Executable action = () -> { + this.service.getCatalogItem(anyLong()); + }; + + // Assert + assertThrows(CatalogNotFoundException.class, action); + } + + @Test + void testGetCatalogItem_異常系_カタログアイテムを取得する権限がない() { + // Arrange + long targetId = 1L; + CatalogItem item = createCatalogItem(targetId); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + when(this.userStore.isInRole(anyString())).thenReturn(false); + + // Action + Executable action = () -> { + this.service.getCatalogItem(anyLong()); + }; + + // Assert + assertThrows(PermissionDeniedException.class, action); + } + + @Test + void testAddItemToCatalog_正常系_リポジトリのaddCatalogItemを1回呼出す() throws PermissionDeniedException { + // Arrange + when(this.userStore.isInRole(anyString())).thenReturn(true); + + // Action + service.addItemToCatalog("テストアイテム", "テスト用のアイテムです。", new BigDecimal(123456), "TEST001", 1, 1); + + // Assert + verify(this.catalogRepository, times(1)).add(any()); + } + + @Test + void testAddItemToCatalog_異常系_カタログアイテムを追加する権限がない() { + // Arrange + when(this.userStore.isInRole(anyString())).thenReturn(false); + + // Action + Executable action = () -> { + service.addItemToCatalog("テストアイテム", "テスト用のアイテムです。", new BigDecimal(123456), "TEST001", 1, 1); + }; + + // Assert + assertThrows(PermissionDeniedException.class, action); + } + + @Test + void testDeleteItemFromCatalog_正常系_リポジトリのremoveを1回呼出す() + throws CatalogNotFoundException, PermissionDeniedException { + // Arrange + long targetId = 1L; + CatalogItem item = createCatalogItem(targetId); + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + + // Action + this.service.deleteItemFromCatalog(1L); + + // Assert + verify(this.catalogRepository, times(1)).remove(any()); + + } + + @Test + void testDeleteItemFromCatalog_異常系_対象のアイテムが存在しない() { + // Arrange + long targetId = 999L; + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogRepository.findById(anyLong())).thenReturn(null); + + // Action + Executable action = () -> { + this.service.deleteItemFromCatalog(targetId); + }; + + // Assert + assertThrows(CatalogNotFoundException.class, action); + } + + @Test + void testDeleteItemFromCatalog_異常系_カタログアイテムを削除する権限がない() { + // Arrange + long targetId = 1L; + CatalogItem item = createCatalogItem(targetId); + when(this.userStore.isInRole(anyString())).thenReturn(false); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + + // Action + Executable action = () -> { + this.service.deleteItemFromCatalog(1L); + }; + + // Assert + assertThrows(PermissionDeniedException.class, action); + } + + @Test + void testUpdateCatalogItem_正常系_リポジトリのupdateを1回呼出す() throws CatalogNotFoundException, PermissionDeniedException, + CatalogBrandNotFoundException, CatalogCategoryNotFoundException, OptimisticLockingFailureException { + // Arrange + long targetId = 1L; + long brandId = 1L; + long categoryId = 1L; + CatalogItem item = createCatalogItem(targetId); + CatalogBrand brand = createCatalogBrand(brandId); + CatalogCategory category = createCatalogCategory(categoryId); + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + when(this.brandRepository.findById(anyLong())).thenReturn(brand); + when(this.categoryRepository.findById(anyLong())).thenReturn(category); + when(this.catalogRepository.update(any())).thenReturn(1); + + // Action + this.service.updateCatalogItem(1L, "Name", "Description.", BigDecimal.valueOf(100_000_000L), "C000000001", 1L, 1L); + + // Assert + verify(this.catalogRepository, times(1)).update(any()); + } + + @Test + void testUpdateCatalogItem_異常系_対象のアイテムが存在しない() { + // Arrange + long targetId = 999L; + long brandId = 1L; + long categoryId = 1L; + CatalogBrand brand = createCatalogBrand(brandId); + CatalogCategory category = createCatalogCategory(categoryId); + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogRepository.findById(anyLong())).thenReturn(null); + when(this.brandRepository.findById(anyLong())).thenReturn(brand); + when(this.categoryRepository.findById(anyLong())).thenReturn(category); + when(this.catalogRepository.update(any())).thenReturn(1); + + // Action + Executable action = () -> { + this.service.updateCatalogItem(targetId, "Name", "Description.", BigDecimal.valueOf(100_000_000L), "C000000001", + 1L, 1L); + }; + + // Assert + assertThrows(CatalogNotFoundException.class, action); + } + + @Test + void testUpdateCatalogItem_異常系_対象のブランドが存在しない() { + // Arrange + long targetId = 1L; + long categoryId = 1L; + CatalogItem item = createCatalogItem(targetId); + CatalogCategory category = createCatalogCategory(categoryId); + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + when(this.brandRepository.findById(anyLong())).thenReturn(null); + when(this.categoryRepository.findById(anyLong())).thenReturn(category); + when(this.catalogRepository.update(any())).thenReturn(1); + + // Action + Executable action = () -> { + this.service.updateCatalogItem(1L, "Name", "Description.", BigDecimal.valueOf(100_000_000L), "C000000001", 1L, + targetId); + }; + + // Assert + assertThrows(CatalogBrandNotFoundException.class, action); + } + + @Test + void testUpdateCatalogItem_異常系_対象のカテゴリが存在しない() { + // Arrange + long targetId = 1L; + long brandId = 1L; + CatalogItem item = createCatalogItem(targetId); + CatalogBrand brand = createCatalogBrand(brandId); + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + when(this.brandRepository.findById(anyLong())).thenReturn(brand); + when(this.categoryRepository.findById(anyLong())).thenReturn(null); + when(this.catalogRepository.update(any())).thenReturn(1); + + // Action + Executable action = () -> { + this.service.updateCatalogItem(1L, "Name", "Description.", BigDecimal.valueOf(100_000_000L), "C000000001", + targetId, 1L); + }; + + // Assert + assertThrows(CatalogCategoryNotFoundException.class, action); + } + + @Test + void testUpdateCatalogItem_異常系_カタログアイテムを更新する権限がない() { + // Arrange + long targetId = 1L; + long brandId = 1L; + long categoryId = 1L; + CatalogItem item = createCatalogItem(targetId); + CatalogBrand brand = createCatalogBrand(brandId); + CatalogCategory category = createCatalogCategory(categoryId); + when(this.userStore.isInRole(anyString())).thenReturn(false); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + when(this.brandRepository.findById(anyLong())).thenReturn(brand); + when(this.categoryRepository.findById(anyLong())).thenReturn(category); + when(this.catalogRepository.update(any())).thenReturn(1); + + // Action + Executable action = () -> { + this.service.updateCatalogItem(1L, "Name", "Description.", BigDecimal.valueOf(100_000_000L), "C000000001", + 1L, 1L); + }; + + // Assert + assertThrows(PermissionDeniedException.class, action); + } + + @Test + void testUpdateCatalogItem_異常系_楽観ロックエラーにより正常に更新ができない() { + // Arrange + long targetId = 1L; + long brandId = 1L; + long categoryId = 1L; + CatalogItem item = createCatalogItem(targetId); + CatalogBrand brand = createCatalogBrand(brandId); + CatalogCategory category = createCatalogCategory(categoryId); + when(this.userStore.isInRole(anyString())).thenReturn(true); + when(this.catalogRepository.findById(anyLong())).thenReturn(item); + when(this.brandRepository.findById(anyLong())).thenReturn(brand); + when(this.categoryRepository.findById(anyLong())).thenReturn(category); + when(this.catalogRepository.update(any())).thenReturn(0); + + // Action + Executable action = () -> { + this.service.updateCatalogItem(targetId, "Name", "Description.", BigDecimal.valueOf(100_000_000L), "C000000001", + 1L, 1L); + }; + + // Assert + assertThrows(OptimisticLockingFailureException.class, action); } @Test @@ -95,13 +384,13 @@ void setUp() { void testGetCategories_正常系_リポジトリのgetAllを1回呼出す() { // Arrange List catalogCategories = List.of(new CatalogCategory("dummy")); - when(this.catalogCategoryRepository.getAll()).thenReturn(catalogCategories); + when(this.categoryRepository.getAll()).thenReturn(catalogCategories); // Act service.getCategories(); // Assert - verify(this.catalogCategoryRepository, times(1)).getAll(); + verify(this.categoryRepository, times(1)).getAll(); } @@ -119,4 +408,16 @@ private CatalogItem createCatalogItem(long id) { // catalogItem.setId(id); return catalogItem; } + + private CatalogBrand createCatalogBrand(long id) { + String defaultName = "Name"; + CatalogBrand catalogBrand = new CatalogBrand(defaultName); + return catalogBrand; + } + + private CatalogCategory createCatalogCategory(long id) { + String defaultName = "Name"; + CatalogCategory catalogCategory = new CatalogCategory(defaultName); + return catalogCategory; + } } diff --git a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/catalog/CatalogDomainServiceTest.java b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/catalog/CatalogDomainServiceTest.java index 0aa20d338..5cc433985 100644 --- a/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/catalog/CatalogDomainServiceTest.java +++ b/samples/web-csr/dressca-backend/application-core/src/test/java/com/dressca/applicationcore/catalog/CatalogDomainServiceTest.java @@ -8,7 +8,6 @@ import java.math.BigDecimal; import java.util.Arrays; import java.util.List; -import java.util.Random; import java.util.stream.Collectors; import org.apache.commons.lang3.ArrayUtils; import org.junit.jupiter.api.Test; @@ -23,7 +22,11 @@ @ExtendWith(SpringExtension.class) public class CatalogDomainServiceTest { @Mock - private CatalogRepository repository; + private CatalogRepository catalogRepository; + @Mock + private CatalogBrandRepository catalogBrandRepository; + @Mock + private CatalogCategoryRepository catalogCategoryRepository; @InjectMocks private CatalogDomainService service; @@ -34,13 +37,13 @@ public class CatalogDomainServiceTest { List catalogItemIdsList = Arrays.asList(ArrayUtils.toObject(catalogItemIds)); List catalogItems = Arrays.stream(catalogItemIds).mapToObj(this::createCatalogItem) .collect(Collectors.toList()); - when(this.repository.findByCatalogItemIdIn(catalogItemIdsList)).thenReturn(catalogItems); + when(this.catalogRepository.findByCatalogItemIdIn(catalogItemIdsList)).thenReturn(catalogItems); // Act service.getExistCatalogItems(catalogItemIdsList); // Assert - verify(this.repository, times(1)).findByCatalogItemIdIn(catalogItemIdsList); + verify(this.catalogRepository, times(1)).findByCatalogItemIdIn(catalogItemIdsList); } @Test @@ -49,7 +52,7 @@ public class CatalogDomainServiceTest { long[] catalogItemIds = { 2L }; List catalogItems = Arrays.stream(catalogItemIds).mapToObj(this::createCatalogItem) .collect(Collectors.toList()); - when(this.repository.findByCatalogItemIdIn(List.of(1L, 2L))).thenReturn(catalogItems); + when(this.catalogRepository.findByCatalogItemIdIn(List.of(1L, 2L))).thenReturn(catalogItems); // Act List actualItems = service.getExistCatalogItems(List.of(1L, 2L)); @@ -66,13 +69,13 @@ public class CatalogDomainServiceTest { List catalogItemIdsList = Arrays.asList(ArrayUtils.toObject(catalogItemIds)); List catalogItems = Arrays.stream(catalogItemIds).mapToObj(this::createCatalogItem) .collect(Collectors.toList()); - when(this.repository.findByCatalogItemIdIn(catalogItemIdsList)).thenReturn(catalogItems); + when(this.catalogRepository.findByCatalogItemIdIn(catalogItemIdsList)).thenReturn(catalogItems); // Act service.existAll(catalogItemIdsList); // Assert - verify(this.repository, times(1)).findByCatalogItemIdIn(catalogItemIdsList); + verify(this.catalogRepository, times(1)).findByCatalogItemIdIn(catalogItemIdsList); } @Test @@ -82,7 +85,7 @@ public class CatalogDomainServiceTest { List catalogItemIdsList = Arrays.asList(ArrayUtils.toObject(catalogItemIds)); List catalogItems = Arrays.stream(catalogItemIds).mapToObj(this::createCatalogItem) .collect(Collectors.toList()); - when(this.repository.findByCatalogItemIdIn(catalogItemIdsList)).thenReturn(catalogItems); + when(this.catalogRepository.findByCatalogItemIdIn(catalogItemIdsList)).thenReturn(catalogItems); // Act boolean existAll = service.existAll(List.of(1L, 2L)); @@ -97,7 +100,7 @@ public class CatalogDomainServiceTest { long[] catalogItemIds = { 2L }; List catalogItems = Arrays.stream(catalogItemIds).mapToObj(this::createCatalogItem) .collect(Collectors.toList()); - when(this.repository.findByCatalogItemIdIn(List.of(1L, 2L))).thenReturn(catalogItems); + when(this.catalogRepository.findByCatalogItemIdIn(List.of(1L, 2L))).thenReturn(catalogItems); // Act boolean existAll = service.existAll(List.of(1L, 2L)); @@ -112,7 +115,7 @@ public class CatalogDomainServiceTest { long[] catalogItemIds = {}; List catalogItems = Arrays.stream(catalogItemIds).mapToObj(this::createCatalogItem) .collect(Collectors.toList()); - when(this.repository.findByCatalogItemIdIn(List.of(1L, 2L))).thenReturn(catalogItems); + when(this.catalogRepository.findByCatalogItemIdIn(List.of(1L, 2L))).thenReturn(catalogItems); // Act boolean existAll = service.existAll(List.of(1L, 2L)); @@ -122,9 +125,8 @@ public class CatalogDomainServiceTest { } private CatalogItem createCatalogItem(long id) { - Random random = new Random(); - long defaultCatalogCategoryId = random.nextInt(1000); - long defaultCatalogBrandId = random.nextInt(1000); + long defaultCatalogCategoryId = 1L; + long defaultCatalogBrandId = 1L; String defaultDescription = "Description."; String defaultName = "Name"; BigDecimal defaultPrice = BigDecimal.valueOf(100_000_000L); diff --git a/samples/web-csr/dressca-backend/batch/src/test/java/com/dressca/batch/CatalogItemJobTest.java b/samples/web-csr/dressca-backend/batch/src/test/java/com/dressca/batch/CatalogItemJobTest.java index b77ce0668..df646b861 100644 --- a/samples/web-csr/dressca-backend/batch/src/test/java/com/dressca/batch/CatalogItemJobTest.java +++ b/samples/web-csr/dressca-backend/batch/src/test/java/com/dressca/batch/CatalogItemJobTest.java @@ -125,8 +125,8 @@ public void stepTest_10data() throws Exception { private void insertTestData() { for (int i = 0; i < 10; i++) { String insertItem = "insert into catalog_items" - + " (id,name,description,price,product_code,catalog_category_id,catalog_brand_id)" - + " values (?,?,?,1000,'C000000001',1,1)"; + + " (id,name,description,price,product_code,catalog_category_id,catalog_brand_id,row_version)" + + " values (?,?,?,1000,'C000000001',1,1,'2024-01-01 00:00:00')"; String insertItemAsset = "insert into catalog_item_assets (id,asset_code,catalog_item_id)" + " values (?,'dummy',?)"; jdbcTemplate.update(insertItem, 101 + i, "sample" + i, "商品説明" + i); diff --git a/samples/web-csr/dressca-backend/infrastructure/build.gradle b/samples/web-csr/dressca-backend/infrastructure/build.gradle index e82f74e29..0e8133495 100644 --- a/samples/web-csr/dressca-backend/infrastructure/build.gradle +++ b/samples/web-csr/dressca-backend/infrastructure/build.gradle @@ -40,3 +40,80 @@ tasks.named('test') { bootJar.enabled = false jar.enabled = true + +task updateMyBatisGeneratorMapperForOptimisticLocking { + doLast { + + // MyBatis Generator で生成されたマッパーの xml ファイルがあるディレクトリ + def generatedDirectory = 'src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/' + + // 楽観ロック対応させるマッパーの xml ファイルのリスト + def xmlFilePaths = ['CatalogItemMapper.xml'] + + // 楽観ロック制御を行う列名 + def optimisticLockColumn = 'row_version' + // 楽観ロック制御を行う列のDB上のデータ型 + def optimisticLockJdbcType = 'TIMESTAMP' + // エンティティに変換した際の楽観ロック制御を行う列名 + def optimisticLockVariable = toLowerCamelCase(optimisticLockColumn) + + xmlFilePaths.each { path -> + + def xmlFile = file(generatedDirectory + path) + def xmlContent = xmlFile.text + + // 正規表現と置換のペアをリストにまとめる + def replacements = [ + [ /((?:(?!and ${optimisticLockColumn} = \#\{${optimisticLockVariable},jdbcType=${optimisticLockJdbcType}})[\s\S])*?)(<\/if>)/, + "\$1and ${optimisticLockColumn} = #{${optimisticLockVariable},jdbcType=${optimisticLockJdbcType}}\n \$2" ], + [ /()/, + "\$1 and ${optimisticLockColumn} = #{${optimisticLockVariable},jdbcType=${optimisticLockJdbcType}}\n \$2" ], + [ /()/, + "\$1 and ${optimisticLockColumn} = #{${optimisticLockVariable},jdbcType=${optimisticLockJdbcType}}\n \$2" ] + ] + + // 置換処理をループで実行 + replacements.each { pattern, replacement -> + xmlContent = xmlContent.replaceAll(pattern, replacement) + } + + xmlFile.write(xmlContent) + } + } +} + +// スネークケースをローワーキャメルケースに変換するメソッド +String toLowerCamelCase(String snakeCase) { + StringBuilder camelCase = new StringBuilder() + boolean nextCharUpperCase = false + + for (int i = 0; i < snakeCase.length(); i++) { + char currentChar = snakeCase.charAt(i) + + if (currentChar == '_') { + nextCharUpperCase = true + } else { + if (nextCharUpperCase) { + camelCase.append(Character.toUpperCase(currentChar)) + nextCharUpperCase = false + } else { + camelCase.append(currentChar) + } + } + } + + // 最初の文字を小文字にする + if (camelCase.length() > 0) { + camelCase.setCharAt(0, Character.toLowerCase(camelCase.charAt(0))) + } + + return camelCase.toString() +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogBrandRepository.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogBrandRepository.java index 9091f3f7c..d263410c9 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogBrandRepository.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogBrandRepository.java @@ -4,6 +4,7 @@ import java.util.stream.Collectors; import com.dressca.applicationcore.catalog.CatalogBrand; import com.dressca.applicationcore.catalog.CatalogBrandRepository; +import com.dressca.infrastructure.repository.mybatis.generated.entity.CatalogBrandEntity; import com.dressca.infrastructure.repository.mybatis.generated.entity.CatalogBrandEntityExample; import com.dressca.infrastructure.repository.mybatis.generated.mapper.CatalogBrandMapper; import com.dressca.infrastructure.repository.mybatis.translator.EntityTranslator; @@ -28,4 +29,11 @@ public List getAll() { .map(EntityTranslator::catalogBrandEntityTranslate) .collect(Collectors.toList()); } + + @Override + public CatalogBrand findById(long id) { + CatalogBrandEntity entity = catalogBrandMapper.selectByPrimaryKey(id); + CatalogBrand brand = EntityTranslator.catalogBrandEntityTranslate(entity); + return brand; + } } diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogCategoryRepository.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogCategoryRepository.java index 01c857d02..29999374b 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogCategoryRepository.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogCategoryRepository.java @@ -4,6 +4,7 @@ import java.util.stream.Collectors; import com.dressca.applicationcore.catalog.CatalogCategory; import com.dressca.applicationcore.catalog.CatalogCategoryRepository; +import com.dressca.infrastructure.repository.mybatis.generated.entity.CatalogCategoryEntity; import com.dressca.infrastructure.repository.mybatis.generated.entity.CatalogCategoryEntityExample; import com.dressca.infrastructure.repository.mybatis.generated.mapper.CatalogCategoryMapper; import com.dressca.infrastructure.repository.mybatis.translator.EntityTranslator; @@ -29,4 +30,10 @@ public List getAll() { .collect(Collectors.toList()); } + @Override + public CatalogCategory findById(long id) { + CatalogCategoryEntity entity = catalogCategoryMapper.selectByPrimaryKey(id); + CatalogCategory category = EntityTranslator.catalogCategoryEntityTranslate(entity); + return category; + } } diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogRepository.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogRepository.java index ec22d967a..2f941c81d 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogRepository.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/MybatisCatalogRepository.java @@ -2,7 +2,11 @@ import com.dressca.applicationcore.catalog.CatalogItem; import com.dressca.applicationcore.catalog.CatalogRepository; +import com.dressca.infrastructure.repository.mybatis.generated.entity.CatalogItemEntity; +import com.dressca.infrastructure.repository.mybatis.generated.entity.CatalogItemEntityExample; +import com.dressca.infrastructure.repository.mybatis.generated.mapper.CatalogItemMapper; import com.dressca.infrastructure.repository.mybatis.mapper.JoinedCatalogItemMapper; +import com.dressca.infrastructure.repository.mybatis.translator.EntityTranslator; import java.util.List; import lombok.AllArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; @@ -18,6 +22,9 @@ public class MybatisCatalogRepository implements CatalogRepository { @Autowired private JoinedCatalogItemMapper mapper; + @Autowired + private CatalogItemMapper catalogItemMapper; + @Override public List findByCategoryIdIn(List categoryIds) { return mapper.findByCategoryIdIn(categoryIds); @@ -44,4 +51,37 @@ public int countByBrandIdAndCategoryId(long brandId, long categoryId) { public List findWithPaging(int skipRows, int pageSize) { return mapper.findWithPaging(skipRows, pageSize); } + + @Override + public CatalogItem findById(long id) { + return mapper.findById(id); + } + + @Override + public CatalogItem add(CatalogItem item) { + CatalogItemEntity entity = EntityTranslator.createCatalogItemEntity(item); + catalogItemMapper.insert(entity); + return item; + } + + @Override + public int remove(CatalogItem item) { + CatalogItemEntityExample catalogItemExample = new CatalogItemEntityExample(); + catalogItemExample.createCriteria().andIdEqualTo(item.getId()); + return catalogItemMapper.deleteByExample(catalogItemExample); + } + + @Override + public int update(CatalogItem item) { + CatalogItemEntity catalogItemEntity = new CatalogItemEntity(); + catalogItemEntity.setId(item.getId()); + catalogItemEntity.setName(item.getName()); + catalogItemEntity.setDescription(item.getDescription()); + catalogItemEntity.setPrice(item.getPrice()); + catalogItemEntity.setProductCode(item.getProductCode()); + catalogItemEntity.setCatalogCategoryId(item.getCatalogCategoryId()); + catalogItemEntity.setCatalogBrandId(item.getCatalogBrandId()); + catalogItemEntity.setRowVersion(item.getRowVersion()); + return this.catalogItemMapper.updateByPrimaryKey(catalogItemEntity); + } } diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntity.java index 7b0bc3cc7..bead9faee 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntity.java @@ -6,7 +6,7 @@ public class AssetEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column assets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -15,7 +15,7 @@ public class AssetEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column assets.asset_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String assetCode; @@ -24,7 +24,7 @@ public class AssetEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column assets.asset_type * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String assetType; @@ -34,7 +34,7 @@ public class AssetEntity { * * @return the value of assets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -46,7 +46,7 @@ public Long getId() { * * @param id the value for assets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -58,7 +58,7 @@ public void setId(Long id) { * * @return the value of assets.asset_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getAssetCode() { return assetCode; @@ -70,7 +70,7 @@ public String getAssetCode() { * * @param assetCode the value for assets.asset_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setAssetCode(String assetCode) { this.assetCode = assetCode; @@ -82,7 +82,7 @@ public void setAssetCode(String assetCode) { * * @return the value of assets.asset_type * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getAssetType() { return assetType; @@ -94,7 +94,7 @@ public String getAssetType() { * * @param assetType the value for assets.asset_type * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setAssetType(String assetType) { this.assetType = assetType; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntityExample.java index 17a7aa3f7..e0d756497 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/AssetEntityExample.java @@ -8,7 +8,7 @@ public class AssetEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -16,7 +16,7 @@ public class AssetEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -24,7 +24,7 @@ public class AssetEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -32,7 +32,7 @@ public class AssetEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public AssetEntityExample() { oredCriteria = new ArrayList<>(); @@ -42,7 +42,7 @@ public AssetEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -52,7 +52,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -62,7 +62,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -72,7 +72,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -82,7 +82,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -92,7 +92,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -102,7 +102,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -114,7 +114,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -128,7 +128,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -139,7 +139,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -151,7 +151,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -399,7 +399,7 @@ public Criteria andAssetTypeNotBetween(String value1, String value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table assets * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -411,7 +411,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntity.java index efa6d5c92..06488e668 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntity.java @@ -6,7 +6,7 @@ public class BasketEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column baskets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -15,7 +15,7 @@ public class BasketEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column baskets.buyer_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String buyerId; @@ -25,7 +25,7 @@ public class BasketEntity { * * @return the value of baskets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -37,7 +37,7 @@ public Long getId() { * * @param id the value for baskets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -49,7 +49,7 @@ public void setId(Long id) { * * @return the value of baskets.buyer_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getBuyerId() { return buyerId; @@ -61,7 +61,7 @@ public String getBuyerId() { * * @param buyerId the value for baskets.buyer_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setBuyerId(String buyerId) { this.buyerId = buyerId; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntityExample.java index 2938f9fc2..5f76960f0 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketEntityExample.java @@ -8,7 +8,7 @@ public class BasketEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -16,7 +16,7 @@ public class BasketEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -24,7 +24,7 @@ public class BasketEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -32,7 +32,7 @@ public class BasketEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BasketEntityExample() { oredCriteria = new ArrayList<>(); @@ -42,7 +42,7 @@ public BasketEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -52,7 +52,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -62,7 +62,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -72,7 +72,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -82,7 +82,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -92,7 +92,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -102,7 +102,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -114,7 +114,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -128,7 +128,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -139,7 +139,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -151,7 +151,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -329,7 +329,7 @@ public Criteria andBuyerIdNotBetween(String value1, String value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table baskets * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -341,7 +341,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntity.java index bb4ecb454..eb69286db 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntity.java @@ -8,7 +8,7 @@ public class BasketItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column basket_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -17,7 +17,7 @@ public class BasketItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column basket_items.basket_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long basketId; @@ -26,7 +26,7 @@ public class BasketItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column basket_items.catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long catalogItemId; @@ -35,7 +35,7 @@ public class BasketItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column basket_items.unit_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private BigDecimal unitPrice; @@ -44,7 +44,7 @@ public class BasketItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column basket_items.quantity * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Integer quantity; @@ -54,7 +54,7 @@ public class BasketItemEntity { * * @return the value of basket_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -66,7 +66,7 @@ public Long getId() { * * @param id the value for basket_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -78,7 +78,7 @@ public void setId(Long id) { * * @return the value of basket_items.basket_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getBasketId() { return basketId; @@ -90,7 +90,7 @@ public Long getBasketId() { * * @param basketId the value for basket_items.basket_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setBasketId(Long basketId) { this.basketId = basketId; @@ -102,7 +102,7 @@ public void setBasketId(Long basketId) { * * @return the value of basket_items.catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getCatalogItemId() { return catalogItemId; @@ -114,7 +114,7 @@ public Long getCatalogItemId() { * * @param catalogItemId the value for basket_items.catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setCatalogItemId(Long catalogItemId) { this.catalogItemId = catalogItemId; @@ -126,7 +126,7 @@ public void setCatalogItemId(Long catalogItemId) { * * @return the value of basket_items.unit_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BigDecimal getUnitPrice() { return unitPrice; @@ -138,7 +138,7 @@ public BigDecimal getUnitPrice() { * * @param unitPrice the value for basket_items.unit_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setUnitPrice(BigDecimal unitPrice) { this.unitPrice = unitPrice; @@ -150,7 +150,7 @@ public void setUnitPrice(BigDecimal unitPrice) { * * @return the value of basket_items.quantity * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Integer getQuantity() { return quantity; @@ -162,7 +162,7 @@ public Integer getQuantity() { * * @param quantity the value for basket_items.quantity * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setQuantity(Integer quantity) { this.quantity = quantity; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntityExample.java index 75f416517..9ca21a956 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/BasketItemEntityExample.java @@ -9,7 +9,7 @@ public class BasketItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -17,7 +17,7 @@ public class BasketItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -25,7 +25,7 @@ public class BasketItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -33,7 +33,7 @@ public class BasketItemEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BasketItemEntityExample() { oredCriteria = new ArrayList<>(); @@ -43,7 +43,7 @@ public BasketItemEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -53,7 +53,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -63,7 +63,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -73,7 +73,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -83,7 +83,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -93,7 +93,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -103,7 +103,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -115,7 +115,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -129,7 +129,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -140,7 +140,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -152,7 +152,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -500,7 +500,7 @@ public Criteria andQuantityNotBetween(Integer value1, Integer value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table basket_items * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -512,7 +512,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntity.java index 94190e0cd..d48fa6df8 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntity.java @@ -6,7 +6,7 @@ public class CatalogBrandEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_brands.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -15,7 +15,7 @@ public class CatalogBrandEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_brands.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String name; @@ -25,7 +25,7 @@ public class CatalogBrandEntity { * * @return the value of catalog_brands.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -37,7 +37,7 @@ public Long getId() { * * @param id the value for catalog_brands.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -49,7 +49,7 @@ public void setId(Long id) { * * @return the value of catalog_brands.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getName() { return name; @@ -61,7 +61,7 @@ public String getName() { * * @param name the value for catalog_brands.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setName(String name) { this.name = name; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntityExample.java index bf047cba2..d07492b58 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogBrandEntityExample.java @@ -8,7 +8,7 @@ public class CatalogBrandEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -16,7 +16,7 @@ public class CatalogBrandEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -24,7 +24,7 @@ public class CatalogBrandEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -32,7 +32,7 @@ public class CatalogBrandEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public CatalogBrandEntityExample() { oredCriteria = new ArrayList<>(); @@ -42,7 +42,7 @@ public CatalogBrandEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -52,7 +52,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -62,7 +62,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -72,7 +72,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -82,7 +82,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -92,7 +92,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -102,7 +102,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -114,7 +114,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -128,7 +128,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -139,7 +139,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -151,7 +151,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -329,7 +329,7 @@ public Criteria andNameNotBetween(String value1, String value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_brands * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -341,7 +341,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntity.java index 79fa1b183..c9e502f36 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntity.java @@ -6,7 +6,7 @@ public class CatalogCategoryEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_categories.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -15,7 +15,7 @@ public class CatalogCategoryEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_categories.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String name; @@ -25,7 +25,7 @@ public class CatalogCategoryEntity { * * @return the value of catalog_categories.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -37,7 +37,7 @@ public Long getId() { * * @param id the value for catalog_categories.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -49,7 +49,7 @@ public void setId(Long id) { * * @return the value of catalog_categories.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getName() { return name; @@ -61,7 +61,7 @@ public String getName() { * * @param name the value for catalog_categories.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setName(String name) { this.name = name; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntityExample.java index d6ad792d9..09666aa1c 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogCategoryEntityExample.java @@ -8,7 +8,7 @@ public class CatalogCategoryEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -16,7 +16,7 @@ public class CatalogCategoryEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -24,7 +24,7 @@ public class CatalogCategoryEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -32,7 +32,7 @@ public class CatalogCategoryEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public CatalogCategoryEntityExample() { oredCriteria = new ArrayList<>(); @@ -42,7 +42,7 @@ public CatalogCategoryEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -52,7 +52,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -62,7 +62,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -72,7 +72,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -82,7 +82,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -92,7 +92,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -102,7 +102,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -114,7 +114,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -128,7 +128,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -139,7 +139,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -151,7 +151,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -329,7 +329,7 @@ public Criteria andNameNotBetween(String value1, String value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_categories * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -341,7 +341,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntity.java index 627876d8f..f6ea4e9d5 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntity.java @@ -6,7 +6,7 @@ public class CatalogItemAssetEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_item_assets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -15,7 +15,7 @@ public class CatalogItemAssetEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_item_assets.asset_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String assetCode; @@ -24,7 +24,7 @@ public class CatalogItemAssetEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_item_assets.catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long catalogItemId; @@ -34,7 +34,7 @@ public class CatalogItemAssetEntity { * * @return the value of catalog_item_assets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -46,7 +46,7 @@ public Long getId() { * * @param id the value for catalog_item_assets.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -58,7 +58,7 @@ public void setId(Long id) { * * @return the value of catalog_item_assets.asset_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getAssetCode() { return assetCode; @@ -70,7 +70,7 @@ public String getAssetCode() { * * @param assetCode the value for catalog_item_assets.asset_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setAssetCode(String assetCode) { this.assetCode = assetCode; @@ -82,7 +82,7 @@ public void setAssetCode(String assetCode) { * * @return the value of catalog_item_assets.catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getCatalogItemId() { return catalogItemId; @@ -94,7 +94,7 @@ public Long getCatalogItemId() { * * @param catalogItemId the value for catalog_item_assets.catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setCatalogItemId(Long catalogItemId) { this.catalogItemId = catalogItemId; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntityExample.java index 37471973d..b4944e8de 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemAssetEntityExample.java @@ -8,7 +8,7 @@ public class CatalogItemAssetEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -16,7 +16,7 @@ public class CatalogItemAssetEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -24,7 +24,7 @@ public class CatalogItemAssetEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -32,7 +32,7 @@ public class CatalogItemAssetEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public CatalogItemAssetEntityExample() { oredCriteria = new ArrayList<>(); @@ -42,7 +42,7 @@ public CatalogItemAssetEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -52,7 +52,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -62,7 +62,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -72,7 +72,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -82,7 +82,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -92,7 +92,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -102,7 +102,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -114,7 +114,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -128,7 +128,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -139,7 +139,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -151,7 +151,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -389,7 +389,7 @@ public Criteria andCatalogItemIdNotBetween(Long value1, Long value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_item_assets * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -401,7 +401,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntity.java index a5c42d2dc..f26096e23 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntity.java @@ -1,6 +1,7 @@ package com.dressca.infrastructure.repository.mybatis.generated.entity; import java.math.BigDecimal; +import java.time.LocalDateTime; public class CatalogItemEntity { /** @@ -8,7 +9,7 @@ public class CatalogItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ private Long id; @@ -17,7 +18,7 @@ public class CatalogItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_items.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ private String name; @@ -26,7 +27,7 @@ public class CatalogItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_items.description * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ private String description; @@ -35,7 +36,7 @@ public class CatalogItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_items.price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ private BigDecimal price; @@ -44,7 +45,7 @@ public class CatalogItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_items.product_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ private String productCode; @@ -53,7 +54,7 @@ public class CatalogItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_items.catalog_category_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ private Long catalogCategoryId; @@ -62,17 +63,26 @@ public class CatalogItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column catalog_items.catalog_brand_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ private Long catalogBrandId; + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column catalog_items.row_version + * + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 + */ + private LocalDateTime rowVersion; + /** * This method was generated by MyBatis Generator. * This method returns the value of the database column catalog_items.id * * @return the value of catalog_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public Long getId() { return id; @@ -84,7 +94,7 @@ public Long getId() { * * @param id the value for catalog_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setId(Long id) { this.id = id; @@ -96,7 +106,7 @@ public void setId(Long id) { * * @return the value of catalog_items.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public String getName() { return name; @@ -108,7 +118,7 @@ public String getName() { * * @param name the value for catalog_items.name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setName(String name) { this.name = name; @@ -120,7 +130,7 @@ public void setName(String name) { * * @return the value of catalog_items.description * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public String getDescription() { return description; @@ -132,7 +142,7 @@ public String getDescription() { * * @param description the value for catalog_items.description * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setDescription(String description) { this.description = description; @@ -144,7 +154,7 @@ public void setDescription(String description) { * * @return the value of catalog_items.price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public BigDecimal getPrice() { return price; @@ -156,7 +166,7 @@ public BigDecimal getPrice() { * * @param price the value for catalog_items.price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setPrice(BigDecimal price) { this.price = price; @@ -168,7 +178,7 @@ public void setPrice(BigDecimal price) { * * @return the value of catalog_items.product_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public String getProductCode() { return productCode; @@ -180,7 +190,7 @@ public String getProductCode() { * * @param productCode the value for catalog_items.product_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setProductCode(String productCode) { this.productCode = productCode; @@ -192,7 +202,7 @@ public void setProductCode(String productCode) { * * @return the value of catalog_items.catalog_category_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public Long getCatalogCategoryId() { return catalogCategoryId; @@ -204,7 +214,7 @@ public Long getCatalogCategoryId() { * * @param catalogCategoryId the value for catalog_items.catalog_category_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setCatalogCategoryId(Long catalogCategoryId) { this.catalogCategoryId = catalogCategoryId; @@ -216,7 +226,7 @@ public void setCatalogCategoryId(Long catalogCategoryId) { * * @return the value of catalog_items.catalog_brand_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public Long getCatalogBrandId() { return catalogBrandId; @@ -228,9 +238,33 @@ public Long getCatalogBrandId() { * * @param catalogBrandId the value for catalog_items.catalog_brand_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setCatalogBrandId(Long catalogBrandId) { this.catalogBrandId = catalogBrandId; } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column catalog_items.row_version + * + * @return the value of catalog_items.row_version + * + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 + */ + public LocalDateTime getRowVersion() { + return rowVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column catalog_items.row_version + * + * @param rowVersion the value for catalog_items.row_version + * + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 + */ + public void setRowVersion(LocalDateTime rowVersion) { + this.rowVersion = rowVersion; + } } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntityExample.java index 9f8b38664..37ea4a7a2 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/CatalogItemEntityExample.java @@ -1,6 +1,7 @@ package com.dressca.infrastructure.repository.mybatis.generated.entity; import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @@ -9,7 +10,7 @@ public class CatalogItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ protected String orderByClause; @@ -17,7 +18,7 @@ public class CatalogItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ protected boolean distinct; @@ -25,7 +26,7 @@ public class CatalogItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ protected List oredCriteria; @@ -33,7 +34,7 @@ public class CatalogItemEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public CatalogItemEntityExample() { oredCriteria = new ArrayList<>(); @@ -43,7 +44,7 @@ public CatalogItemEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -53,7 +54,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -63,7 +64,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -73,7 +74,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public boolean isDistinct() { return distinct; @@ -83,7 +84,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -93,7 +94,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -103,7 +104,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -115,7 +116,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -129,7 +130,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -140,7 +141,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -152,7 +153,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -644,13 +645,73 @@ public Criteria andCatalogBrandIdNotBetween(Long value1, Long value2) { addCriterion("catalog_brand_id not between", value1, value2, "catalogBrandId"); return (Criteria) this; } + + public Criteria andRowVersionIsNull() { + addCriterion("row_version is null"); + return (Criteria) this; + } + + public Criteria andRowVersionIsNotNull() { + addCriterion("row_version is not null"); + return (Criteria) this; + } + + public Criteria andRowVersionEqualTo(LocalDateTime value) { + addCriterion("row_version =", value, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionNotEqualTo(LocalDateTime value) { + addCriterion("row_version <>", value, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionGreaterThan(LocalDateTime value) { + addCriterion("row_version >", value, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionGreaterThanOrEqualTo(LocalDateTime value) { + addCriterion("row_version >=", value, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionLessThan(LocalDateTime value) { + addCriterion("row_version <", value, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionLessThanOrEqualTo(LocalDateTime value) { + addCriterion("row_version <=", value, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionIn(List values) { + addCriterion("row_version in", values, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionNotIn(List values) { + addCriterion("row_version not in", values, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("row_version between", value1, value2, "rowVersion"); + return (Criteria) this; + } + + public Criteria andRowVersionNotBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("row_version not between", value1, value2, "rowVersion"); + return (Criteria) this; + } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_items * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Fri Nov 01 11:41:58 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -662,7 +723,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Fri Nov 01 11:41:58 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntity.java index 18d529a15..c77b52ebe 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntity.java @@ -9,7 +9,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -18,7 +18,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.buyer_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String buyerId; @@ -27,7 +27,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.order_date * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Date orderDate; @@ -36,7 +36,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.ship_to_full_name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String shipToFullName; @@ -45,7 +45,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.ship_to_postal_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String shipToPostalCode; @@ -54,7 +54,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.ship_to_todofuken * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String shipToTodofuken; @@ -63,7 +63,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.ship_to_shikuchoson * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String shipToShikuchoson; @@ -72,7 +72,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.ship_to_azana_and_others * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String shipToAzanaAndOthers; @@ -81,7 +81,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.consumption_tax_rate * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private BigDecimal consumptionTaxRate; @@ -90,7 +90,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.total_items_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private BigDecimal totalItemsPrice; @@ -99,7 +99,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.delivery_charge * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private BigDecimal deliveryCharge; @@ -108,7 +108,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.consumption_tax * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private BigDecimal consumptionTax; @@ -117,7 +117,7 @@ public class OrderEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column orders.total_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private BigDecimal totalPrice; @@ -127,7 +127,7 @@ public class OrderEntity { * * @return the value of orders.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -139,7 +139,7 @@ public Long getId() { * * @param id the value for orders.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -151,7 +151,7 @@ public void setId(Long id) { * * @return the value of orders.buyer_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getBuyerId() { return buyerId; @@ -163,7 +163,7 @@ public String getBuyerId() { * * @param buyerId the value for orders.buyer_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setBuyerId(String buyerId) { this.buyerId = buyerId; @@ -175,7 +175,7 @@ public void setBuyerId(String buyerId) { * * @return the value of orders.order_date * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Date getOrderDate() { return orderDate; @@ -187,7 +187,7 @@ public Date getOrderDate() { * * @param orderDate the value for orders.order_date * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderDate(Date orderDate) { this.orderDate = orderDate; @@ -199,7 +199,7 @@ public void setOrderDate(Date orderDate) { * * @return the value of orders.ship_to_full_name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getShipToFullName() { return shipToFullName; @@ -211,7 +211,7 @@ public String getShipToFullName() { * * @param shipToFullName the value for orders.ship_to_full_name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setShipToFullName(String shipToFullName) { this.shipToFullName = shipToFullName; @@ -223,7 +223,7 @@ public void setShipToFullName(String shipToFullName) { * * @return the value of orders.ship_to_postal_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getShipToPostalCode() { return shipToPostalCode; @@ -235,7 +235,7 @@ public String getShipToPostalCode() { * * @param shipToPostalCode the value for orders.ship_to_postal_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setShipToPostalCode(String shipToPostalCode) { this.shipToPostalCode = shipToPostalCode; @@ -247,7 +247,7 @@ public void setShipToPostalCode(String shipToPostalCode) { * * @return the value of orders.ship_to_todofuken * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getShipToTodofuken() { return shipToTodofuken; @@ -259,7 +259,7 @@ public String getShipToTodofuken() { * * @param shipToTodofuken the value for orders.ship_to_todofuken * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setShipToTodofuken(String shipToTodofuken) { this.shipToTodofuken = shipToTodofuken; @@ -271,7 +271,7 @@ public void setShipToTodofuken(String shipToTodofuken) { * * @return the value of orders.ship_to_shikuchoson * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getShipToShikuchoson() { return shipToShikuchoson; @@ -283,7 +283,7 @@ public String getShipToShikuchoson() { * * @param shipToShikuchoson the value for orders.ship_to_shikuchoson * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setShipToShikuchoson(String shipToShikuchoson) { this.shipToShikuchoson = shipToShikuchoson; @@ -295,7 +295,7 @@ public void setShipToShikuchoson(String shipToShikuchoson) { * * @return the value of orders.ship_to_azana_and_others * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getShipToAzanaAndOthers() { return shipToAzanaAndOthers; @@ -307,7 +307,7 @@ public String getShipToAzanaAndOthers() { * * @param shipToAzanaAndOthers the value for orders.ship_to_azana_and_others * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setShipToAzanaAndOthers(String shipToAzanaAndOthers) { this.shipToAzanaAndOthers = shipToAzanaAndOthers; @@ -319,7 +319,7 @@ public void setShipToAzanaAndOthers(String shipToAzanaAndOthers) { * * @return the value of orders.consumption_tax_rate * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BigDecimal getConsumptionTaxRate() { return consumptionTaxRate; @@ -331,7 +331,7 @@ public BigDecimal getConsumptionTaxRate() { * * @param consumptionTaxRate the value for orders.consumption_tax_rate * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setConsumptionTaxRate(BigDecimal consumptionTaxRate) { this.consumptionTaxRate = consumptionTaxRate; @@ -343,7 +343,7 @@ public void setConsumptionTaxRate(BigDecimal consumptionTaxRate) { * * @return the value of orders.total_items_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BigDecimal getTotalItemsPrice() { return totalItemsPrice; @@ -355,7 +355,7 @@ public BigDecimal getTotalItemsPrice() { * * @param totalItemsPrice the value for orders.total_items_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setTotalItemsPrice(BigDecimal totalItemsPrice) { this.totalItemsPrice = totalItemsPrice; @@ -367,7 +367,7 @@ public void setTotalItemsPrice(BigDecimal totalItemsPrice) { * * @return the value of orders.delivery_charge * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BigDecimal getDeliveryCharge() { return deliveryCharge; @@ -379,7 +379,7 @@ public BigDecimal getDeliveryCharge() { * * @param deliveryCharge the value for orders.delivery_charge * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDeliveryCharge(BigDecimal deliveryCharge) { this.deliveryCharge = deliveryCharge; @@ -391,7 +391,7 @@ public void setDeliveryCharge(BigDecimal deliveryCharge) { * * @return the value of orders.consumption_tax * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BigDecimal getConsumptionTax() { return consumptionTax; @@ -403,7 +403,7 @@ public BigDecimal getConsumptionTax() { * * @param consumptionTax the value for orders.consumption_tax * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setConsumptionTax(BigDecimal consumptionTax) { this.consumptionTax = consumptionTax; @@ -415,7 +415,7 @@ public void setConsumptionTax(BigDecimal consumptionTax) { * * @return the value of orders.total_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BigDecimal getTotalPrice() { return totalPrice; @@ -427,7 +427,7 @@ public BigDecimal getTotalPrice() { * * @param totalPrice the value for orders.total_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setTotalPrice(BigDecimal totalPrice) { this.totalPrice = totalPrice; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntityExample.java index 48b547dd1..de1bb0fdd 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderEntityExample.java @@ -10,7 +10,7 @@ public class OrderEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -18,7 +18,7 @@ public class OrderEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -26,7 +26,7 @@ public class OrderEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -34,7 +34,7 @@ public class OrderEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public OrderEntityExample() { oredCriteria = new ArrayList<>(); @@ -44,7 +44,7 @@ public OrderEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -54,7 +54,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -64,7 +64,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -74,7 +74,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -84,7 +84,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -94,7 +94,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -104,7 +104,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -116,7 +116,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -130,7 +130,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -141,7 +141,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -153,7 +153,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -1041,7 +1041,7 @@ public Criteria andTotalPriceNotBetween(BigDecimal value1, BigDecimal value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table orders * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -1053,7 +1053,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntity.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntity.java index 95d87e55d..97cb995be 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntity.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntity.java @@ -8,7 +8,7 @@ public class OrderItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column order_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long id; @@ -17,7 +17,7 @@ public class OrderItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column order_items.ordered_catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long orderedCatalogItemId; @@ -26,7 +26,7 @@ public class OrderItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column order_items.ordered_product_name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String orderedProductName; @@ -35,7 +35,7 @@ public class OrderItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column order_items.ordered_product_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private String orderedProductCode; @@ -44,7 +44,7 @@ public class OrderItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column order_items.unit_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private BigDecimal unitPrice; @@ -53,7 +53,7 @@ public class OrderItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column order_items.quantity * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Integer quantity; @@ -62,7 +62,7 @@ public class OrderItemEntity { * This field was generated by MyBatis Generator. * This field corresponds to the database column order_items.order_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ private Long orderId; @@ -72,7 +72,7 @@ public class OrderItemEntity { * * @return the value of order_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getId() { return id; @@ -84,7 +84,7 @@ public Long getId() { * * @param id the value for order_items.id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setId(Long id) { this.id = id; @@ -96,7 +96,7 @@ public void setId(Long id) { * * @return the value of order_items.ordered_catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getOrderedCatalogItemId() { return orderedCatalogItemId; @@ -108,7 +108,7 @@ public Long getOrderedCatalogItemId() { * * @param orderedCatalogItemId the value for order_items.ordered_catalog_item_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderedCatalogItemId(Long orderedCatalogItemId) { this.orderedCatalogItemId = orderedCatalogItemId; @@ -120,7 +120,7 @@ public void setOrderedCatalogItemId(Long orderedCatalogItemId) { * * @return the value of order_items.ordered_product_name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderedProductName() { return orderedProductName; @@ -132,7 +132,7 @@ public String getOrderedProductName() { * * @param orderedProductName the value for order_items.ordered_product_name * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderedProductName(String orderedProductName) { this.orderedProductName = orderedProductName; @@ -144,7 +144,7 @@ public void setOrderedProductName(String orderedProductName) { * * @return the value of order_items.ordered_product_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderedProductCode() { return orderedProductCode; @@ -156,7 +156,7 @@ public String getOrderedProductCode() { * * @param orderedProductCode the value for order_items.ordered_product_code * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderedProductCode(String orderedProductCode) { this.orderedProductCode = orderedProductCode; @@ -168,7 +168,7 @@ public void setOrderedProductCode(String orderedProductCode) { * * @return the value of order_items.unit_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public BigDecimal getUnitPrice() { return unitPrice; @@ -180,7 +180,7 @@ public BigDecimal getUnitPrice() { * * @param unitPrice the value for order_items.unit_price * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setUnitPrice(BigDecimal unitPrice) { this.unitPrice = unitPrice; @@ -192,7 +192,7 @@ public void setUnitPrice(BigDecimal unitPrice) { * * @return the value of order_items.quantity * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Integer getQuantity() { return quantity; @@ -204,7 +204,7 @@ public Integer getQuantity() { * * @param quantity the value for order_items.quantity * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setQuantity(Integer quantity) { this.quantity = quantity; @@ -216,7 +216,7 @@ public void setQuantity(Integer quantity) { * * @return the value of order_items.order_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Long getOrderId() { return orderId; @@ -228,7 +228,7 @@ public Long getOrderId() { * * @param orderId the value for order_items.order_id * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderId(Long orderId) { this.orderId = orderId; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntityExample.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntityExample.java index c45755dde..35d96f103 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntityExample.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/entity/OrderItemEntityExample.java @@ -9,7 +9,7 @@ public class OrderItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected String orderByClause; @@ -17,7 +17,7 @@ public class OrderItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected boolean distinct; @@ -25,7 +25,7 @@ public class OrderItemEntityExample { * This field was generated by MyBatis Generator. * This field corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected List oredCriteria; @@ -33,7 +33,7 @@ public class OrderItemEntityExample { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public OrderItemEntityExample() { oredCriteria = new ArrayList<>(); @@ -43,7 +43,7 @@ public OrderItemEntityExample() { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; @@ -53,7 +53,7 @@ public void setOrderByClause(String orderByClause) { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public String getOrderByClause() { return orderByClause; @@ -63,7 +63,7 @@ public String getOrderByClause() { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void setDistinct(boolean distinct) { this.distinct = distinct; @@ -73,7 +73,7 @@ public void setDistinct(boolean distinct) { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public boolean isDistinct() { return distinct; @@ -83,7 +83,7 @@ public boolean isDistinct() { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public List getOredCriteria() { return oredCriteria; @@ -93,7 +93,7 @@ public List getOredCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void or(Criteria criteria) { oredCriteria.add(criteria); @@ -103,7 +103,7 @@ public void or(Criteria criteria) { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); @@ -115,7 +115,7 @@ public Criteria or() { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); @@ -129,7 +129,7 @@ public Criteria createCriteria() { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); @@ -140,7 +140,7 @@ protected Criteria createCriteriaInternal() { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public void clear() { oredCriteria.clear(); @@ -152,7 +152,7 @@ public void clear() { * This class was generated by MyBatis Generator. * This class corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ protected abstract static class GeneratedCriteria { protected List criteria; @@ -640,7 +640,7 @@ public Criteria andOrderIdNotBetween(Long value1, Long value2) { * This class was generated by MyBatis Generator. * This class corresponds to the database table order_items * - * @mbg.generated do_not_delete_during_merge Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated do_not_delete_during_merge Thu Oct 10 11:25:17 JST 2024 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { @@ -652,7 +652,7 @@ protected Criteria() { * This class was generated by MyBatis Generator. * This class corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ public static class Criterion { private String condition; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.java index 03cc4807c..058a223e5 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.java @@ -12,7 +12,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(AssetEntityExample example); @@ -20,7 +20,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(AssetEntityExample example); @@ -28,7 +28,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(AssetEntity row); @@ -44,7 +44,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(AssetEntity row); @@ -52,7 +52,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(AssetEntityExample example); @@ -60,7 +60,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ AssetEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") AssetEntity row, @Param("example") AssetEntityExample example); @@ -76,7 +76,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") AssetEntity row, @Param("example") AssetEntityExample example); @@ -84,7 +84,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(AssetEntity row); @@ -92,7 +92,7 @@ public interface AssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(AssetEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.java index 451fe44b9..8fde6608a 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.java @@ -12,7 +12,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(BasketItemEntityExample example); @@ -20,7 +20,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(BasketItemEntityExample example); @@ -28,7 +28,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(BasketItemEntity row); @@ -44,7 +44,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(BasketItemEntity row); @@ -52,7 +52,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(BasketItemEntityExample example); @@ -60,7 +60,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ BasketItemEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") BasketItemEntity row, @Param("example") BasketItemEntityExample example); @@ -76,7 +76,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") BasketItemEntity row, @Param("example") BasketItemEntityExample example); @@ -84,7 +84,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(BasketItemEntity row); @@ -92,7 +92,7 @@ public interface BasketItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table basket_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(BasketItemEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.java index 33f293120..651fb3066 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.java @@ -12,7 +12,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(BasketEntityExample example); @@ -20,7 +20,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(BasketEntityExample example); @@ -28,7 +28,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(BasketEntity row); @@ -44,7 +44,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(BasketEntity row); @@ -52,7 +52,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(BasketEntityExample example); @@ -60,7 +60,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ BasketEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") BasketEntity row, @Param("example") BasketEntityExample example); @@ -76,7 +76,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") BasketEntity row, @Param("example") BasketEntityExample example); @@ -84,7 +84,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(BasketEntity row); @@ -92,7 +92,7 @@ public interface BasketMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table baskets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(BasketEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.java index f92bcda0d..249f2da53 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.java @@ -12,7 +12,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(CatalogBrandEntityExample example); @@ -20,7 +20,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(CatalogBrandEntityExample example); @@ -28,7 +28,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(CatalogBrandEntity row); @@ -44,7 +44,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(CatalogBrandEntity row); @@ -52,7 +52,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(CatalogBrandEntityExample example); @@ -60,7 +60,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ CatalogBrandEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") CatalogBrandEntity row, @Param("example") CatalogBrandEntityExample example); @@ -76,7 +76,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") CatalogBrandEntity row, @Param("example") CatalogBrandEntityExample example); @@ -84,7 +84,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(CatalogBrandEntity row); @@ -92,7 +92,7 @@ public interface CatalogBrandMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_brands * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(CatalogBrandEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.java index d3bd0fac7..2eb65aa42 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.java @@ -12,7 +12,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(CatalogCategoryEntityExample example); @@ -20,7 +20,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(CatalogCategoryEntityExample example); @@ -28,7 +28,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(CatalogCategoryEntity row); @@ -44,7 +44,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(CatalogCategoryEntity row); @@ -52,7 +52,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(CatalogCategoryEntityExample example); @@ -60,7 +60,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ CatalogCategoryEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") CatalogCategoryEntity row, @Param("example") CatalogCategoryEntityExample example); @@ -76,7 +76,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") CatalogCategoryEntity row, @Param("example") CatalogCategoryEntityExample example); @@ -84,7 +84,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(CatalogCategoryEntity row); @@ -92,7 +92,7 @@ public interface CatalogCategoryMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_categories * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(CatalogCategoryEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.java index f1ddebea4..f23506499 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.java @@ -12,7 +12,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(CatalogItemAssetEntityExample example); @@ -20,7 +20,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(CatalogItemAssetEntityExample example); @@ -28,7 +28,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(CatalogItemAssetEntity row); @@ -44,7 +44,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(CatalogItemAssetEntity row); @@ -52,7 +52,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(CatalogItemAssetEntityExample example); @@ -60,7 +60,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ CatalogItemAssetEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") CatalogItemAssetEntity row, @Param("example") CatalogItemAssetEntityExample example); @@ -76,7 +76,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") CatalogItemAssetEntity row, @Param("example") CatalogItemAssetEntityExample example); @@ -84,7 +84,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(CatalogItemAssetEntity row); @@ -92,7 +92,7 @@ public interface CatalogItemAssetMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_item_assets * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(CatalogItemAssetEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.java index d9fcb4612..387f7b801 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.java @@ -12,7 +12,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(CatalogItemEntityExample example); @@ -20,7 +20,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(CatalogItemEntityExample example); @@ -28,7 +28,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(CatalogItemEntity row); @@ -44,7 +44,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(CatalogItemEntity row); @@ -52,7 +52,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(CatalogItemEntityExample example); @@ -60,7 +60,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ CatalogItemEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") CatalogItemEntity row, @Param("example") CatalogItemEntityExample example); @@ -76,7 +76,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") CatalogItemEntity row, @Param("example") CatalogItemEntityExample example); @@ -84,7 +84,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(CatalogItemEntity row); @@ -92,7 +92,7 @@ public interface CatalogItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table catalog_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(CatalogItemEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.java index f146c1d03..57a0a37cd 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.java @@ -12,7 +12,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(OrderItemEntityExample example); @@ -20,7 +20,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(OrderItemEntityExample example); @@ -28,7 +28,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(OrderItemEntity row); @@ -44,7 +44,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(OrderItemEntity row); @@ -52,7 +52,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(OrderItemEntityExample example); @@ -60,7 +60,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ OrderItemEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") OrderItemEntity row, @Param("example") OrderItemEntityExample example); @@ -76,7 +76,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") OrderItemEntity row, @Param("example") OrderItemEntityExample example); @@ -84,7 +84,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(OrderItemEntity row); @@ -92,7 +92,7 @@ public interface OrderItemMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table order_items * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(OrderItemEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.java index d1089bd29..9698db1ae 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.java @@ -12,7 +12,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ long countByExample(OrderEntityExample example); @@ -20,7 +20,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByExample(OrderEntityExample example); @@ -28,7 +28,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int deleteByPrimaryKey(Long id); @@ -36,7 +36,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insert(OrderEntity row); @@ -44,7 +44,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int insertSelective(OrderEntity row); @@ -52,7 +52,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ List selectByExample(OrderEntityExample example); @@ -60,7 +60,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ OrderEntity selectByPrimaryKey(Long id); @@ -68,7 +68,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExampleSelective(@Param("row") OrderEntity row, @Param("example") OrderEntityExample example); @@ -76,7 +76,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByExample(@Param("row") OrderEntity row, @Param("example") OrderEntityExample example); @@ -84,7 +84,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKeySelective(OrderEntity row); @@ -92,7 +92,7 @@ public interface OrderMapper { * This method was generated by MyBatis Generator. * This method corresponds to the database table orders * - * @mbg.generated Mon Feb 19 14:48:46 JST 2024 + * @mbg.generated Thu Oct 10 11:25:17 JST 2024 */ int updateByPrimaryKey(OrderEntity row); } \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.java index eb412511f..0df40f8bb 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.java @@ -22,4 +22,6 @@ int countByBrandIdAndCategoryId(@Param("brandId") long brandId, @Param("categoryId") long categoryId); List findWithPaging(@Param("_skiprows") int skipRows, @Param("_pagesize") int pageSize); + + CatalogItem findById(@Param("id") long id); } diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.xml index 8c134f741..7fd81c0d9 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/mapper/JoinedCatalogItemMapper.xml @@ -23,11 +23,12 @@ CATALOG_ITEMS.PRODUCT_CODE, CATALOG_ITEMS.CATALOG_CATEGORY_ID, CATALOG_ITEMS.CATALOG_BRAND_ID, + CATALOG_ITEMS.ROW_VERSION, ASSETS.ID, ASSETS.CATALOG_ITEM_ID, ASSETS.ASSET_CODE FROM CATALOG_ITEMS - INNER JOIN CATALOG_ITEM_ASSETS AS ASSETS ON ( + LEFT OUTER JOIN CATALOG_ITEM_ASSETS AS ASSETS ON ( CATALOG_ITEMS.ID = ASSETS.CATALOG_ITEM_ID ) @@ -40,6 +41,7 @@ + @@ -96,4 +98,10 @@ LIMIT #{_skiprows}, #{_pagesize} + \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/translator/EntityTranslator.java b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/translator/EntityTranslator.java index d77cb7806..92fbecb80 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/translator/EntityTranslator.java +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/java/com/dressca/infrastructure/repository/mybatis/translator/EntityTranslator.java @@ -121,6 +121,18 @@ public static CatalogItem catalogItemEntityTranslate(CatalogItemEntity entity) { return catalogItem; } + /** + * ドメインオブジェクトから {@link CatalogItemEntity} オブジェクトを変換します。 + * + * @param catalogItem {@link CatalogItem} オブジェクト + * @return {@link CatalogItemEntity} オブジェクト + */ + public static CatalogItemEntity createCatalogItemEntity(CatalogItem catalogItem) { + CatalogItemEntity entity = new CatalogItemEntity(); + BeanUtils.copyProperties(catalogItem, entity); + return entity; + } + /** * {@link CatalogItemAssetEntity} をドメインオブジェクトに変換します。 * diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.xml index 37ccc79f8..6d28617e5 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/AssetMapper.xml @@ -5,7 +5,7 @@ @@ -15,7 +15,7 @@ @@ -49,7 +49,7 @@ @@ -83,7 +83,7 @@ id, asset_code, asset_type @@ -91,7 +91,7 @@ select @@ -110,7 +110,7 @@ select @@ -121,7 +121,7 @@ delete from assets where id = #{id,jdbcType=BIGINT} @@ -130,7 +130,7 @@ delete from assets @@ -141,7 +141,7 @@ insert into assets (asset_code, asset_type) values (#{assetCode,jdbcType=VARCHAR}, #{assetType,jdbcType=VARCHAR}) @@ -150,7 +150,7 @@ insert into assets @@ -174,7 +174,7 @@ select count(*) from assets @@ -185,7 +185,7 @@ update assets @@ -207,7 +207,7 @@ update assets set id = #{row.id,jdbcType=BIGINT}, @@ -221,7 +221,7 @@ update assets @@ -238,7 +238,7 @@ update assets set asset_code = #{assetCode,jdbcType=VARCHAR}, diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.xml index c03cc0ed1..977ee2fbe 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketItemMapper.xml @@ -5,7 +5,7 @@ @@ -17,7 +17,7 @@ @@ -51,7 +51,7 @@ @@ -85,7 +85,7 @@ id, basket_id, catalog_item_id, unit_price, quantity @@ -93,7 +93,7 @@ select @@ -112,7 +112,7 @@ select @@ -123,7 +123,7 @@ delete from basket_items where id = #{id,jdbcType=BIGINT} @@ -132,7 +132,7 @@ delete from basket_items @@ -143,7 +143,7 @@ insert into basket_items (basket_id, catalog_item_id, unit_price, quantity) @@ -154,7 +154,7 @@ insert into basket_items @@ -190,7 +190,7 @@ select count(*) from basket_items @@ -201,7 +201,7 @@ update basket_items @@ -229,7 +229,7 @@ update basket_items set id = #{row.id,jdbcType=BIGINT}, @@ -245,7 +245,7 @@ update basket_items @@ -268,7 +268,7 @@ update basket_items set basket_id = #{basketId,jdbcType=BIGINT}, diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.xml index 468ec6f2d..171a732ba 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/BasketMapper.xml @@ -5,7 +5,7 @@ @@ -14,7 +14,7 @@ @@ -48,7 +48,7 @@ @@ -82,7 +82,7 @@ id, buyer_id @@ -90,7 +90,7 @@ select @@ -109,7 +109,7 @@ select @@ -120,7 +120,7 @@ delete from baskets where id = #{id,jdbcType=BIGINT} @@ -129,7 +129,7 @@ delete from baskets @@ -140,7 +140,7 @@ insert into baskets (buyer_id) values (#{buyerId,jdbcType=VARCHAR}) @@ -149,7 +149,7 @@ insert into baskets @@ -167,7 +167,7 @@ select count(*) from baskets @@ -178,7 +178,7 @@ update baskets @@ -197,7 +197,7 @@ update baskets set id = #{row.id,jdbcType=BIGINT}, @@ -210,7 +210,7 @@ update baskets @@ -224,7 +224,7 @@ update baskets set buyer_id = #{buyerId,jdbcType=VARCHAR} diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.xml index 709d10881..0f3acb10d 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogBrandMapper.xml @@ -5,7 +5,7 @@ @@ -14,7 +14,7 @@ @@ -48,7 +48,7 @@ @@ -82,7 +82,7 @@ id, name @@ -90,7 +90,7 @@ select @@ -109,7 +109,7 @@ select @@ -120,7 +120,7 @@ delete from catalog_brands where id = #{id,jdbcType=BIGINT} @@ -129,7 +129,7 @@ delete from catalog_brands @@ -140,7 +140,7 @@ insert into catalog_brands (name) values (#{name,jdbcType=VARCHAR}) @@ -149,7 +149,7 @@ insert into catalog_brands @@ -167,7 +167,7 @@ select count(*) from catalog_brands @@ -178,7 +178,7 @@ update catalog_brands @@ -197,7 +197,7 @@ update catalog_brands set id = #{row.id,jdbcType=BIGINT}, @@ -210,7 +210,7 @@ update catalog_brands @@ -224,7 +224,7 @@ update catalog_brands set name = #{name,jdbcType=VARCHAR} diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.xml index b6da7b2dd..7f333d0e3 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogCategoryMapper.xml @@ -5,7 +5,7 @@ @@ -14,7 +14,7 @@ @@ -48,7 +48,7 @@ @@ -82,7 +82,7 @@ id, name @@ -90,7 +90,7 @@ select @@ -109,7 +109,7 @@ select @@ -120,7 +120,7 @@ delete from catalog_categories where id = #{id,jdbcType=BIGINT} @@ -129,7 +129,7 @@ delete from catalog_categories @@ -140,7 +140,7 @@ insert into catalog_categories (name) values (#{name,jdbcType=VARCHAR}) @@ -149,7 +149,7 @@ insert into catalog_categories @@ -167,7 +167,7 @@ select count(*) from catalog_categories @@ -178,7 +178,7 @@ update catalog_categories @@ -197,7 +197,7 @@ update catalog_categories set id = #{row.id,jdbcType=BIGINT}, @@ -210,7 +210,7 @@ update catalog_categories @@ -224,7 +224,7 @@ update catalog_categories set name = #{name,jdbcType=VARCHAR} diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.xml index 10db09645..0751a7395 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemAssetMapper.xml @@ -5,7 +5,7 @@ @@ -15,7 +15,7 @@ @@ -49,7 +49,7 @@ @@ -83,7 +83,7 @@ id, asset_code, catalog_item_id @@ -91,7 +91,7 @@ select @@ -110,7 +110,7 @@ select @@ -121,7 +121,7 @@ delete from catalog_item_assets where id = #{id,jdbcType=BIGINT} @@ -130,7 +130,7 @@ delete from catalog_item_assets @@ -141,7 +141,7 @@ insert into catalog_item_assets (asset_code, catalog_item_id) values (#{assetCode,jdbcType=VARCHAR}, #{catalogItemId,jdbcType=BIGINT}) @@ -150,7 +150,7 @@ insert into catalog_item_assets @@ -174,7 +174,7 @@ select count(*) from catalog_item_assets @@ -185,7 +185,7 @@ update catalog_item_assets @@ -207,7 +207,7 @@ update catalog_item_assets set id = #{row.id,jdbcType=BIGINT}, @@ -221,7 +221,7 @@ update catalog_item_assets @@ -238,7 +238,7 @@ update catalog_item_assets set asset_code = #{assetCode,jdbcType=VARCHAR}, diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.xml index 3172794c4..70ac87602 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/CatalogItemMapper.xml @@ -5,7 +5,7 @@ @@ -14,12 +14,13 @@ + @@ -53,7 +54,7 @@ @@ -79,6 +80,7 @@ + and row_version = #{rowVersion,jdbcType=TIMESTAMP} @@ -87,15 +89,16 @@ - id, name, description, price, product_code, catalog_category_id, catalog_brand_id + id, name, description, price, product_code, catalog_category_id, catalog_brand_id, + row_version select count(*) from catalog_items @@ -217,7 +226,7 @@ update catalog_items @@ -242,6 +251,9 @@ catalog_brand_id = #{row.catalogBrandId,jdbcType=BIGINT}, + + row_version = CURRENT_TIMESTAMP, + @@ -251,7 +263,7 @@ update catalog_items set id = #{row.id,jdbcType=BIGINT}, @@ -260,7 +272,8 @@ price = #{row.price,jdbcType=NUMERIC}, product_code = #{row.productCode,jdbcType=VARCHAR}, catalog_category_id = #{row.catalogCategoryId,jdbcType=BIGINT}, - catalog_brand_id = #{row.catalogBrandId,jdbcType=BIGINT} + catalog_brand_id = #{row.catalogBrandId,jdbcType=BIGINT}, + row_version = CURRENT_TIMESTAMP @@ -269,7 +282,7 @@ update catalog_items @@ -291,14 +304,18 @@ catalog_brand_id = #{catalogBrandId,jdbcType=BIGINT}, + + row_version = CURRENT_TIMESTAMP, + where id = #{id,jdbcType=BIGINT} + and row_version = #{rowVersion,jdbcType=TIMESTAMP} update catalog_items set name = #{name,jdbcType=VARCHAR}, @@ -306,7 +323,9 @@ price = #{price,jdbcType=NUMERIC}, product_code = #{productCode,jdbcType=VARCHAR}, catalog_category_id = #{catalogCategoryId,jdbcType=BIGINT}, - catalog_brand_id = #{catalogBrandId,jdbcType=BIGINT} + catalog_brand_id = #{catalogBrandId,jdbcType=BIGINT}, + row_version = CURRENT_TIMESTAMP where id = #{id,jdbcType=BIGINT} + and row_version = #{rowVersion,jdbcType=TIMESTAMP} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.xml index 2d196c65f..6b9e03695 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderItemMapper.xml @@ -5,7 +5,7 @@ @@ -19,7 +19,7 @@ @@ -53,7 +53,7 @@ @@ -87,7 +87,7 @@ id, ordered_catalog_item_id, ordered_product_name, ordered_product_code, unit_price, quantity, order_id @@ -96,7 +96,7 @@ select @@ -115,7 +115,7 @@ select @@ -126,7 +126,7 @@ delete from order_items where id = #{id,jdbcType=BIGINT} @@ -135,7 +135,7 @@ delete from order_items @@ -146,7 +146,7 @@ insert into order_items (ordered_catalog_item_id, ordered_product_name, ordered_product_code, unit_price, quantity, @@ -159,7 +159,7 @@ insert into order_items @@ -207,7 +207,7 @@ select count(*) from order_items @@ -218,7 +218,7 @@ update order_items @@ -252,7 +252,7 @@ update order_items set id = #{row.id,jdbcType=BIGINT}, @@ -270,7 +270,7 @@ update order_items @@ -299,7 +299,7 @@ update order_items set ordered_catalog_item_id = #{orderedCatalogItemId,jdbcType=BIGINT}, diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.xml index fe1b72478..e351e6677 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/com/dressca/infrastructure/repository/mybatis/generated/mapper/OrderMapper.xml @@ -5,7 +5,7 @@ @@ -25,7 +25,7 @@ @@ -59,7 +59,7 @@ @@ -93,7 +93,7 @@ id, buyer_id, order_date, ship_to_full_name, ship_to_postal_code, ship_to_todofuken, ship_to_shikuchoson, ship_to_azana_and_others, consumption_tax_rate, total_items_price, @@ -103,7 +103,7 @@ select @@ -122,7 +122,7 @@ select @@ -133,7 +133,7 @@ delete from orders where id = #{id,jdbcType=BIGINT} @@ -142,7 +142,7 @@ delete from orders @@ -153,7 +153,7 @@ insert into orders (buyer_id, order_date, ship_to_full_name, ship_to_postal_code, ship_to_todofuken, ship_to_shikuchoson, @@ -170,7 +170,7 @@ insert into orders @@ -254,7 +254,7 @@ select count(*) from orders @@ -265,7 +265,7 @@ update orders @@ -317,7 +317,7 @@ update orders set id = #{row.id,jdbcType=BIGINT}, @@ -341,7 +341,7 @@ update orders @@ -388,7 +388,7 @@ update orders set buyer_id = #{buyerId,jdbcType=VARCHAR}, diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/data.sql b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/data.sql index 7e2b02b99..5d9b585ef 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/data.sql +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/data.sql @@ -1,48 +1,61 @@ INSERT INTO assets (asset_code, asset_type) -VALUES ('b52dc7f712d94ca5812dd995bf926c04', 'png'), -('80bc8e167ccb4543b2f9d51913073492', 'png'), -('05d38fad5693422c8a27dd5b14070ec8', 'png'), -('45c22ba3da064391baac91341067ffe9', 'png'), -('4aed07c4ed5d45a5b97f11acedfbb601', 'png'), -('082b37439ecc44919626ba00fc60ee85', 'png'), -('f5f89954281747fa878129c29e1e0f83', 'png'), -('a8291ef2e8e14869a7048e272915f33c', 'png'), -('66237018c769478a90037bd877f5fba1', 'png'), -('d136d4c81b86478990984dcafbf08244', 'png'), -('47183f32f6584d7fb661f9216e11318b', 'png'), -('cf151206efd344e1b86854f4aa49fdef', 'png'), -('ab2e78eb7fe3408aadbf1e17a9945a8c', 'png'), -('0e557e96bc054f10bc91c27405a83e85', 'png'), -('e622b0098808492cb883831c05486b58', 'png'); +VALUES + ('b52dc7f712d94ca5812dd995bf926c04', 'png'), + ('80bc8e167ccb4543b2f9d51913073492', 'png'), + ('05d38fad5693422c8a27dd5b14070ec8', 'png'), + ('45c22ba3da064391baac91341067ffe9', 'png'), + ('4aed07c4ed5d45a5b97f11acedfbb601', 'png'), + ('082b37439ecc44919626ba00fc60ee85', 'png'), + ('f5f89954281747fa878129c29e1e0f83', 'png'), + ('a8291ef2e8e14869a7048e272915f33c', 'png'), + ('66237018c769478a90037bd877f5fba1', 'png'), + ('d136d4c81b86478990984dcafbf08244', 'png'), + ('47183f32f6584d7fb661f9216e11318b', 'png'), + ('cf151206efd344e1b86854f4aa49fdef', 'png'), + ('ab2e78eb7fe3408aadbf1e17a9945a8c', 'png'), + ('0e557e96bc054f10bc91c27405a83e85', 'png'), + ('e622b0098808492cb883831c05486b58', 'png'); + +INSERT INTO catalog_brands (id, name) +VALUES + (1, '高級なブランド'), + (2, 'カジュアルなブランド'), + (3, 'ノーブランド'); +ALTER TABLE catalog_brands ALTER COLUMN id RESTART WITH 4; -insert into catalog_brands (id,name) values (1,'高級なブランド'); -insert into catalog_brands (id,name) values (2,'カジュアルなブランド'); -insert into catalog_brands (id,name) values (3,'ノーブランド'); +INSERT INTO catalog_categories (id, name) +VALUES + (1, '服'), + (2, 'バッグ'), + (3, 'シューズ'); +ALTER TABLE catalog_categories ALTER COLUMN id RESTART WITH 4; -insert into catalog_categories (id,name) values (1,'服'); -insert into catalog_categories (id,name) values (2,'バッグ'); -insert into catalog_categories (id,name) values (3,'シューズ'); - -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (1,'クルーネック Tシャツ - ブラック','定番の無地ロングTシャツです。',1980,'C000000001',1,3); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (2,'裏起毛 スキニーデニム','暖かいのに着膨れしない起毛デニムです。',4800,'C000000002',1,2); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (3,'ウールコート','あたたかく肌ざわりも良いウール100%のロングコートです。',49800,'C000000003',1,1); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (4,'無地 ボタンダウンシャツ','コットン100%の柔らかい着心地で、春先から夏、秋口まで万能に使いやすいです。',2800,'C000000004',1,2); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (5,'レザーハンドバッグ','コンパクトサイズのバッグですが収納力は抜群です。',18800,'B000000001',2,3); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (6,'ショルダーバッグ','エイジング加工したレザーを使用しています。',38000,'B000000002',2,2); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (7,'トートバッグ ポーチ付き','春の季節にぴったりのトートバッグです。インナーポーチまたは単体でも使用可能なポーチ付。',24800,'B000000003',2,3); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (8,'ショルダーバッグ','さらりと気軽に纏える、キュートなミニサイズショルダー。',2800,'B000000004',2,1); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (9,'レザー チェーンショルダーバッグ','エレガントな雰囲気を放つキルティングデザインです。',258000,'B000000005',2,1); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (10,'ランニングシューズ - ブルー','柔らかいソールは快適な履き心地で、ランニングに最適です。',12800,'S000000001',3,2); -insert into catalog_items (id,name,description,price,product_code,catalog_category_id,catalog_brand_id) values (11,'メダリオン ストレートチップ ドレスシューズ','イタリアの職人が丁寧に手作業で作り上げた一品です。',23800,'S000000002',3,1); +INSERT INTO catalog_items (id, name, description, price, product_code, catalog_category_id, catalog_brand_id, row_version) +VALUES + (1, 'クルーネック Tシャツ - ブラック', '定番の無地ロングTシャツです。', 1980, 'C000000001', 1, 3, CURRENT_TIMESTAMP), + (2, '裏起毛 スキニーデニム', '暖かいのに着膨れしない起毛デニムです。', 4800, 'C000000002', 1, 2, CURRENT_TIMESTAMP), + (3, 'ウールコート', 'あたたかく肌ざわりも良いウール100%のロングコートです。', 49800, 'C000000003', 1, 1, CURRENT_TIMESTAMP), + (4, '無地 ボタンダウンシャツ', 'コットン100%の柔らかい着心地で、春先から夏、秋口まで万能に使いやすいです。', 2800, 'C000000004', 1, 2, CURRENT_TIMESTAMP), + (5, 'レザーハンドバッグ', 'コンパクトサイズのバッグですが収納力は抜群です。', 18800, 'B000000001', 2, 3, CURRENT_TIMESTAMP), + (6, 'ショルダーバッグ', 'エイジング加工したレザーを使用しています。', 38000, 'B000000002', 2, 2, CURRENT_TIMESTAMP), + (7, 'トートバッグ ポーチ付き', '春の季節にぴったりのトートバッグです。インナーポーチまたは単体でも使用可能なポーチ付。', 24800, 'B000000003', 2, 3, CURRENT_TIMESTAMP), + (8, 'ショルダーバッグ', 'さらりと気軽に纏える、キュートなミニサイズショルダー。', 2800, 'B000000004', 2, 1, CURRENT_TIMESTAMP), + (9, 'レザー チェーンショルダーバッグ', 'エレガントな雰囲気を放つキルティングデザインです。', 258000, 'B000000005', 2, 1, CURRENT_TIMESTAMP), + (10, 'ランニングシューズ - ブルー', '柔らかいソールは快適な履き心地で、ランニングに最適です。', 12800, 'S000000001', 3, 2, CURRENT_TIMESTAMP), + (11, 'メダリオン ストレートチップ ドレスシューズ', 'イタリアの職人が丁寧に手作業で作り上げた一品です。', 23800, 'S000000002', 3, 1, CURRENT_TIMESTAMP); +ALTER TABLE catalog_items ALTER COLUMN id RESTART WITH 12; -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (1,'45c22ba3da064391baac91341067ffe9',1); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (2,'4aed07c4ed5d45a5b97f11acedfbb601',2); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (3,'082b37439ecc44919626ba00fc60ee85',3); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (4,'f5f89954281747fa878129c29e1e0f83',4); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (5,'a8291ef2e8e14869a7048e272915f33c',5); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (6,'66237018c769478a90037bd877f5fba1',6); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (7,'d136d4c81b86478990984dcafbf08244',7); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (8,'47183f32f6584d7fb661f9216e11318b',8); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (9,'cf151206efd344e1b86854f4aa49fdef',9); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (10,'ab2e78eb7fe3408aadbf1e17a9945a8c',10); -insert into catalog_item_assets (id,asset_code,catalog_item_id) values (11,'0e557e96bc054f10bc91c27405a83e85',11); +INSERT INTO catalog_item_assets (id, asset_code, catalog_item_id) +VALUES + (1, '45c22ba3da064391baac91341067ffe9', 1), + (2, '4aed07c4ed5d45a5b97f11acedfbb601', 2), + (3, '082b37439ecc44919626ba00fc60ee85', 3), + (4, 'f5f89954281747fa878129c29e1e0f83', 4), + (5, 'a8291ef2e8e14869a7048e272915f33c', 5), + (6, '66237018c769478a90037bd877f5fba1', 6), + (7, 'd136d4c81b86478990984dcafbf08244', 7), + (8, '47183f32f6584d7fb661f9216e11318b', 8), + (9, 'cf151206efd344e1b86854f4aa49fdef', 9), + (10, 'ab2e78eb7fe3408aadbf1e17a9945a8c', 10), + (11, '0e557e96bc054f10bc91c27405a83e85', 11); +ALTER TABLE catalog_item_assets ALTER COLUMN id RESTART WITH 12; diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/mybatisGeneratorConfig.xml b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/mybatisGeneratorConfig.xml index fdc7e98b0..71c23cb63 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/mybatisGeneratorConfig.xml +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/mybatisGeneratorConfig.xml @@ -11,6 +11,11 @@ connectionURL="jdbc:h2:file:~/stapler;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;" userId="" password="" /> + + + + diff --git a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/schema.sql b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/schema.sql index f57472b55..d284bbfa4 100644 --- a/samples/web-csr/dressca-backend/infrastructure/src/main/resources/schema.sql +++ b/samples/web-csr/dressca-backend/infrastructure/src/main/resources/schema.sql @@ -66,6 +66,7 @@ CREATE TABLE catalog_items product_code VARCHAR(128) NOT NULL, catalog_category_id BIGINT NOT NULL, catalog_brand_id BIGINT NOT NULL, + row_version TIMESTAMP NOT NULL, CONSTRAINT FK_catalog_items_catalog_brands FOREIGN KEY (catalog_brand_id) REFERENCES catalog_brands(id) ON DELETE CASCADE, CONSTRAINT FK_catalog_items_catalog_categories FOREIGN KEY (catalog_category_id) REFERENCES catalog_categories(id) ON DELETE CASCADE ); diff --git a/samples/web-csr/dressca-backend/settings.gradle b/samples/web-csr/dressca-backend/settings.gradle index 4a11ed098..397371d3b 100644 --- a/samples/web-csr/dressca-backend/settings.gradle +++ b/samples/web-csr/dressca-backend/settings.gradle @@ -6,4 +6,4 @@ */ rootProject.name = 'dressca-backend' -include 'application-core', 'system-common', 'infrastructure', 'web', 'batch' +include 'application-core', 'system-common', 'infrastructure', 'web', 'web-consumer', 'web-admin', 'batch' diff --git a/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/ExceptionIdConstant.java b/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/ExceptionIdConstant.java index fe69d707d..08c0a165f 100644 --- a/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/ExceptionIdConstant.java +++ b/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/ExceptionIdConstant.java @@ -24,6 +24,17 @@ public class ExceptionIdConstant { public static final String E_ORDER0002 = "E_ORDER0002"; /** カタログ情報が存在しなかった際の例外。 */ - public static final String E_CATALOG0001 = "E_CATALOG0002"; + public static final String E_CATALOG0001 = "E_CATALOG0001"; + /** カタログブランドが存在しなかった際の例外。 */ + public static final String E_CATALOG0002 = "E_CATALOG0002"; + + /** カタログカテゴリが存在しなかった際の例外。 */ + public static final String E_CATALOG0003 = "E_CATALOG0003"; + + /** ユーザに実行権限が無かった際の例外。 */ + public static final String E_CATALOG0004 = "E_CATALOG0004"; + + /** カタログアイテムの更新時に楽観ロックエラーが発生した際の例外。 */ + public static final String E_CATALOG0005 = "E_CATALOG0005"; } diff --git a/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/MessageIdConstant.java b/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/MessageIdConstant.java index 4d57df26f..20f0bedb9 100644 --- a/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/MessageIdConstant.java +++ b/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/constant/MessageIdConstant.java @@ -56,4 +56,16 @@ public class MessageIdConstant { /** フィルタリング用のカタログカテゴリリストを取得します。 */ public static final String D_CATALOG0004_LOG = "D_CATALOG0004.log"; + + /** カタログアイテム ID: {0} のカタログアイテムを取得します。 */ + public static final String D_CATALOG0005_LOG = "D_CATALOG0005.log"; + + /** カタログにアイテムを追加します。 */ + public static final String D_CATALOG0006_LOG = "D_CATALOG0006.log"; + + /** カタログアイテム ID: {0} のカタログアイテムを削除します。 */ + public static final String D_CATALOG0007_LOG = "D_CATALOG0007.log"; + + /** カタログアイテム ID: {0} のカタログアイテムを更新します。 */ + public static final String D_CATALOG0008_LOG = "D_CATALOG0008.log"; } diff --git a/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/exception/OptimisticLockingFailureException.java b/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/exception/OptimisticLockingFailureException.java new file mode 100644 index 000000000..8c935fbed --- /dev/null +++ b/samples/web-csr/dressca-backend/system-common/src/main/java/com/dressca/systemcommon/exception/OptimisticLockingFailureException.java @@ -0,0 +1,24 @@ +package com.dressca.systemcommon.exception; + +import com.dressca.systemcommon.constant.ExceptionIdConstant; + +/** + * 楽観ロックエラーが発生したことを表す例外です。 + */ +public class OptimisticLockingFailureException extends LogicException { + + /** + * カタログアイテムidを指定して、 + * {@link OptimisticLockingFailureException} クラスの新しいインスタンスを初期化します。 + * + * @param catalogItemId 更新処理を試みたカタログアイテムid + */ + public OptimisticLockingFailureException(long catalogItemId) { + super( + null, + ExceptionIdConstant.E_CATALOG0005, + new String[] { String.valueOf(catalogItemId) }, + new String[] { String.valueOf(catalogItemId) }); + } + +} diff --git a/samples/web-csr/dressca-backend/system-common/src/main/resources/messages.properties b/samples/web-csr/dressca-backend/system-common/src/main/resources/messages.properties index 453a11f01..45751a11d 100644 --- a/samples/web-csr/dressca-backend/system-common/src/main/resources/messages.properties +++ b/samples/web-csr/dressca-backend/system-common/src/main/resources/messages.properties @@ -12,6 +12,14 @@ E_ORDER0002.front=注文ID: {0}, 購入者ID: {1} に該当する注文情報が E_ORDER0002.log=存在しない注文情報(注文ID: {0}, 購入者ID: {1})が要求されました。 E_CATALOG0001.front=商品ID: {0} の商品が見つかりませんでした。 E_CATALOG0001.log=商品ID: {0} の商品が見つかりませんでした。 +E_CATALOG0002.front=ブランドID: {0} のブランドが見つかりませんでした。 +E_CATALOG0002.log=ブランドID: {0} のブランドが見つかりませんでした。 +E_CATALOG0003.front=カテゴリID: {0} のカテゴリが見つかりませんでした。 +E_CATALOG0003.log=カテゴリID: {0} のカテゴリが見つかりませんでした。 +E_CATALOG0004.front={0} を実行する権限がありません。 +E_CATALOG0004.log={0} を実行する権限がありません。 +E_CATALOG0005.front=カタログアイテム ID: {0} のカタログアイテムの更新時に楽観ロックエラーが発生しました。 +E_CATALOG0005.log=カタログアイテム ID: {0} のカタログアイテムの更新時に楽観ロックエラーが発生しました。 D_ASSET0001.log=アセット情報{0}を取得します。 D_BASKET0001.log=買い物かごに商品(顧客ID: {0}, カタログ商品ID: {1}, 数量: {2})を追加します。 D_BASKET0002.log=買い物かごの商品の数量(顧客ID: {0}, 数量: {1})を設定します。 @@ -21,4 +29,8 @@ D_ORDER0001.log=指定した注文ID: {0}, 購入者ID: {1} の注文情報を D_CATALOG0001.log=条件(ブランドID: {0}, カテゴリID: {1}, ページ: {2}, ページサイズ: {3})に一致するカタログ情報を取得します。 D_CATALOG0002.log=条件(ブランドID: {0}, カテゴリID: {1})に一致するカテゴリの件数を取得します。 D_CATALOG0003.log=フィルタリング用のカタログブランドリストを取得します。 -D_CATALOG0004.log=フィルタリング用のカタログカテゴリリストを取得します。 \ No newline at end of file +D_CATALOG0004.log=フィルタリング用のカタログカテゴリリストを取得します。 +D_CATALOG0005.log=カタログアイテム ID: {0} のカタログアイテムを取得します。 +D_CATALOG0006.log=カタログにアイテムを追加します。 +D_CATALOG0007.log=カタログアイテム ID: {0} のカタログアイテムを削除します。 +D_CATALOG0008.log=カタログアイテム ID: {0} のカタログアイテムを更新します。 \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/.gitignore b/samples/web-csr/dressca-backend/web-admin/.gitignore new file mode 100644 index 000000000..c2065bc26 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/.gitignore @@ -0,0 +1,37 @@ +HELP.md +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ diff --git a/samples/web-csr/dressca-backend/web-admin/build.gradle b/samples/web-csr/dressca-backend/web-admin/build.gradle new file mode 100644 index 000000000..31ca06e85 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/build.gradle @@ -0,0 +1,61 @@ +plugins { + id 'java' + id 'org.springframework.boot' version "${springBootVersion}" + id 'io.spring.dependency-management' version "${springDependencyManagementVersion}" + id 'org.springdoc.openapi-gradle-plugin' version "${springdocOpenapiGradlePluginVersion}" +} + +group = 'com.dressca' +version = '0.0.1-SNAPSHOT' + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +repositories { + mavenCentral() +} + +dependencies { + implementation supportDependencies.spring_boot_starter_web + implementation supportDependencies.spring_boot_starter_validation + implementation supportDependencies.spring_boot_starter_actuator + implementation supportDependencies.springdoc_openapi_starter_webmvc_ui + implementation supportDependencies.commons_lang3 + implementation supportDependencies.spring_boot_security_starter + implementation supportDependencies.h2database + + implementation project(':web') + implementation project(':application-core') + implementation project(':infrastructure') + implementation project(':system-common') + + testImplementation supportDependencies.spring_boot_starter_test + testImplementation supportDependencies.spring_boot_starter_log4j2 + testImplementation supportDependencies.spring_security_test + + compileOnly supportDependencies.servlet_api +} + +configurations { + all { + exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' + } +} +afterEvaluate { + tasks.named("forkedSpringBootRun") { + workingDir("$rootDir/api-docs/web-admin") + } +} +openApi { + apiDocsUrl.set("http://localhost:8081/api-docs") + outputDir.set(file("$rootDir/api-docs/web-admin")) + outputFileName.set("api-specification.json") +} +tasks.named('test') { + useJUnitPlatform() +} + +build.dependsOn("generateOpenApiDocs") \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/gradle/wrapper/gradle-wrapper.jar b/samples/web-csr/dressca-backend/web-admin/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..e6441136f Binary files /dev/null and b/samples/web-csr/dressca-backend/web-admin/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/web-csr/dressca-backend/web-admin/gradle/wrapper/gradle-wrapper.properties b/samples/web-csr/dressca-backend/web-admin/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..a4413138c --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/web-csr/dressca-backend/web-admin/gradlew b/samples/web-csr/dressca-backend/web-admin/gradlew new file mode 100644 index 000000000..b740cf133 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License 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. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/web-csr/dressca-backend/web-admin/gradlew.bat b/samples/web-csr/dressca-backend/web-admin/gradlew.bat new file mode 100644 index 000000000..25da30dbd --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/web-csr/dressca-backend/web-admin/settings.gradle b/samples/web-csr/dressca-backend/web-admin/settings.gradle new file mode 100644 index 000000000..4303cec08 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'web-admin' diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/WebApplication.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/WebApplication.java new file mode 100644 index 000000000..62fecf08d --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/WebApplication.java @@ -0,0 +1,21 @@ +package com.dressca.web.admin; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.info.Info; + +/** + * Dresscaアプリケーションを起動するためのmainクラスです。 + */ +@SpringBootApplication +@OpenAPIDefinition(info = @Info(title = "Dressca", description = "ECサイトDressca", version = "v1")) +@ComponentScan(basePackages = { "com.dressca" }) +public class WebApplication { + + public static void main(String[] args) { + SpringApplication.run(WebApplication.class, args); + } + +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/authorization/UserStoreImpl.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/authorization/UserStoreImpl.java new file mode 100644 index 000000000..f168d8f9c --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/authorization/UserStoreImpl.java @@ -0,0 +1,54 @@ +package com.dressca.web.admin.authorization; + +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Component; +import com.dressca.applicationcore.authorization.UserStore; + +/** + * ユーザのセッション情報。 + */ +@Component +public class UserStoreImpl implements UserStore { + + /** + * ログイン中のユーザー名を取得します。 + * + * @return ログイン中のユーザー名。未ログインの場合、空文字。 + */ + public String loginUserName() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication != null) { + return authentication.getName(); + } + return ""; + } + + /** + * ログイン中のユーザーのロールを取得します。 + * + * @return ログイン中のユーザーのロール。未ログインの場合、空文字 + */ + public String loginUserRole() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication != null) { + return authentication.getAuthorities().stream().map(GrantedAuthority::getAuthority).findFirst().orElse(""); + } + return ""; + } + + /** + * ログイン中のユーザーが指定したロールに属しているかどうか確認します。 + * + * @return ログインしている場合true。未ログインの場合false。 + */ + public boolean isInRole(String role) { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication != null) { + return authentication.getAuthorities().stream().map(GrantedAuthority::getAuthority) + .anyMatch(roles -> roles.equals(role)); + } + return false; + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/config/DresscaWebConfig.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/config/DresscaWebConfig.java new file mode 100644 index 000000000..526eb98ce --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/config/DresscaWebConfig.java @@ -0,0 +1,14 @@ +package com.dressca.web.admin.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; + +/** + * Dressca Web用の設定クラス。 + */ +@Configuration +public class DresscaWebConfig { + + @Autowired(required = false) + public H2ServerLauncher h2ServerLauncher; +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/config/H2ServerLauncher.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/config/H2ServerLauncher.java new file mode 100644 index 000000000..95bddb4ca --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/config/H2ServerLauncher.java @@ -0,0 +1,40 @@ +package com.dressca.web.admin.config; + +import org.h2.tools.Server; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; +import java.sql.SQLException; + +/** + * 開発環境でh2データベースを立ち上げるためのクラスです。 + */ +@Component +@Profile("local") +public class H2ServerLauncher { + + private Server tcpServer; + + /** + * h2サーバをサーバーモードで起動します。 + */ + @PostConstruct + public void start() { + try { + this.tcpServer = Server.createTcpServer("-tcpPort", "9092", "-tcpAllowOthers", "-ifNotExists").start(); + } catch (SQLException e) { + System.out.println("H2 server is already started."); + } + } + + /** + * h2サーバを停止します。 + */ + @PreDestroy + public void stop() { + if (this.tcpServer != null) { + this.tcpServer.stop(); + } + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/AssetsController.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/AssetsController.java new file mode 100644 index 000000000..7b3eba884 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/AssetsController.java @@ -0,0 +1,86 @@ +package com.dressca.web.admin.controller; + +import com.dressca.applicationcore.applicationservice.AssetApplicationService; +import com.dressca.applicationcore.assets.Asset; +import com.dressca.applicationcore.assets.AssetNotFoundException; +import com.dressca.applicationcore.assets.AssetResourceInfo; +import com.dressca.applicationcore.assets.AssetTypes; +import com.dressca.systemcommon.constant.SystemPropertyConstants; +import com.dressca.systemcommon.exception.LogicException; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.Resource; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; + +/** + * {@link Asset} の情報にアクセスするAPIコントローラーです。 + */ +@RestController +@Tag(name = "Assets", description = "アセットの情報にアクセスするAPI") +@RequestMapping("/api/assets") +@AllArgsConstructor +@PreAuthorize(value = "isAuthenticated()") +public class AssetsController { + + @Autowired + private AssetApplicationService service; + + private static final Logger apLog = LoggerFactory.getLogger(SystemPropertyConstants.APPLICATION_LOG_LOGGER); + + /** + * アセットを取得します。 + * + * @param assetCode アセットコード + * @return アセット + */ + @Operation(summary = "アセットを取得する.", description = "与えられたアセットコードに対応するアセットを返却する.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "成功.", content = @Content(mediaType = "image/*", schema = @Schema(implementation = Resource.class))), + @ApiResponse(responseCode = "404", description = "アセットコードに対応するアセットがない.", content = @Content) }) + @GetMapping("{assetCode}") + public ResponseEntity get( + @Parameter(required = true, description = "アセットコード") @PathVariable("assetCode") String assetCode) + throws LogicException { + try { + AssetResourceInfo assetResourceInfo = this.service.getAssetResourceInfo(assetCode); + MediaType contentType = getContentType(assetResourceInfo.getAsset()); + + return ResponseEntity.ok().contentType(contentType).body(assetResourceInfo.getResource()); + } catch (AssetNotFoundException e) { + apLog.info(e.getMessage()); + apLog.debug(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.notFound().build(); + } + } + + /** + * アセットタイプから Content-Type に変換します。 + * + * @param asset アセット + * @return Content-Type の名称 + */ + private MediaType getContentType(Asset asset) { + switch (asset.getAssetType()) { + case AssetTypes.png: + return MediaType.IMAGE_PNG; + default: + throw new IllegalArgumentException("指定したアセットのアセットタイプは Content-Type に変換できません。"); + } + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogBrandsController.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogBrandsController.java new file mode 100644 index 000000000..ddfe47bae --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogBrandsController.java @@ -0,0 +1,53 @@ +package com.dressca.web.admin.controller; + +import java.util.List; +import java.util.stream.Collectors; +import com.dressca.applicationcore.applicationservice.CatalogApplicationService; +import com.dressca.applicationcore.catalog.CatalogBrand; +import com.dressca.web.admin.controller.dto.catalog.CatalogBrandResponse; +import com.dressca.web.admin.mapper.CatalogBrandMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; + +/** + * {@link CatalogBrand} の情報にアクセスする API コントローラーです。 + */ +@RestController +@Tag(name = "CatalogBrands", description = "カタログブランドの情報にアクセスするAPI") +@RequestMapping("/api/catalog-brands") +@AllArgsConstructor +@PreAuthorize(value = "isAuthenticated()") +public class CatalogBrandsController { + + @Autowired + private CatalogApplicationService service; + + /** + * カタログブランドの一覧を取得します。 + * + * @return カタログブランドの一覧 + */ + @Operation(summary = "カタログブランドの一覧を取得する.", description = "カタログブランドの一覧を取得する.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "成功", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CatalogBrandResponse.class)))) }) + @GetMapping + public ResponseEntity> getCatalogBrands() { + List brands = this.service.getBrands().stream() + .map(CatalogBrandMapper::convert) + .collect(Collectors.toList()); + + return ResponseEntity.ok().body(brands); + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogCategoriesController.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogCategoriesController.java new file mode 100644 index 000000000..f6eabdc23 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogCategoriesController.java @@ -0,0 +1,53 @@ +package com.dressca.web.admin.controller; + +import java.util.List; +import java.util.stream.Collectors; +import com.dressca.applicationcore.applicationservice.CatalogApplicationService; +import com.dressca.applicationcore.catalog.CatalogCategory; +import com.dressca.web.admin.controller.dto.catalog.CatalogCategoryResponse; +import com.dressca.web.admin.mapper.CatalogCategoryMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; + +/** + * {@link CatalogCategory} の情報にアクセスする API コントローラーです。 + */ +@RestController +@Tag(name = "CatalogCategories", description = "カタログカテゴリの情報にアクセスするAPI") +@RequestMapping("/api/catalog-categories") +@AllArgsConstructor +@PreAuthorize(value = "isAuthenticated()") +public class CatalogCategoriesController { + + @Autowired + private CatalogApplicationService service; + + /** + * カタログカテゴリの一覧を取得します。 + * + * @return カタログカテゴリの一覧。 + */ + @Operation(summary = "カタログカテゴリの一覧を取得します.", description = "カタログカテゴリの一覧を取得します.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "成功", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = CatalogCategoryResponse.class)))) }) + @GetMapping + public ResponseEntity> getCatalogCategories() { + List categories = this.service.getCategories().stream() + .map(CatalogCategoryMapper::convert) + .collect(Collectors.toList()); + + return ResponseEntity.ok().body(categories); + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogItemsController.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogItemsController.java new file mode 100644 index 000000000..45a4474d1 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/CatalogItemsController.java @@ -0,0 +1,205 @@ +package com.dressca.web.admin.controller; + +import java.math.BigDecimal; +import java.net.URI; +import java.util.List; +import java.util.stream.Collectors; +import com.dressca.applicationcore.applicationservice.CatalogApplicationService; +import com.dressca.applicationcore.authorization.PermissionDeniedException; +import com.dressca.applicationcore.catalog.CatalogBrandNotFoundException; +import com.dressca.applicationcore.catalog.CatalogCategoryNotFoundException; +import com.dressca.applicationcore.catalog.CatalogItem; +import com.dressca.applicationcore.catalog.CatalogNotFoundException; +import com.dressca.systemcommon.constant.ExceptionIdConstant; +import com.dressca.systemcommon.constant.SystemPropertyConstants; +import com.dressca.systemcommon.exception.OptimisticLockingFailureException; +import com.dressca.systemcommon.exception.SystemException; +import com.dressca.web.admin.controller.dto.catalog.CatalogItemResponse; +import com.dressca.web.admin.controller.dto.catalog.PagedListOfCatalogItemResponse; +import com.dressca.web.admin.controller.dto.catalog.PostCatalogItemRequest; +import com.dressca.web.admin.controller.dto.catalog.PutCatalogItemRequest; +import com.dressca.web.admin.mapper.CatalogItemMapper; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.RequestBody; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; + +/** + * {@link CatalogItem} の情報にアクセスする API コントローラーです。 + */ +@RestController +@Tag(name = "CatalogItems", description = "カタログアイテムの情報にアクセスする API コントローラーです.") +@RequestMapping("/api/catalog-items") +@AllArgsConstructor +@PreAuthorize(value = "hasAuthority('ROLE_ADMIN')") +public class CatalogItemsController { + + @Autowired + private CatalogApplicationService service; + + private static final Logger apLog = LoggerFactory.getLogger(SystemPropertyConstants.APPLICATION_LOG_LOGGER); + + /** + * 指定したIDのカタログアイテムを返します。 + * + * @param id ID。 + * @return カタログアイテム。 + * @throws PermissionDeniedException 認可エラー + */ + @Operation(summary = "指定したIDのカタログアイテムを返します。", description = "指定したIDのカタログアイテムを返します。") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "成功", content = @Content(mediaType = "application/json", schema = @Schema(implementation = PagedListOfCatalogItemResponse.class))), + @ApiResponse(responseCode = "401", description = "未認証エラー", content = @Content), + @ApiResponse(responseCode = "404", description = "対象のIDが存在しない。", content = @Content) + }) + @GetMapping("{id}") + public ResponseEntity getById(@PathVariable("id") long id) throws PermissionDeniedException { + CatalogItem item; + try { + item = this.service.getCatalogItem(id); + } catch (CatalogNotFoundException e) { + apLog.info(e.getMessage()); + apLog.debug(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.notFound().build(); + } + CatalogItemResponse returnValue = CatalogItemMapper.convert(item); + return ResponseEntity.ok().body(returnValue); + } + + /** + * カタログアイテムを検索して返します。 + * + * @param brandId ブランドID + * @param categoryId カテゴリID + * @param page ページ番号。未指定の場合は1。 + * @param pageSize ページサイズ。未指定の場合は20。 + * @return カタログアイテムの一覧 + * @throws PermissionDeniedException 認可エラー + */ + @Operation(summary = "カタログアイテムを検索して返します.", description = "カタログアイテムを検索して返します.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "成功", content = @Content(mediaType = "application/json", schema = @Schema(implementation = PagedListOfCatalogItemResponse.class))), + @ApiResponse(responseCode = "400", description = "リクエストエラー", content = @Content), + @ApiResponse(responseCode = "401", description = "未認証エラー", content = @Content), + @ApiResponse(responseCode = "404", description = "リソースアクセスエラー", content = @Content) + }) + @GetMapping + public ResponseEntity getByQuery( + @RequestParam(name = "brandId", defaultValue = "0") long brandId, + @RequestParam(name = "categoryId", defaultValue = "0") long categoryId, + @RequestParam(name = "page", defaultValue = "0") int page, + @RequestParam(name = "pageSize", defaultValue = "20") int pageSize) throws PermissionDeniedException { + + List items = this.service.getCatalogItemsByAdmin(brandId, categoryId, page, pageSize).stream() + .map(CatalogItemMapper::convert).collect(Collectors.toList()); + int totalCount = this.service.countCatalogItems(brandId, categoryId); + + PagedListOfCatalogItemResponse returnValue = new PagedListOfCatalogItemResponse(items, totalCount, page, pageSize); + return ResponseEntity.ok().body(returnValue); + } + + /** + * カタログにアイテムを追加します。 + * + * @param postCatalogItemRequest 追加するカタログアイテム + * @return 追加したカタログアイテム + * @throws PermissionDeniedException 認可エラー + */ + @Operation(summary = "カタログにアイテムを追加します。", description = "カタログにアイテムを追加します。") + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "成功。", content = @Content), + @ApiResponse(responseCode = "401", description = "未認証エラー", content = @Content), + @ApiResponse(responseCode = "404", description = "リソースアクセスエラー", content = @Content) + }) + @PostMapping + public ResponseEntity postCatalogItem(@RequestBody PostCatalogItemRequest postCatalogItemRequest) + throws PermissionDeniedException { + + this.service.addItemToCatalog(postCatalogItemRequest.getName(), postCatalogItemRequest.getDescription(), + new BigDecimal(postCatalogItemRequest.getPrice()), postCatalogItemRequest.getProductCode(), + postCatalogItemRequest.getCatalogCategoryId(), postCatalogItemRequest.getCatalogBrandId()); + + return ResponseEntity.created(URI.create("catalog-items")).build(); + } + + /** + * カタログから指定したカタログアイテム ID のアイテムを削除します。 + * + * @param catalogItemId カタログアイテムID。 + * @return なし。 + * @throws PermissionDeniedException 認可エラー + */ + @Operation(summary = "カタログから指定したカタログアイテム ID のアイテムを削除します。", description = "カタログから指定したカタログアイテム ID のアイテムを削除します。") + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "成功.", content = @Content), + @ApiResponse(responseCode = "401", description = "未認証エラー", content = @Content), + @ApiResponse(responseCode = "404", description = "対象のIDが存在しない。", content = @Content) + }) + @DeleteMapping("{catalogItemId}") + public ResponseEntity deleteCatalogItem(@PathVariable("catalogItemId") long catalogItemId) + throws PermissionDeniedException { + try { + this.service.deleteItemFromCatalog(catalogItemId); + } catch (CatalogNotFoundException e) { + apLog.info(e.getMessage()); + apLog.debug(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.notFound().build(); + } + return ResponseEntity.noContent().build(); + } + + /** + * 指定したIDのカタログアイテムの情報を更新します。 + * + * @param catalogItemId カタログアイテムID。 + * @param putCatalogItemRequest 更新するカタログアイテムの情報。 + * @return なし。 + * @throws OptimisticLockingFailureException 楽観ロックエラー + * @throws PermissionDeniedException 認可エラー + */ + @Operation(summary = "指定したIDのカタログアイテムの情報を更新します。", description = "指定したIDのカタログアイテムの情報を更新します。") + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "成功.", content = @Content), + @ApiResponse(responseCode = "401", description = "未認証エラー", content = @Content), + @ApiResponse(responseCode = "404", description = "対象のIDが存在しない。", content = @Content), + @ApiResponse(responseCode = "409", description = "更新の競合が発生。", content = @Content), + }) + @PutMapping("{catalogItemId}") + public ResponseEntity putCatalogItem(@PathVariable("catalogItemId") long catalogItemId, + @RequestBody PutCatalogItemRequest putCatalogItemRequest) + throws PermissionDeniedException, OptimisticLockingFailureException { + try { + this.service.updateCatalogItem(catalogItemId, putCatalogItemRequest.getName(), + putCatalogItemRequest.getDescription(), new BigDecimal(putCatalogItemRequest.getPrice()), + putCatalogItemRequest.getProductCode(), putCatalogItemRequest.getCatalogCategoryId(), + putCatalogItemRequest.getCatalogBrandId()); + } catch (CatalogNotFoundException e) { + apLog.info(e.getMessage()); + apLog.debug(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.notFound().build(); + } catch (CatalogBrandNotFoundException | CatalogCategoryNotFoundException e) { + apLog.error(ExceptionUtils.getStackTrace(e)); + // ここでは発生を想定していないので、システムエラーとする。 + throw new SystemException(e, ExceptionIdConstant.E_SHARE0000, null, null); + } + return ResponseEntity.noContent().build(); + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/UsersController.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/UsersController.java new file mode 100644 index 000000000..a8251eccc --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/UsersController.java @@ -0,0 +1,48 @@ +package com.dressca.web.admin.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.dressca.applicationcore.authorization.UserStore; +import com.dressca.web.admin.controller.dto.UserResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; + +/** + * {@link UserStore}の情報にアクセスする API コントローラです。 + */ +@RestController +@Tag(name = "Users", description = "ログイン中のユーザーの情報を取得します。") +@RequestMapping("/api/users") +@PreAuthorize(value = "isAuthenticated()") +public class UsersController { + + @Autowired(required = false) + private UserStore userStore; + + /** + * ログイン中のユーザーの情報を取得します。 + * + * @return ユーザの情報。 + */ + + @Operation(summary = "ログイン中のユーザーの情報を取得します。", description = "ユーザーの情報。") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "成功.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = UserResponse.class))), + @ApiResponse(responseCode = "401", description = "未認証エラー.", content = @Content) + }) + @GetMapping + public ResponseEntity getLoginUser() { + + UserResponse response = new UserResponse(this.userStore.loginUserName(), this.userStore.loginUserRole()); + return ResponseEntity.ok().body(response); + + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/UserResponse.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/UserResponse.java new file mode 100644 index 000000000..2ca2cc118 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/UserResponse.java @@ -0,0 +1,17 @@ +package com.dressca.web.admin.controller.dto; + +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Data; + +/** + * ユーザー情報を取得する際に用いるdtoクラスです。 + */ +@Data +@AllArgsConstructor +public class UserResponse { + @NotNull + private String userName = ""; + @NotNull + private String role = ""; +} diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogBrandResponse.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/CatalogBrandResponse.java similarity index 87% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogBrandResponse.java rename to samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/CatalogBrandResponse.java index 07301a6fa..41f45c223 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogBrandResponse.java +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/CatalogBrandResponse.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.catalog; +package com.dressca.web.admin.controller.dto.catalog; import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogCategoryResponse.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/CatalogCategoryResponse.java similarity index 87% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogCategoryResponse.java rename to samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/CatalogCategoryResponse.java index ff53c2ae5..0ddf1345f 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogCategoryResponse.java +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/CatalogCategoryResponse.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.catalog; +package com.dressca.web.admin.controller.dto.catalog; import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogItemResponse.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/CatalogItemResponse.java similarity index 92% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogItemResponse.java rename to samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/CatalogItemResponse.java index 4eddc5491..5dc2c5613 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogItemResponse.java +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/CatalogItemResponse.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.catalog; +package com.dressca.web.admin.controller.dto.catalog; import java.math.BigDecimal; import java.util.List; @@ -30,5 +30,4 @@ public class CatalogItemResponse { private long catalogCategoryId; @NotNull private long catalogBrandId; - } diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogItemSummaryResponse.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/CatalogItemSummaryResponse.java similarity index 89% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogItemSummaryResponse.java rename to samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/CatalogItemSummaryResponse.java index 11943ee38..f60af18dd 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/CatalogItemSummaryResponse.java +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/CatalogItemSummaryResponse.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.catalog; +package com.dressca.web.admin.controller.dto.catalog; import java.util.List; import jakarta.validation.constraints.NotNull; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/PagedListOfCatalogItemResponse.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PagedListOfCatalogItemResponse.java similarity index 88% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/PagedListOfCatalogItemResponse.java rename to samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PagedListOfCatalogItemResponse.java index 77643bccb..213e6ab56 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/catalog/PagedListOfCatalogItemResponse.java +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PagedListOfCatalogItemResponse.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.catalog; +package com.dressca.web.admin.controller.dto.catalog; import java.util.List; import lombok.AllArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PostCatalogItemRequest.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PostCatalogItemRequest.java new file mode 100644 index 000000000..d16c0b127 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PostCatalogItemRequest.java @@ -0,0 +1,29 @@ +package com.dressca.web.admin.controller.dto.catalog; + +import java.time.LocalDateTime; +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * カタログにアイテムを追加する際に用いるdtoクラスです。 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class PostCatalogItemRequest { + @NotNull + private String name = ""; + @NotNull + private String description = ""; + @NotNull + private long price; + @NotNull + private String productCode; + @NotNull + private long catalogCategoryId; + @NotNull + private long catalogBrandId; + private LocalDateTime rowVersion = LocalDateTime.now(); +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PutCatalogItemRequest.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PutCatalogItemRequest.java new file mode 100644 index 000000000..d0b1680dc --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/controller/dto/catalog/PutCatalogItemRequest.java @@ -0,0 +1,25 @@ +package com.dressca.web.admin.controller.dto.catalog; + +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Data; + +/** + * カタログアイテムを変更する際に用いるdtoクラスです。 + */ +@Data +@AllArgsConstructor +public class PutCatalogItemRequest { + @NotNull + public String name = ""; + @NotNull + public String description = ""; + @NotNull + public long price; + @NotNull + public String productCode; + @NotNull + public long catalogCategoryId; + @NotNull + public long catalogBrandId; +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/filter/DummyUserInjectionFilter.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/filter/DummyUserInjectionFilter.java new file mode 100644 index 000000000..f5836af78 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/filter/DummyUserInjectionFilter.java @@ -0,0 +1,37 @@ +package com.dressca.web.admin.filter; + +import java.io.IOException; +import java.util.List; +import org.springframework.context.annotation.Profile; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +/** + * ダミーユーザーをSecurityContextHolderに詰めるためのフィルタークラス。 + * 開発環境においてユーザ名がadmin@example.com、権限が管理者のユーザでアクセスしたことにして認証プロセスをスキップするために使用する。 + * また、本フィルターはWebSecurityConfigにて、セキュリティフィルターチェーンのUsernamePasswordAuthenticationFilterの前に挿入する。 + */ +@Profile("local") +@Component +public class DummyUserInjectionFilter extends OncePerRequestFilter { + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) + throws IOException, ServletException { + UserDetails dummyUser = new User("admin@example.com", "", List.of(new SimpleGrantedAuthority("ROLE_ADMIN"))); + + UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(dummyUser, + dummyUser.getPassword(), dummyUser.getAuthorities()); + SecurityContextHolder.getContext().setAuthentication(authentication); + filterChain.doFilter(request, response); + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogBrandMapper.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogBrandMapper.java similarity index 84% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogBrandMapper.java rename to samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogBrandMapper.java index 72839e658..3341b5358 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogBrandMapper.java +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogBrandMapper.java @@ -1,7 +1,7 @@ -package com.dressca.web.mapper; +package com.dressca.web.admin.mapper; import com.dressca.applicationcore.catalog.CatalogBrand; -import com.dressca.web.controller.dto.catalog.CatalogBrandResponse; +import com.dressca.web.admin.controller.dto.catalog.CatalogBrandResponse; /** * {@link CatalogBrand} と {@link CatalogBrandResponse} のマッパーです。 diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogCategoryMapper.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogCategoryMapper.java new file mode 100644 index 000000000..6ff852d4b --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogCategoryMapper.java @@ -0,0 +1,23 @@ +package com.dressca.web.admin.mapper; + +import com.dressca.applicationcore.catalog.CatalogCategory; +import com.dressca.web.admin.controller.dto.catalog.CatalogCategoryResponse; + +/** + * {@link CatalogCategory} と {@link CatalogCategoryResponse} のマッパーです。 + */ +public class CatalogCategoryMapper { + + /** + * {@link CatalogCategory} オブジェクトを {@link CatalogCategoryResponse} に変換します。 + * + * @param catalogCategory {@link CatalogCategory} オブジェクト + * @return {@link CatalogCategoryResponse} オブジェクト + */ + public static CatalogCategoryResponse convert(CatalogCategory catalogCategory) { + if (catalogCategory == null) { + return null; + } + return new CatalogCategoryResponse(catalogCategory.getId(), catalogCategory.getName()); + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogItemMapper.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogItemMapper.java new file mode 100644 index 000000000..80226dbb0 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/mapper/CatalogItemMapper.java @@ -0,0 +1,32 @@ +package com.dressca.web.admin.mapper; + +import java.util.List; +import java.util.stream.Collectors; +import com.dressca.applicationcore.catalog.CatalogItem; +import com.dressca.applicationcore.catalog.CatalogItemAsset; +import com.dressca.web.admin.controller.dto.catalog.CatalogItemResponse; + +/** + * {@link CatalogItem} と {@link CatalogItemResponse} のマッパーです。 + */ +public class CatalogItemMapper { + + /** + * {@link CatalogItem} オブジェクトを {@link CatalogItemResponse} に変換します。 + * + * @param item {@link CatalogItem} オブジェクト + * @return {@link CatalogItemResponse} オブジェクト + */ + public static CatalogItemResponse convert(CatalogItem item) { + + if (item == null) { + return null; + } + + List assetCodes = item.getAssets().stream().map(CatalogItemAsset::getAssetCode) + .collect(Collectors.toList()); + + return new CatalogItemResponse(item.getId(), item.getName(), item.getProductCode(), assetCodes, + item.getDescription(), item.getPrice(), item.getCatalogCategoryId(), item.getCatalogBrandId()); + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/security/WebSecurityConfig.java b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/security/WebSecurityConfig.java new file mode 100644 index 000000000..3c44c2e3a --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/java/com/dressca/web/admin/security/WebSecurityConfig.java @@ -0,0 +1,60 @@ +package com.dressca.web.admin.security; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.web.cors.CorsConfiguration; +import com.dressca.web.admin.filter.DummyUserInjectionFilter; +import java.util.Arrays; +import java.util.List; + +/** + * セキュリティ関連の実行クラス。 + */ +@Configuration +@EnableWebSecurity +@EnableMethodSecurity +public class WebSecurityConfig { + + @Value("${cors.allowed.origins:}") + private String allowedOrigins; + + @Autowired(required = false) + private DummyUserInjectionFilter dummyUserInjectionFilter; + + /** + * CORS設定、認可機能を実装。 + * + * @param http 認証認可の設定クラス + * @return フィルターチェーン + * @throws Exception 例外 + */ + @Bean + public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + http + .securityMatcher("/api/**") + .csrf(csrf -> csrf.disable()) + .cors(cors -> cors.configurationSource(request -> { + CorsConfiguration conf = new CorsConfiguration(); + conf.setAllowCredentials(true); + conf.setAllowedOrigins(Arrays.asList(allowedOrigins)); + conf.setAllowedMethods(List.of("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")); + conf.setAllowedHeaders(List.of("*")); + return conf; + })) + .anonymous(anon -> anon.disable()); + + // 開発環境においてはダミーユーザを注入する + if (dummyUserInjectionFilter != null) { + http.addFilterBefore(dummyUserInjectionFilter, UsernamePasswordAuthenticationFilter.class); + } + + return http.build(); + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-common.properties b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-common.properties new file mode 100644 index 000000000..3e9719b32 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-common.properties @@ -0,0 +1,12 @@ +# springdoc-openapi +springdoc.api-docs.path=/api-docs +springdoc.swagger-ui.path=/swagger-ui.html +springdoc.show-actuator=true + +# spring boot actuatorの設定(ステータスの変更,表示情報) +# ヘルスチェックAPIのURLを/apiから始まるように変更する +management.endpoints.web.base-path=/api +# サーバのヘルスチェック用のAPIを設定する(http://localhost:8081/api/health/check) +management.endpoint.health.group.check.include=ping +# データベースのヘルスチェック用のAPIを設定する(http://localhost:8081/api/health/datasource) +management.endpoint.health.group.datasource.include=db diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-dev.properties b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-dev.properties new file mode 100644 index 000000000..7681bc7ed --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-dev.properties @@ -0,0 +1,25 @@ +# h2 database +spring.datasource.hikari.driver-class-name=org.h2.Driver + +# DBをサーバーモードで立ち上げる場合の接続先情報 +spring.datasource.hikari.jdbc-url=jdbc:h2:tcp://localhost:9092/mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; +spring.sql.init.mode=always + +# DBを組み込みモードで立ち上げる場合の接続先情報 +# spring.datasource.hikari.jdbc-url=jdbc:h2:mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; +# spring.sql.init.mode=embedded + +spring.datasource.hikari.username= +spring.datasource.hikari.password= +spring.h2.console.enabled=true +spring.h2.console.path=/h2-console +spring.h2.console.settings.web-allow-others=true + +# ヘルスチェックの API のログを検出するため logging level を変更する +logging.level.web=DEBUG + +# CORS 設定 +cors.allowed.origins=http://localhost,http://localhost:6173 + +# ポート番号の指定 +server.port=8081 \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-prd.properties b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-prd.properties new file mode 100644 index 000000000..f3cb76afe --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-prd.properties @@ -0,0 +1,9 @@ +# PostgreSQL database +spring.datasource.hikari.driver-class-name=org.postgresql.Driver +spring.datasource.hikari.jdbc-url=jdbc:postgresql://localhost:5432/project +spring.datasource.hikari.username=project +spring.datasource.hikari.password=project +spring.sql.init.mode=never + +# CORS 設定 +cors.allowed.origins=https://本番環境のフロントエンド配布サーバーのドメイン \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-ut.properties b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-ut.properties new file mode 100644 index 000000000..df4261b68 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application-ut.properties @@ -0,0 +1,10 @@ +# h2 database +spring.datasource.hikari.driver-class-name=org.h2.Driver +spring.datasource.hikari.jdbc-url=jdbc:h2:mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; +spring.datasource.hikari.username= +spring.datasource.hikari.password= +spring.h2.console.enabled=true +spring.h2.console.path=/h2-console +spring.h2.console.settings.web-allow-others=true +spring.sql.init.mode=embedded +mybatis.configuration.map-underscore-to-camel-case=true diff --git a/samples/web-csr/dressca-backend/web-admin/src/main/resources/application.properties b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application.properties new file mode 100644 index 000000000..41fa11b1e --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/main/resources/application.properties @@ -0,0 +1,9 @@ +# 環境別のプロファイル設定(common:全環境共通の設定、test:UT用、local:ローカル打鍵用、production:本番環境用) +spring.profiles.group.local=common,dev +spring.profiles.group.production=common,prd +spring.profiles.group.test=common,ut +# 環境情報未指定の場合に使用するプロファイル(環境情報を指定する場合、起動コマンドに「-Dspring.profiles.active=<プロファイル名>'」を追加する) +spring.profiles.default=local + +# Open API 仕様書を自動生成する際keyをアルファベット順でソートする +springdoc.writer-with-order-by-keys=true \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java similarity index 100% rename from samples/web-csr/dressca-backend/web/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java rename to samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java diff --git a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/WebApplicationTests.java b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/WebApplicationTests.java similarity index 85% rename from samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/WebApplicationTests.java rename to samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/WebApplicationTests.java index 4a0cb6732..98d777708 100644 --- a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/WebApplicationTests.java +++ b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/WebApplicationTests.java @@ -1,4 +1,4 @@ -package com.dressca.web; +package com.dressca.web.admin; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; diff --git a/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controller/AssetsControllerTest.java b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controller/AssetsControllerTest.java new file mode 100644 index 000000000..05edd2deb --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controller/AssetsControllerTest.java @@ -0,0 +1,51 @@ +package com.dressca.web.admin.controller; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import com.dressca.web.admin.WebApplication; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import org.springframework.test.web.servlet.MockMvc; + +/** + * {@link AssetsController}の動作をテストするクラスです。 + */ +@SpringJUnitConfig +@SpringBootTest(classes = WebApplication.class) +@AutoConfigureMockMvc +@WithMockUser(roles = { "ADMIN" }) +public class AssetsControllerTest { + + @Autowired + private MockMvc mockMvc; + + @Test + @DisplayName("testGet_01_正常系_存在するアセットコード") + void testGet_01() throws Exception { + // テスト用の入力データ + String assetCode = "b52dc7f712d94ca5812dd995bf926c04"; + + // 期待する戻り値 + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.IMAGE_PNG_VALUE)); + } + + @Test + @DisplayName("testGet_02_異常系_存在しないアセットコード") + void testGet_02() throws Exception { + // テスト用の入力データ + String assetCode = "NotExistAssetCode"; + + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isNotFound()); + } +} diff --git a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/HealthCheckTest.java b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controller/HealthCheckTest.java similarity index 92% rename from samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/HealthCheckTest.java rename to samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controller/HealthCheckTest.java index 15e89f6c9..7a4730acd 100644 --- a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/HealthCheckTest.java +++ b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controller/HealthCheckTest.java @@ -1,42 +1,42 @@ -package com.dressca.web.controller; - -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import com.dressca.web.WebApplication; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import org.springframework.test.web.servlet.MockMvc; - -/** - * ヘルスチェックAPIの動作をテストするクラスです。 - */ -@SpringJUnitConfig -@SpringBootTest(classes = WebApplication.class) -@AutoConfigureMockMvc -public class HealthCheckTest { - - @Autowired - private MockMvc mockMvc; - - @Test - @DisplayName("testGet_03_ヘルスチェック_サーバ正常動作確認") - void testGet_serverCheck() throws Exception { - this.mockMvc.perform(get("/api/health/check")) - .andExpect(status().isOk()) - .andExpect(content().json("{'status':'UP'}")); - } - - @Test - @DisplayName("testGet_04_ヘルスチェック_DB正常動作確認") - void testGet_databaseCheck() throws Exception { - this.mockMvc.perform(get("/api/health/datasource")) - .andExpect(status().isOk()) - .andExpect(content().json("{'status':'UP'}")); - } -} +package com.dressca.web.admin.controller; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import com.dressca.web.admin.WebApplication; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import org.springframework.test.web.servlet.MockMvc; + +/** + * ヘルスチェックAPIの動作をテストするクラスです。 + */ +@SpringJUnitConfig +@SpringBootTest(classes = WebApplication.class) +@AutoConfigureMockMvc +public class HealthCheckTest { + + @Autowired + private MockMvc mockMvc; + + @Test + @DisplayName("testGet_03_ヘルスチェック_サーバ正常動作確認") + void testGet_serverCheck() throws Exception { + this.mockMvc.perform(get("/api/health/check")) + .andExpect(status().isOk()) + .andExpect(content().json("{'status':'UP'}")); + } + + @Test + @DisplayName("testGet_04_ヘルスチェック_DB正常動作確認") + void testGet_databaseCheck() throws Exception { + this.mockMvc.perform(get("/api/health/datasource")) + .andExpect(status().isOk()) + .andExpect(content().json("{'status':'UP'}")); + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controlleradvice/ExceptionHandlerControllerAdviceTest.java b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controlleradvice/ExceptionHandlerControllerAdviceTest.java new file mode 100644 index 000000000..e8e9c0654 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controlleradvice/ExceptionHandlerControllerAdviceTest.java @@ -0,0 +1,193 @@ +package com.dressca.web.admin.controlleradvice; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.times; + +import com.dressca.web.admin.controller.AssetsController; +import com.dressca.systemcommon.constant.ExceptionIdConstant; +import com.dressca.systemcommon.constant.SystemPropertyConstants; +import com.dressca.systemcommon.exception.SystemException; +import com.dressca.systemcommon.util.ApplicationContextWrapper; +import com.dressca.applicationcore.assets.AssetNotFoundException; +import com.dressca.web.admin.WebApplication; +import com.dressca.web.constant.ProblemDetailsConstant; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.MessageSource; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import org.springframework.test.web.servlet.MockMvc; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.apache.logging.log4j.core.Appender; +import org.apache.logging.log4j.core.LogEvent; +import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.core.config.Configuration; +import org.apache.logging.log4j.core.config.LoggerConfig; +import java.util.Locale; + +/** + * {@link ExceptionHandlerControllerAdvice }の動作をテストするクラスです。 + */ +@SpringJUnitConfig +@SpringBootTest(classes = WebApplication.class) +@AutoConfigureMockMvc +@ActiveProfiles("production") +public class ExceptionHandlerControllerAdviceTest { + + private static final String EXCEPTION_MESSAGE_SUFFIX_LOG = "log"; + private static final String EXCEPTION_MESSAGE_SUFFIX_FRONT = "front"; + private static final String PROPERTY_DELIMITER = "."; + private static final String MOCK_APPENDER_NAME = "MockAppender"; + + @Autowired + private MockMvc mockMvc; + + @MockBean + AssetsController assetsController; + + @Mock + private Appender mockAppender; + + @Captor + private ArgumentCaptor logCaptor; + + /** + * 各テスト実施前のセットアップを行うメソッド。 + */ + @BeforeEach + public void setup() { + // アプリケーションログメッセージを取得する設定 + // Appenderの初期化 + Mockito.reset(mockAppender); + // Appenderの名前を設定 + Mockito.when(mockAppender.getName()).thenReturn(MOCK_APPENDER_NAME); + // Appenderとして利用できる準備ができていることを設定(下2行) + Mockito.when(mockAppender.isStarted()).thenReturn(true); + Mockito.when(mockAppender.isStopped()).thenReturn(false); + + this.setLogLevel(Level.INFO); + } + + private void setLogLevel(Level level) { + // application.logのロガーを取り出し、Appenderの設定(mockAppenderにログを出力させる)を行う。 + LoggerContext ctx = (LoggerContext) LogManager.getContext(false); + Configuration config = ctx.getConfiguration(); + LoggerConfig loggerConfig = config.getLoggerConfig(SystemPropertyConstants.APPLICATION_LOG_LOGGER); + + // テスト毎にAppenderを設定するため、一度初期化する。 + loggerConfig.removeAppender(MOCK_APPENDER_NAME); + + loggerConfig.setLevel(level); + loggerConfig.addAppender(mockAppender, level, null); + ctx.updateLoggers(); + } + + @Test + @DisplayName("testException_01_正常系_その他の業務エラーをステータースコード500で返却する(本番環境)。") + void testException_01() throws Exception { + // テスト用の入力データ + String assetCode = "b52dc7f712d94ca5812dd995bf926c04"; + // 期待値の設定 + String exceptionId = ExceptionIdConstant.E_ASSET0001; + String[] frontMessageValue = { assetCode }; + String[] logMessageValue = { assetCode }; + // モックの戻り値設定 + Mockito.when(assetsController.get(anyString())) + .thenThrow(new AssetNotFoundException(assetCode)); + // APIの呼び出しとエラー時のレスポンスであることの確認 + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isInternalServerError()) + .andExpect(content().json("{\"title\":\"" + ProblemDetailsConstant.LOGIC_ERROR_TITLE + "\"}")) + .andExpect(jsonPath("$.error." + exceptionId) + .value(createFrontErrorMessage(exceptionId, frontMessageValue))) + .andExpect(jsonPath("$.detail").doesNotExist()); + // アプリケーションログのメッセージの確認 + Mockito.verify(mockAppender, times(1)).append(logCaptor.capture()); + assertThat(logCaptor.getValue().getLevel()).isEqualTo(Level.ERROR); + assertThat(logCaptor.getValue().getMessage().getFormattedMessage()) + .startsWith(createLogMessage(exceptionId, logMessageValue)); + } + + @Test + @DisplayName("testException_02_正常系_その他のシステムエラーをステータースコード500で返却する(本番環境)。") + void testException_02() throws Exception { + // テスト用の入力データ + String assetCode = "b52dc7f712d94ca5812dd995bf926c04"; + // 期待値の設定 + String exceptionId = ExceptionIdConstant.E_SHARE0000; + String[] frontMessageValue = null; + String[] logMessageValue = null; + // モックの戻り値設定 + Mockito.when(assetsController.get(anyString())) + .thenThrow(new SystemException(new AssetNotFoundException(assetCode), exceptionId, frontMessageValue, + logMessageValue)); + // APIの呼び出しとエラー時のレスポンスであることの確認 + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isInternalServerError()) + .andExpect(content().json("{\"title\":\"" + ProblemDetailsConstant.SYSTEM_ERROR_TITLE + "\"}")) + .andExpect(jsonPath("$.error." + exceptionId) + .value(createFrontErrorMessage(exceptionId, frontMessageValue))) + .andExpect(jsonPath("$.detail").doesNotExist()); + // アプリケーションログのメッセージの確認 + Mockito.verify(mockAppender, times(1)).append(logCaptor.capture()); + assertThat(logCaptor.getValue().getLevel()).isEqualTo(Level.ERROR); + assertThat(logCaptor.getValue().getMessage().getFormattedMessage()) + .startsWith(createLogMessage(exceptionId, logMessageValue)); + } + + @Test + @DisplayName("testException_03_正常系_上記のいずれにも当てはまらない例外をステータースコード500で返却する(本番環境)。") + void testException_03() throws Exception { + // テスト用の入力データ + String assetCode = "b52dc7f712d94ca5812dd995bf926c04"; + // 期待値の設定 + String exceptionId = ExceptionIdConstant.E_SHARE0000; + String[] frontMessageValue = null; + String[] logMessageValue = null; + // モックの戻り値設定 + Mockito.when(assetsController.get(anyString())) + .thenThrow(new RuntimeException()); + // APIの呼び出しとエラー時のレスポンスであることの確認 + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isInternalServerError()) + .andExpect(content().json("{\"title\":\"" + ProblemDetailsConstant.SYSTEM_ERROR_TITLE + "\"}")) + .andExpect(jsonPath("$.error." + exceptionId) + .value(createFrontErrorMessage(exceptionId, frontMessageValue))) + .andExpect(jsonPath("$.detail").doesNotExist()); + // アプリケーションログのメッセージの確認 + Mockito.verify(mockAppender, times(1)).append(logCaptor.capture()); + assertThat(logCaptor.getValue().getLevel()).isEqualTo(Level.ERROR); + assertThat(logCaptor.getValue().getMessage().getFormattedMessage()) + .startsWith(createLogMessage(exceptionId, logMessageValue)); + } + + // エラー時のアプリケーションログ出力メッセージの先頭行を返す(2行目以降はエラーのスタックトレースのため可変) + private String createLogMessage(String exceptionId, String[] logMessageValue) { + MessageSource messageSource = (MessageSource) ApplicationContextWrapper.getBean(MessageSource.class); + String code = String.join(PROPERTY_DELIMITER, exceptionId, EXCEPTION_MESSAGE_SUFFIX_LOG); + String exceptionMessage = messageSource.getMessage(code, logMessageValue, Locale.getDefault()); + return exceptionId + " " + exceptionMessage + SystemPropertyConstants.LINE_SEPARATOR; + } + + // エラー時のフロントに出力するメッセージを返す + private String createFrontErrorMessage(String exceptionId, String[] frontMessageValue) { + String code = String.join(PROPERTY_DELIMITER, exceptionId, EXCEPTION_MESSAGE_SUFFIX_FRONT); + MessageSource messageSource = (MessageSource) ApplicationContextWrapper.getBean(MessageSource.class); + return messageSource.getMessage(code, frontMessageValue, Locale.getDefault()); + } +} diff --git a/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controlleradvice/LocalExceptionHandlerControllerAdviceTest.java b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controlleradvice/LocalExceptionHandlerControllerAdviceTest.java new file mode 100644 index 000000000..ea2cf6e2e --- /dev/null +++ b/samples/web-csr/dressca-backend/web-admin/src/test/java/com/dressca/web/admin/controlleradvice/LocalExceptionHandlerControllerAdviceTest.java @@ -0,0 +1,192 @@ +package com.dressca.web.admin.controlleradvice; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.times; + +import com.dressca.web.admin.controller.AssetsController; +import com.dressca.systemcommon.constant.ExceptionIdConstant; +import com.dressca.systemcommon.constant.SystemPropertyConstants; +import com.dressca.systemcommon.exception.SystemException; +import com.dressca.systemcommon.util.ApplicationContextWrapper; +import com.dressca.applicationcore.assets.AssetNotFoundException; +import com.dressca.web.admin.WebApplication; +import com.dressca.web.constant.ProblemDetailsConstant; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.MessageSource; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import org.springframework.test.web.servlet.MockMvc; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.apache.logging.log4j.core.Appender; +import org.apache.logging.log4j.core.LogEvent; +import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.core.config.Configuration; +import org.apache.logging.log4j.core.config.LoggerConfig; +import java.util.Locale; + +/** + * {@link ExceptionHandlerControllerAdvice }の動作をテストするクラスです。 + */ +@SpringJUnitConfig +@SpringBootTest(classes = WebApplication.class) +@AutoConfigureMockMvc +@ActiveProfiles("local") +public class LocalExceptionHandlerControllerAdviceTest { + + private static final String EXCEPTION_MESSAGE_SUFFIX_LOG = "log"; + private static final String EXCEPTION_MESSAGE_SUFFIX_FRONT = "front"; + private static final String PROPERTY_DELIMITER = "."; + private static final String MOCK_APPENDER_NAME = "MockAppender"; + + @Autowired + private MockMvc mockMvc; + + @MockBean + AssetsController assetsController; + + @Mock + private Appender mockAppender; + + @Captor + private ArgumentCaptor logCaptor; + + /** + * 各テスト実施前のセットアップを行うメソッド。 + */ + @BeforeEach + public void setup() { + // アプリケーションログメッセージを取得する設定 + // Appenderの初期化 + Mockito.reset(mockAppender); + // Appenderの名前を設定 + Mockito.when(mockAppender.getName()).thenReturn(MOCK_APPENDER_NAME); + // Appenderとして利用できる準備ができていることを設定(下2行) + Mockito.when(mockAppender.isStarted()).thenReturn(true); + Mockito.when(mockAppender.isStopped()).thenReturn(false); + + this.setLogLevel(Level.INFO); + } + + private void setLogLevel(Level level) { + // application.logのロガーを取り出し、Appenderの設定(mockAppenderにログを出力させる)を行う。 + LoggerContext ctx = (LoggerContext) LogManager.getContext(false); + Configuration config = ctx.getConfiguration(); + LoggerConfig loggerConfig = config.getLoggerConfig(SystemPropertyConstants.APPLICATION_LOG_LOGGER); + + // テスト毎にAppenderを設定するため、一度初期化する。 + loggerConfig.removeAppender(MOCK_APPENDER_NAME); + + loggerConfig.setLevel(level); + loggerConfig.addAppender(mockAppender, level, null); + ctx.updateLoggers(); + } + + @Test + @DisplayName("testException_01_正常系_その他の業務エラーをステータースコード500で返却する(開発環境)。") + void testException_01() throws Exception { + // テスト用の入力データ + String assetCode = "b52dc7f712d94ca5812dd995bf926c04"; + // 期待値の設定 + String exceptionId = ExceptionIdConstant.E_ASSET0001; + String[] frontMessageValue = { assetCode }; + String[] logMessageValue = { assetCode }; + // モックの戻り値設定 + Mockito.when(assetsController.get(anyString())) + .thenThrow(new AssetNotFoundException(assetCode)); + // APIの呼び出しとエラー時のレスポンスであることの確認 + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isInternalServerError()) + .andExpect(content().json("{\"title\":\"" + ProblemDetailsConstant.LOGIC_ERROR_TITLE + "\"}")) + .andExpect(jsonPath("$.error." + exceptionId) + .value(createFrontErrorMessage(exceptionId, frontMessageValue))) + .andExpect(jsonPath("$.detail").exists()); + Mockito.verify(mockAppender, times(1)).append(logCaptor.capture()); + assertThat(logCaptor.getValue().getLevel()).isEqualTo(Level.ERROR); + assertThat(logCaptor.getValue().getMessage().getFormattedMessage()) + .startsWith(createLogMessage(exceptionId, logMessageValue)); + } + + @Test + @DisplayName("testException_02_正常系_その他のシステムエラーをステータースコード500で返却する(開発環境)。") + void testException_02() throws Exception { + // テスト用の入力データ + String assetCode = "b52dc7f712d94ca5812dd995bf926c04"; + // 期待値の設定 + String exceptionId = ExceptionIdConstant.E_SHARE0000; + String[] frontMessageValue = null; + String[] logMessageValue = null; + // モックの戻り値設定 + Mockito.when(assetsController.get(anyString())) + .thenThrow(new SystemException(new AssetNotFoundException(assetCode), exceptionId, frontMessageValue, + logMessageValue)); + // APIの呼び出しとエラー時のレスポンスであることの確認 + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isInternalServerError()) + .andExpect(content().json("{\"title\":\"" + ProblemDetailsConstant.SYSTEM_ERROR_TITLE + "\"}")) + .andExpect(jsonPath("$.error." + exceptionId) + .value(createFrontErrorMessage(exceptionId, frontMessageValue))) + .andExpect(jsonPath("$.detail").exists()); + // アプリケーションログのメッセージの確認 + Mockito.verify(mockAppender, times(1)).append(logCaptor.capture()); + assertThat(logCaptor.getValue().getLevel()).isEqualTo(Level.ERROR); + assertThat(logCaptor.getValue().getMessage().getFormattedMessage()) + .startsWith(createLogMessage(exceptionId, logMessageValue)); + } + + @Test + @DisplayName("testException_03_正常系_上記のいずれにも当てはまらない例外をステータースコード500で返却する(開発環境)。") + void testException_03() throws Exception { + // テスト用の入力データ + String assetCode = "b52dc7f712d94ca5812dd995bf926c04"; + // 期待値の設定 + String exceptionId = ExceptionIdConstant.E_SHARE0000; + String[] frontMessageValue = null; + String[] logMessageValue = null; + // モックの戻り値設定 + Mockito.when(assetsController.get(anyString())) + .thenThrow(new RuntimeException()); + // APIの呼び出しとエラー時のレスポンスであることの確認 + this.mockMvc.perform(get("/api/assets/" + assetCode)) + .andExpect(status().isInternalServerError()) + .andExpect(content().json("{\"title\":\"" + ProblemDetailsConstant.SYSTEM_ERROR_TITLE + "\"}")) + .andExpect(jsonPath("$.error." + exceptionId) + .value(createFrontErrorMessage(exceptionId, frontMessageValue))) + .andExpect(jsonPath("$.detail").exists()); + // アプリケーションログのメッセージの確認 + Mockito.verify(mockAppender, times(1)).append(logCaptor.capture()); + assertThat(logCaptor.getValue().getLevel()).isEqualTo(Level.ERROR); + assertThat(logCaptor.getValue().getMessage().getFormattedMessage()) + .startsWith(createLogMessage(exceptionId, logMessageValue)); + } + + // エラー時のアプリケーションログ出力メッセージの先頭行を返す(2行目以降はエラーのスタックトレースのため可変) + private String createLogMessage(String exceptionId, String[] logMessageValue) { + MessageSource messageSource = (MessageSource) ApplicationContextWrapper.getBean(MessageSource.class); + String code = String.join(PROPERTY_DELIMITER, exceptionId, EXCEPTION_MESSAGE_SUFFIX_LOG); + String exceptionMessage = messageSource.getMessage(code, logMessageValue, Locale.getDefault()); + return exceptionId + " " + exceptionMessage + SystemPropertyConstants.LINE_SEPARATOR; + } + + // エラー時のフロントに出力するメッセージを返す + private String createFrontErrorMessage(String exceptionId, String[] frontMessageValue) { + String code = String.join(PROPERTY_DELIMITER, exceptionId, EXCEPTION_MESSAGE_SUFFIX_FRONT); + MessageSource messageSource = (MessageSource) ApplicationContextWrapper.getBean(MessageSource.class); + return messageSource.getMessage(code, frontMessageValue, Locale.getDefault()); + } +} diff --git a/samples/web-csr/dressca-backend/web-consumer/.gitignore b/samples/web-csr/dressca-backend/web-consumer/.gitignore new file mode 100644 index 000000000..c2065bc26 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/.gitignore @@ -0,0 +1,37 @@ +HELP.md +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ diff --git a/samples/web-csr/dressca-backend/web-consumer/build.gradle b/samples/web-csr/dressca-backend/web-consumer/build.gradle new file mode 100644 index 000000000..7b368d30d --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/build.gradle @@ -0,0 +1,61 @@ +plugins { + id 'java' + id 'org.springframework.boot' version "${springBootVersion}" + id 'io.spring.dependency-management' version "${springDependencyManagementVersion}" + id 'org.springdoc.openapi-gradle-plugin' version "${springdocOpenapiGradlePluginVersion}" +} + +group = 'com.dressca' +version = '0.0.1-SNAPSHOT' + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +repositories { + mavenCentral() +} + +dependencies { + implementation supportDependencies.spring_boot_starter_web + implementation supportDependencies.spring_boot_starter_validation + implementation supportDependencies.spring_boot_starter_actuator + implementation supportDependencies.springdoc_openapi_starter_webmvc_ui + implementation supportDependencies.commons_lang3 + implementation supportDependencies.spring_boot_security_starter + implementation supportDependencies.h2database + + implementation project(':web') + implementation project(':application-core') + implementation project(':infrastructure') + implementation project(':system-common') + + testImplementation supportDependencies.spring_boot_starter_test + testImplementation supportDependencies.spring_boot_starter_log4j2 + testImplementation supportDependencies.spring_security_test + + compileOnly supportDependencies.servlet_api +} + +configurations { + all { + exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' + } +} +afterEvaluate { + tasks.named("forkedSpringBootRun") { + workingDir("$rootDir/api-docs/web-consumer") + } +} +openApi { + apiDocsUrl.set("http://localhost:8080/api-docs") + outputDir.set(file("$rootDir/api-docs/web-consumer")) + outputFileName.set("api-specification.json") +} +tasks.named('test') { + useJUnitPlatform() +} + +build.dependsOn("generateOpenApiDocs") \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-consumer/gradle/wrapper/gradle-wrapper.jar b/samples/web-csr/dressca-backend/web-consumer/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..e6441136f Binary files /dev/null and b/samples/web-csr/dressca-backend/web-consumer/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/web-csr/dressca-backend/web-consumer/gradle/wrapper/gradle-wrapper.properties b/samples/web-csr/dressca-backend/web-consumer/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..a4413138c --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/web-csr/dressca-backend/web-consumer/gradlew b/samples/web-csr/dressca-backend/web-consumer/gradlew new file mode 100644 index 000000000..b740cf133 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License 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. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/web-csr/dressca-backend/web-consumer/gradlew.bat b/samples/web-csr/dressca-backend/web-consumer/gradlew.bat new file mode 100644 index 000000000..25da30dbd --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/web-csr/dressca-backend/web-consumer/settings.gradle b/samples/web-csr/dressca-backend/web-consumer/settings.gradle new file mode 100644 index 000000000..2015facfd --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'web-consumer' diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/WebApplication.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/WebApplication.java new file mode 100644 index 000000000..15ab52678 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/WebApplication.java @@ -0,0 +1,21 @@ +package com.dressca.web.consumer; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.info.Info; + +/** + * Dresscaアプリケーションを起動するためのmainクラスです。 + */ +@SpringBootApplication +@OpenAPIDefinition(info = @Info(title = "Dressca", description = "ECサイトDressca", version = "v1")) +@ComponentScan(basePackages = { "com.dressca" }) +public class WebApplication { + + public static void main(String[] args) { + SpringApplication.run(WebApplication.class, args); + } + +} diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/config/DresscaWebConfig.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/config/DresscaWebConfig.java similarity index 76% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/config/DresscaWebConfig.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/config/DresscaWebConfig.java index 4d867c30d..415586f23 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/config/DresscaWebConfig.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/config/DresscaWebConfig.java @@ -1,7 +1,7 @@ -package com.dressca.web.config; +package com.dressca.web.consumer.config; -import com.dressca.web.filter.BuyerIdFilter; -import com.dressca.web.security.CookieSettings; +import com.dressca.web.consumer.filter.BuyerIdFilter; +import com.dressca.web.consumer.security.CookieSettings; import jakarta.servlet.Filter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.FilterRegistrationBean; @@ -17,6 +17,9 @@ public class DresscaWebConfig { @Autowired private CookieSettings cookieSettings; + @Autowired(required = false) + public H2ServerLauncher h2ServerLauncher; + /** * BuyerIdFilter の設定。 * diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/config/H2ServerLauncher.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/config/H2ServerLauncher.java new file mode 100644 index 000000000..802a00d70 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/config/H2ServerLauncher.java @@ -0,0 +1,40 @@ +package com.dressca.web.consumer.config; + +import org.h2.tools.Server; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; +import java.sql.SQLException; + +/** + * 開発環境でh2データベースを立ち上げるためのクラスです。 + */ +@Component +@Profile("local") +public class H2ServerLauncher { + + private Server tcpServer; + + /** + * h2サーバをサーバーモードで起動します。 + */ + @PostConstruct + public void start() { + try { + this.tcpServer = Server.createTcpServer("-tcpPort", "9092", "-tcpAllowOthers", "-ifNotExists").start(); + } catch (SQLException e) { + System.out.println("H2 server is already started."); + } + } + + /** + * h2サーバを停止します。 + */ + @PreDestroy + public void stop() { + if (this.tcpServer != null) { + this.tcpServer.stop(); + } + } +} \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/AssetsController.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/AssetsController.java new file mode 100644 index 000000000..d40df7d7b --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/AssetsController.java @@ -0,0 +1,84 @@ +package com.dressca.web.consumer.controller; + +import com.dressca.applicationcore.applicationservice.AssetApplicationService; +import com.dressca.applicationcore.assets.Asset; +import com.dressca.applicationcore.assets.AssetNotFoundException; +import com.dressca.applicationcore.assets.AssetResourceInfo; +import com.dressca.applicationcore.assets.AssetTypes; +import com.dressca.systemcommon.constant.SystemPropertyConstants; +import com.dressca.systemcommon.exception.LogicException; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.Resource; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.AllArgsConstructor; + +/** + * {@link Asset} の情報にアクセスするAPIコントローラーです。 + */ +@RestController +@Tag(name = "Assets", description = "アセットの情報にアクセスするAPI") +@RequestMapping("/api/assets") +@AllArgsConstructor +public class AssetsController { + + @Autowired + private AssetApplicationService service; + + private static final Logger apLog = LoggerFactory.getLogger(SystemPropertyConstants.APPLICATION_LOG_LOGGER); + + /** + * アセットを取得します。 + * + * @param assetCode アセットコード + * @return アセット + */ + @Operation(summary = "アセットを取得する.", description = "与えられたアセットコードに対応するアセットを返却する.") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "成功.", content = @Content(mediaType = "image/*", schema = @Schema(implementation = Resource.class))), + @ApiResponse(responseCode = "404", description = "アセットコードに対応するアセットがない.", content = @Content) }) + @GetMapping("{assetCode}") + public ResponseEntity get( + @Parameter(required = true, description = "アセットコード") @PathVariable("assetCode") String assetCode) + throws LogicException { + try { + AssetResourceInfo assetResourceInfo = this.service.getAssetResourceInfo(assetCode); + MediaType contentType = getContentType(assetResourceInfo.getAsset()); + + return ResponseEntity.ok().contentType(contentType).body(assetResourceInfo.getResource()); + } catch (AssetNotFoundException e) { + apLog.info(e.getMessage()); + apLog.debug(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.notFound().build(); + } + } + + /** + * アセットタイプから Content-Type に変換します。 + * + * @param asset アセット + * @return Content-Type の名称 + */ + private MediaType getContentType(Asset asset) { + switch (asset.getAssetType()) { + case AssetTypes.png: + return MediaType.IMAGE_PNG; + default: + throw new IllegalArgumentException("指定したアセットのアセットタイプは Content-Type に変換できません。"); + } + } +} diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/BasketItemController.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/BasketItemController.java similarity index 95% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/BasketItemController.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/BasketItemController.java index 2c1dc33fc..bcfa0c7c3 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/BasketItemController.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/BasketItemController.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller; +package com.dressca.web.consumer.controller; import com.dressca.applicationcore.applicationservice.BasketDetail; import com.dressca.applicationcore.applicationservice.ShoppingApplicationService; @@ -7,13 +7,13 @@ import com.dressca.applicationcore.baskets.CatalogItemInBasketNotFoundException; import com.dressca.applicationcore.catalog.CatalogItem; import com.dressca.applicationcore.catalog.CatalogNotFoundException; -import com.dressca.web.controller.dto.baskets.BasketItemResponse; -import com.dressca.web.controller.dto.baskets.BasketResponse; -import com.dressca.web.controller.dto.baskets.PostBasketItemsRequest; -import com.dressca.web.controller.dto.baskets.PutBasketItemsRequest; -import com.dressca.web.controller.dto.catalog.CatalogItemSummaryResponse; -import com.dressca.web.mapper.BasketMapper; -import com.dressca.web.mapper.CatalogItemSummaryMapper; +import com.dressca.web.consumer.controller.dto.baskets.BasketItemResponse; +import com.dressca.web.consumer.controller.dto.baskets.BasketResponse; +import com.dressca.web.consumer.controller.dto.baskets.PostBasketItemsRequest; +import com.dressca.web.consumer.controller.dto.baskets.PutBasketItemsRequest; +import com.dressca.web.consumer.controller.dto.catalog.CatalogItemSummaryResponse; +import com.dressca.web.consumer.mapper.BasketMapper; +import com.dressca.web.consumer.mapper.CatalogItemSummaryMapper; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogBrandsController.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogBrandsController.java similarity index 91% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogBrandsController.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogBrandsController.java index e5fa072c8..899136a60 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogBrandsController.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogBrandsController.java @@ -1,11 +1,11 @@ -package com.dressca.web.controller; +package com.dressca.web.consumer.controller; import java.util.List; import java.util.stream.Collectors; import com.dressca.applicationcore.applicationservice.CatalogApplicationService; import com.dressca.applicationcore.catalog.CatalogBrand; -import com.dressca.web.controller.dto.catalog.CatalogBrandResponse; -import com.dressca.web.mapper.CatalogBrandMapper; +import com.dressca.web.consumer.controller.dto.catalog.CatalogBrandResponse; +import com.dressca.web.consumer.mapper.CatalogBrandMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogCategoriesController.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogCategoriesController.java similarity index 91% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogCategoriesController.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogCategoriesController.java index 5b19c3fd7..fa74a450a 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogCategoriesController.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogCategoriesController.java @@ -1,11 +1,11 @@ -package com.dressca.web.controller; +package com.dressca.web.consumer.controller; import java.util.List; import java.util.stream.Collectors; import com.dressca.applicationcore.applicationservice.CatalogApplicationService; import com.dressca.applicationcore.catalog.CatalogCategory; -import com.dressca.web.controller.dto.catalog.CatalogCategoryResponse; -import com.dressca.web.mapper.CatalogCategoryMapper; +import com.dressca.web.consumer.controller.dto.catalog.CatalogCategoryResponse; +import com.dressca.web.consumer.mapper.CatalogCategoryMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogItemsController.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogItemsController.java similarity index 88% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogItemsController.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogItemsController.java index 73402d341..24139cdba 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/CatalogItemsController.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/CatalogItemsController.java @@ -1,12 +1,12 @@ -package com.dressca.web.controller; +package com.dressca.web.consumer.controller; import java.util.List; import java.util.stream.Collectors; import com.dressca.applicationcore.applicationservice.CatalogApplicationService; import com.dressca.applicationcore.catalog.CatalogItem; -import com.dressca.web.controller.dto.catalog.CatalogItemResponse; -import com.dressca.web.controller.dto.catalog.PagedListOfCatalogItemResponse; -import com.dressca.web.mapper.CatalogItemMapper; +import com.dressca.web.consumer.controller.dto.catalog.CatalogItemResponse; +import com.dressca.web.consumer.controller.dto.catalog.PagedListOfCatalogItemResponse; +import com.dressca.web.consumer.mapper.CatalogItemMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -52,7 +52,7 @@ public ResponseEntity getByQuery( @RequestParam(name = "categoryId", defaultValue = "0") long categoryId, @RequestParam(name = "page", defaultValue = "0") int page, @RequestParam(name = "pageSize", defaultValue = "20") int pageSize) { - List items = service.getCatalogItems(brandId, categoryId, page, pageSize).stream() + List items = service.getCatalogItemsByConsumer(brandId, categoryId, page, pageSize).stream() .map(CatalogItemMapper::convert) .collect(Collectors.toList()); int totalCount = service.countCatalogItems(brandId, categoryId); diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/OrderController.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/OrderController.java similarity index 95% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/OrderController.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/OrderController.java index 9822ba95d..ca1b0f411 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/OrderController.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/OrderController.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller; +package com.dressca.web.consumer.controller; import com.dressca.applicationcore.applicationservice.ShoppingApplicationService; import com.dressca.applicationcore.applicationservice.OrderApplicationService; @@ -10,9 +10,9 @@ import com.dressca.systemcommon.constant.ExceptionIdConstant; import com.dressca.systemcommon.constant.SystemPropertyConstants; import com.dressca.systemcommon.exception.SystemException; -import com.dressca.web.controller.dto.order.OrderResponse; -import com.dressca.web.controller.dto.order.PostOrderRequest; -import com.dressca.web.mapper.OrderMapper; +import com.dressca.web.consumer.controller.dto.order.OrderResponse; +import com.dressca.web.consumer.controller.dto.order.PostOrderRequest; +import com.dressca.web.consumer.mapper.OrderMapper; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/accounting/AccountResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/accounting/AccountResponse.java similarity index 90% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/accounting/AccountResponse.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/accounting/AccountResponse.java index 0c9e8b713..3075cd67b 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/accounting/AccountResponse.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/accounting/AccountResponse.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.accounting; +package com.dressca.web.consumer.controller.dto.accounting; import java.math.BigDecimal; import jakarta.validation.constraints.NotNull; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/BasketItemResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/BasketItemResponse.java similarity index 80% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/BasketItemResponse.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/BasketItemResponse.java index a61265925..e6a681aa3 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/BasketItemResponse.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/BasketItemResponse.java @@ -1,8 +1,8 @@ -package com.dressca.web.controller.dto.baskets; +package com.dressca.web.consumer.controller.dto.baskets; import java.math.BigDecimal; import jakarta.validation.constraints.NotNull; -import com.dressca.web.controller.dto.catalog.CatalogItemSummaryResponse; +import com.dressca.web.consumer.controller.dto.catalog.CatalogItemSummaryResponse; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/BasketResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/BasketResponse.java similarity index 77% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/BasketResponse.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/BasketResponse.java index 7dc0533e2..63a463fc0 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/BasketResponse.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/BasketResponse.java @@ -1,8 +1,8 @@ -package com.dressca.web.controller.dto.baskets; +package com.dressca.web.consumer.controller.dto.baskets; import java.util.List; import jakarta.validation.constraints.NotNull; -import com.dressca.web.controller.dto.accounting.AccountResponse; +import com.dressca.web.consumer.controller.dto.accounting.AccountResponse; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/PostBasketItemsRequest.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/PostBasketItemsRequest.java similarity index 87% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/PostBasketItemsRequest.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/PostBasketItemsRequest.java index 4c3da350c..c1f613dff 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/PostBasketItemsRequest.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/PostBasketItemsRequest.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.baskets; +package com.dressca.web.consumer.controller.dto.baskets; import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/PutBasketItemsRequest.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/PutBasketItemsRequest.java similarity index 87% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/PutBasketItemsRequest.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/PutBasketItemsRequest.java index 2b7ec8036..853118ac8 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/baskets/PutBasketItemsRequest.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/baskets/PutBasketItemsRequest.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.baskets; +package com.dressca.web.consumer.controller.dto.baskets; import jakarta.validation.constraints.NotNull; import lombok.AllArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogBrandResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogBrandResponse.java new file mode 100644 index 000000000..933167afd --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogBrandResponse.java @@ -0,0 +1,19 @@ +package com.dressca.web.consumer.controller.dto.catalog; + +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * カタログブランドの情報を取得する際に用いるdtoクラスです。 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CatalogBrandResponse { + @NotNull + private long id; + @NotNull + private String name; +} diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogCategoryResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogCategoryResponse.java new file mode 100644 index 000000000..d5c7ba012 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogCategoryResponse.java @@ -0,0 +1,19 @@ +package com.dressca.web.consumer.controller.dto.catalog; + +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * カタログカテゴリの情報を取得する際に用いるdtoクラスです。 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CatalogCategoryResponse { + @NotNull + private long id; + @NotNull + private String name; +} diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogItemResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogItemResponse.java new file mode 100644 index 000000000..a1f67be25 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogItemResponse.java @@ -0,0 +1,34 @@ +package com.dressca.web.consumer.controller.dto.catalog; + +import java.math.BigDecimal; +import java.util.List; +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * カタログアイテムを取得する際に用いるdtoクラスです。 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CatalogItemResponse { + + @NotNull + private long id; + @NotNull + private String name; + @NotNull + private String productCode; + private List assetCodes; + @NotNull + private String description; + @NotNull + private BigDecimal price; + @NotNull + private long catalogCategoryId; + @NotNull + private long catalogBrandId; + +} diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogItemSummaryResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogItemSummaryResponse.java new file mode 100644 index 000000000..d63c3c7a0 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/CatalogItemSummaryResponse.java @@ -0,0 +1,23 @@ +package com.dressca.web.consumer.controller.dto.catalog; + +import java.util.List; +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * カタログアイテムの概要を取得する際に用いるdtoクラスです。 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CatalogItemSummaryResponse { + @NotNull + private long id; + @NotNull + private String name; + @NotNull + private String productCode; + private List assetCodes; +} diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/PagedListOfCatalogItemResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/PagedListOfCatalogItemResponse.java new file mode 100644 index 000000000..f0a1a0335 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/catalog/PagedListOfCatalogItemResponse.java @@ -0,0 +1,19 @@ +package com.dressca.web.consumer.controller.dto.catalog; + +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 検索したカタログアイテムの情報を取得する際に用いるdtoクラスです。 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class PagedListOfCatalogItemResponse { + private List items; + private int totalCount; + private int page; + private int pageSize; +} diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/OrderItemResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/OrderItemResponse.java similarity index 79% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/OrderItemResponse.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/OrderItemResponse.java index 728bd3fc7..3e79af769 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/OrderItemResponse.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/OrderItemResponse.java @@ -1,8 +1,8 @@ -package com.dressca.web.controller.dto.order; +package com.dressca.web.consumer.controller.dto.order; import java.math.BigDecimal; import jakarta.validation.constraints.NotNull; -import com.dressca.web.controller.dto.catalog.CatalogItemSummaryResponse; +import com.dressca.web.consumer.controller.dto.catalog.CatalogItemSummaryResponse; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/OrderResponse.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/OrderResponse.java similarity index 85% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/OrderResponse.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/OrderResponse.java index 0d470b23d..497510af6 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/OrderResponse.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/OrderResponse.java @@ -1,9 +1,9 @@ -package com.dressca.web.controller.dto.order; +package com.dressca.web.consumer.controller.dto.order; import java.time.LocalDateTime; import java.util.List; import jakarta.validation.constraints.NotNull; -import com.dressca.web.controller.dto.accounting.AccountResponse; +import com.dressca.web.consumer.controller.dto.accounting.AccountResponse; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/PostOrderRequest.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/PostOrderRequest.java similarity index 91% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/PostOrderRequest.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/PostOrderRequest.java index 556916b52..349c665d9 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/dto/order/PostOrderRequest.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/controller/dto/order/PostOrderRequest.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller.dto.order; +package com.dressca.web.consumer.controller.dto.order; import jakarta.validation.constraints.NotNull; import org.hibernate.validator.constraints.Length; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/filter/BuyerIdFilter.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/filter/BuyerIdFilter.java similarity index 95% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/filter/BuyerIdFilter.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/filter/BuyerIdFilter.java index 4842a3858..83af7bc30 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/filter/BuyerIdFilter.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/filter/BuyerIdFilter.java @@ -1,4 +1,4 @@ -package com.dressca.web.filter; +package com.dressca.web.consumer.filter; import java.io.IOException; import java.util.UUID; @@ -14,7 +14,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseCookie; -import com.dressca.web.security.CookieSettings; +import com.dressca.web.consumer.security.CookieSettings; /** * 購入者IDにフィルターをかけるクラスです。 diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/BasketItemMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/BasketItemMapper.java similarity index 86% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/BasketItemMapper.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/BasketItemMapper.java index 6d8aca1f6..7fda96242 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/BasketItemMapper.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/BasketItemMapper.java @@ -1,7 +1,7 @@ -package com.dressca.web.mapper; +package com.dressca.web.consumer.mapper; import com.dressca.applicationcore.baskets.BasketItem; -import com.dressca.web.controller.dto.baskets.BasketItemResponse; +import com.dressca.web.consumer.controller.dto.baskets.BasketItemResponse; /** * {@link BasketItem} と {@link BasketItemResponse} のマッパーです。 diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/BasketMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/BasketMapper.java similarity index 81% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/BasketMapper.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/BasketMapper.java index 720216302..fdf1f0b61 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/BasketMapper.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/BasketMapper.java @@ -1,12 +1,12 @@ -package com.dressca.web.mapper; +package com.dressca.web.consumer.mapper; import java.util.List; import java.util.stream.Collectors; import com.dressca.applicationcore.accounting.Account; import com.dressca.applicationcore.baskets.Basket; -import com.dressca.web.controller.dto.accounting.AccountResponse; -import com.dressca.web.controller.dto.baskets.BasketItemResponse; -import com.dressca.web.controller.dto.baskets.BasketResponse; +import com.dressca.web.consumer.controller.dto.accounting.AccountResponse; +import com.dressca.web.consumer.controller.dto.baskets.BasketItemResponse; +import com.dressca.web.consumer.controller.dto.baskets.BasketResponse; /** * {@link Basket} と {@link BasketResponse} のマッパーです。 diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogBrandMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogBrandMapper.java new file mode 100644 index 000000000..81ac7ee2d --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogBrandMapper.java @@ -0,0 +1,23 @@ +package com.dressca.web.consumer.mapper; + +import com.dressca.applicationcore.catalog.CatalogBrand; +import com.dressca.web.consumer.controller.dto.catalog.CatalogBrandResponse; + +/** + * {@link CatalogBrand} と {@link CatalogBrandResponse} のマッパーです。 + */ +public class CatalogBrandMapper { + + /** + * {@link CatalogBrand} オブジェクトを {@link CatalogBrandResponse} に変換します。 + * + * @param catalogBrand オブジェクト + * @return {@link CatalogBrandResponse} オブジェクト + */ + public static CatalogBrandResponse convert(CatalogBrand catalogBrand) { + if (catalogBrand == null) { + return null; + } + return new CatalogBrandResponse(catalogBrand.getId(), catalogBrand.getName()); + } +} diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogCategoryMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogCategoryMapper.java similarity index 85% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogCategoryMapper.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogCategoryMapper.java index 69099ec26..44a028c19 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogCategoryMapper.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogCategoryMapper.java @@ -1,7 +1,7 @@ -package com.dressca.web.mapper; +package com.dressca.web.consumer.mapper; import com.dressca.applicationcore.catalog.CatalogCategory; -import com.dressca.web.controller.dto.catalog.CatalogCategoryResponse; +import com.dressca.web.consumer.controller.dto.catalog.CatalogCategoryResponse; /** * {@link CatalogCategory} と {@link CatalogCategoryResponse} のマッパーです。 diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogItemMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogItemMapper.java similarity index 90% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogItemMapper.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogItemMapper.java index 39f02cf07..917f4ef88 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogItemMapper.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogItemMapper.java @@ -1,10 +1,10 @@ -package com.dressca.web.mapper; +package com.dressca.web.consumer.mapper; import java.util.List; import java.util.stream.Collectors; import com.dressca.applicationcore.catalog.CatalogItem; import com.dressca.applicationcore.catalog.CatalogItemAsset; -import com.dressca.web.controller.dto.catalog.CatalogItemResponse; +import com.dressca.web.consumer.controller.dto.catalog.CatalogItemResponse; /** * {@link CatalogItem} と {@link CatalogItemResponse} のマッパーです。 diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogItemSummaryMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogItemSummaryMapper.java similarity index 87% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogItemSummaryMapper.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogItemSummaryMapper.java index 7f75417ec..b626e7c1f 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/CatalogItemSummaryMapper.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/CatalogItemSummaryMapper.java @@ -1,34 +1,34 @@ -package com.dressca.web.mapper; - -import java.util.List; -import java.util.stream.Collectors; -import com.dressca.applicationcore.catalog.CatalogItem; -import com.dressca.applicationcore.catalog.CatalogItemAsset; -import com.dressca.web.controller.dto.catalog.CatalogItemSummaryResponse; - -/** - * {@link CatalogItem} と {@link CatalogItemSummaryResponse} のマッパーです。 - */ -public class CatalogItemSummaryMapper { - /** - * {@link CatalogItem} オブジェクトを {@link CatalogItemSummaryResponse} に変換します。 - * - * @param item {@link CatalogItem} オブジェクト - * @return {@link CatalogItemSummaryResponse} オブジェクト - */ - public static CatalogItemSummaryResponse convert(CatalogItem item) { - if (item == null) { - return null; - } - - List assetCodes = item.getAssets().stream() - .map(CatalogItemAsset::getAssetCode) - .collect(Collectors.toList()); - - return new CatalogItemSummaryResponse( - item.getId(), - item.getName(), - item.getProductCode(), - assetCodes); - } -} +package com.dressca.web.consumer.mapper; + +import java.util.List; +import java.util.stream.Collectors; +import com.dressca.applicationcore.catalog.CatalogItem; +import com.dressca.applicationcore.catalog.CatalogItemAsset; +import com.dressca.web.consumer.controller.dto.catalog.CatalogItemSummaryResponse; + +/** + * {@link CatalogItem} と {@link CatalogItemSummaryResponse} のマッパーです。 + */ +public class CatalogItemSummaryMapper { + /** + * {@link CatalogItem} オブジェクトを {@link CatalogItemSummaryResponse} に変換します。 + * + * @param item {@link CatalogItem} オブジェクト + * @return {@link CatalogItemSummaryResponse} オブジェクト + */ + public static CatalogItemSummaryResponse convert(CatalogItem item) { + if (item == null) { + return null; + } + + List assetCodes = item.getAssets().stream() + .map(CatalogItemAsset::getAssetCode) + .collect(Collectors.toList()); + + return new CatalogItemSummaryResponse( + item.getId(), + item.getName(), + item.getProductCode(), + assetCodes); + } +} diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/OrderItemMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/OrderItemMapper.java similarity index 84% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/OrderItemMapper.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/OrderItemMapper.java index 22e005f00..c70686c66 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/OrderItemMapper.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/OrderItemMapper.java @@ -1,10 +1,10 @@ -package com.dressca.web.mapper; +package com.dressca.web.consumer.mapper; import java.util.stream.Collectors; import com.dressca.applicationcore.order.OrderItem; import com.dressca.applicationcore.order.OrderItemAsset; -import com.dressca.web.controller.dto.catalog.CatalogItemSummaryResponse; -import com.dressca.web.controller.dto.order.OrderItemResponse; +import com.dressca.web.consumer.controller.dto.catalog.CatalogItemSummaryResponse; +import com.dressca.web.consumer.controller.dto.order.OrderItemResponse; /** * {@link OrderItem} と {@link OrderItemResponse} のマッパーです。 diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/OrderMapper.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/OrderMapper.java similarity index 87% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/OrderMapper.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/OrderMapper.java index ad2c89ec8..94538c598 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/mapper/OrderMapper.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/mapper/OrderMapper.java @@ -1,9 +1,9 @@ -package com.dressca.web.mapper; +package com.dressca.web.consumer.mapper; import java.util.stream.Collectors; import com.dressca.applicationcore.order.Order; -import com.dressca.web.controller.dto.accounting.AccountResponse; -import com.dressca.web.controller.dto.order.OrderResponse; +import com.dressca.web.consumer.controller.dto.accounting.AccountResponse; +import com.dressca.web.consumer.controller.dto.order.OrderResponse; /** * {@link Order} と {@link OrderResponse} のマッパーです。 diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/security/CookieSettings.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/security/CookieSettings.java similarity index 89% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/security/CookieSettings.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/security/CookieSettings.java index 6bcb0b29b..ba3362859 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/security/CookieSettings.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/security/CookieSettings.java @@ -1,18 +1,18 @@ -package com.dressca.web.security; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; -import lombok.Data; - -/** - * Cookie の設定を格納するクラスです。 - */ -@Component -@ConfigurationProperties(prefix = "cookie.settings") -@Data -public class CookieSettings { - private String sameSite = "Strict"; - private boolean httpOnly = true; - private boolean secure = false; - private int expiredDays = 1; -} +package com.dressca.web.consumer.security; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; +import lombok.Data; + +/** + * Cookie の設定を格納するクラスです。 + */ +@Component +@ConfigurationProperties(prefix = "cookie.settings") +@Data +public class CookieSettings { + private String sameSite = "Strict"; + private boolean httpOnly = true; + private boolean secure = false; + private int expiredDays = 1; +} diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/security/WebSecurityConfig.java b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/security/WebSecurityConfig.java similarity index 95% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/security/WebSecurityConfig.java rename to samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/security/WebSecurityConfig.java index 5bbd9d0f8..8fbe2c5ee 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/security/WebSecurityConfig.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/java/com/dressca/web/consumer/security/WebSecurityConfig.java @@ -1,48 +1,48 @@ -package com.dressca.web.security; - -import java.util.Arrays; -import java.util.List; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.web.SecurityFilterChain; -import org.springframework.web.cors.CorsConfiguration; - -/** - * セキュリティ関連の実行クラス。 - */ -@Configuration(proxyBeanMethods = false) -@EnableWebSecurity -public class WebSecurityConfig { - - @Value("${cors.allowed.origins:}") - private String[] allowedOrigins; - - /** - * CORS 設定を実行。 - * - * @param http http リクエスト - * @return フィルターチェーン - * @throws Exception 例外 - */ - @Bean - public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { - http - .securityMatcher("/api/**") - .csrf(csrf -> csrf.disable()) - .cors(cors -> cors.configurationSource(request -> { - CorsConfiguration conf = new CorsConfiguration(); - conf.setAllowCredentials(true); - conf.setAllowedOrigins(Arrays.asList(allowedOrigins)); - conf.setAllowedMethods(List.of("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")); - conf.setAllowedHeaders(List.of("*")); - // 注文情報の確定にLocationを利用するため公開ヘッダーとして設定 - conf.addExposedHeader("Location"); - return conf; - })); - - return http.build(); - } -} +package com.dressca.web.consumer.security; + +import java.util.Arrays; +import java.util.List; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.web.cors.CorsConfiguration; + +/** + * セキュリティ関連の実行クラス。 + */ +@Configuration(proxyBeanMethods = false) +@EnableWebSecurity +public class WebSecurityConfig { + + @Value("${cors.allowed.origins:}") + private String[] allowedOrigins; + + /** + * CORS 設定を実行。 + * + * @param http http リクエスト + * @return フィルターチェーン + * @throws Exception 例外 + */ + @Bean + public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + http + .securityMatcher("/api/**") + .csrf(csrf -> csrf.disable()) + .cors(cors -> cors.configurationSource(request -> { + CorsConfiguration conf = new CorsConfiguration(); + conf.setAllowCredentials(true); + conf.setAllowedOrigins(Arrays.asList(allowedOrigins)); + conf.setAllowedMethods(List.of("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")); + conf.setAllowedHeaders(List.of("*")); + // 注文情報の確定にLocationを利用するため公開ヘッダーとして設定 + conf.addExposedHeader("Location"); + return conf; + })); + + return http.build(); + } +} diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-common.properties b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-common.properties new file mode 100644 index 000000000..bab1946c6 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-common.properties @@ -0,0 +1,12 @@ +# springdoc-openapi +springdoc.api-docs.path=/api-docs +springdoc.swagger-ui.path=/swagger-ui.html +springdoc.show-actuator=true + +# spring boot actuatorの設定(ステータスの変更,表示情報) +# ヘルスチェックAPIのURLを/apiから始まるように変更する +management.endpoints.web.base-path=/api +# サーバのヘルスチェック用のAPIを設定する(http://localhost:8080/api/health/check) +management.endpoint.health.group.check.include=ping +# データベースのヘルスチェック用のAPIを設定する(http://localhost:8080/api/health/datasource) +management.endpoint.health.group.datasource.include=db diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-dev.properties b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-dev.properties new file mode 100644 index 000000000..86fb2b46a --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-dev.properties @@ -0,0 +1,25 @@ +# h2 database +spring.datasource.hikari.driver-class-name=org.h2.Driver + +# DBをサーバーモードで立ち上げる場合の接続先情報 +spring.datasource.hikari.jdbc-url=jdbc:h2:tcp://localhost:9092/mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; +spring.sql.init.mode=always + +# DBを組み込みモードで立ち上げる場合の接続先情報 +# spring.datasource.hikari.jdbc-url=jdbc:h2:mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; +# spring.sql.init.mode=embedded + +spring.datasource.hikari.username= +spring.datasource.hikari.password= +spring.h2.console.enabled=true +spring.h2.console.path=/h2-console +spring.h2.console.settings.web-allow-others=true + +# ヘルスチェックの API のログを検出するため logging level を変更する +logging.level.web=DEBUG + +# CORS 設定 +cors.allowed.origins=http://localhost,http://localhost:5173 + +# ポート番号の指定 +server.port=8080 \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-prd.properties b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-prd.properties new file mode 100644 index 000000000..4d68b9aa1 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-prd.properties @@ -0,0 +1,15 @@ +# PostgreSQL database +spring.datasource.hikari.driver-class-name=org.postgresql.Driver +spring.datasource.hikari.jdbc-url=jdbc:postgresql://localhost:5432/project +spring.datasource.hikari.username=project +spring.datasource.hikari.password=project +spring.sql.init.mode=never + +# CORS 設定 +cors.allowed.origins=https://本番環境のフロントエンド配布サーバーのドメイン + +# Cookie の設定 +cookie.settings.same-site=None +cookie.settings.http-only=true +cookie.settings.secure=true +cookie.settings.expired-days=7 diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-ut.properties b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-ut.properties new file mode 100644 index 000000000..df4261b68 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application-ut.properties @@ -0,0 +1,10 @@ +# h2 database +spring.datasource.hikari.driver-class-name=org.h2.Driver +spring.datasource.hikari.jdbc-url=jdbc:h2:mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; +spring.datasource.hikari.username= +spring.datasource.hikari.password= +spring.h2.console.enabled=true +spring.h2.console.path=/h2-console +spring.h2.console.settings.web-allow-others=true +spring.sql.init.mode=embedded +mybatis.configuration.map-underscore-to-camel-case=true diff --git a/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application.properties b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application.properties new file mode 100644 index 000000000..41fa11b1e --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/main/resources/application.properties @@ -0,0 +1,9 @@ +# 環境別のプロファイル設定(common:全環境共通の設定、test:UT用、local:ローカル打鍵用、production:本番環境用) +spring.profiles.group.local=common,dev +spring.profiles.group.production=common,prd +spring.profiles.group.test=common,ut +# 環境情報未指定の場合に使用するプロファイル(環境情報を指定する場合、起動コマンドに「-Dspring.profiles.active=<プロファイル名>'」を追加する) +spring.profiles.default=local + +# Open API 仕様書を自動生成する際keyをアルファベット順でソートする +springdoc.writer-with-order-by-keys=true \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java new file mode 100644 index 000000000..c2e430bbe --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/applicationcore/applicationservice/AssetApplicationServiceTest.java @@ -0,0 +1,13 @@ +package com.dressca.applicationcore.applicationservice; + +import org.junit.jupiter.api.Test; + +/** + * {@link AssetApplicationService}の動作をテストするクラスです。 + */ +public class AssetApplicationServiceTest { + @Test + void testGetAssetResourceInfo() { + + } +} diff --git a/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/WebApplicationTests.java b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/WebApplicationTests.java new file mode 100644 index 000000000..0e8a4c683 --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/WebApplicationTests.java @@ -0,0 +1,13 @@ +package com.dressca.web.consumer; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class WebApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/AssetsControllerTest.java b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/controller/AssetsControllerTest.java similarity index 94% rename from samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/AssetsControllerTest.java rename to samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/controller/AssetsControllerTest.java index b9dd2b02a..08064e17c 100644 --- a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/AssetsControllerTest.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/controller/AssetsControllerTest.java @@ -1,10 +1,10 @@ -package com.dressca.web.controller; +package com.dressca.web.consumer.controller; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import com.dressca.web.WebApplication; +import com.dressca.web.consumer.WebApplication; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; diff --git a/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/controller/HealthCheckTest.java b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/controller/HealthCheckTest.java new file mode 100644 index 000000000..b7f92ad5c --- /dev/null +++ b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/controller/HealthCheckTest.java @@ -0,0 +1,42 @@ +package com.dressca.web.consumer.controller; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import com.dressca.web.consumer.WebApplication; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import org.springframework.test.web.servlet.MockMvc; + +/** + * ヘルスチェックAPIの動作をテストするクラスです。 + */ +@SpringJUnitConfig +@SpringBootTest(classes = WebApplication.class) +@AutoConfigureMockMvc +public class HealthCheckTest { + + @Autowired + private MockMvc mockMvc; + + @Test + @DisplayName("testGet_03_ヘルスチェック_サーバ正常動作確認") + void testGet_serverCheck() throws Exception { + this.mockMvc.perform(get("/api/health/check")) + .andExpect(status().isOk()) + .andExpect(content().json("{'status':'UP'}")); + } + + @Test + @DisplayName("testGet_04_ヘルスチェック_DB正常動作確認") + void testGet_databaseCheck() throws Exception { + this.mockMvc.perform(get("/api/health/datasource")) + .andExpect(status().isOk()) + .andExpect(content().json("{'status':'UP'}")); + } +} diff --git a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/filter/BuyerIdFilterTest.java b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/filter/BuyerIdFilterTest.java similarity index 94% rename from samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/filter/BuyerIdFilterTest.java rename to samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/filter/BuyerIdFilterTest.java index 24f3d46a2..87d55bc06 100644 --- a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/filter/BuyerIdFilterTest.java +++ b/samples/web-csr/dressca-backend/web-consumer/src/test/java/com/dressca/web/consumer/filter/BuyerIdFilterTest.java @@ -1,96 +1,96 @@ -package com.dressca.web.filter; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.http.HttpHeaders; -import org.springframework.mock.web.MockFilterChain; -import org.springframework.mock.web.MockHttpServletRequest; -import org.springframework.mock.web.MockHttpServletResponse; -import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import com.dressca.web.WebApplication; -import com.dressca.web.security.CookieSettings; -import jakarta.servlet.FilterChain; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -/** - * {@link BuyerIdFilter}の動作をテストするクラスです。 - */ -@SpringJUnitConfig -@SpringBootTest(classes = WebApplication.class) -public class BuyerIdFilterTest { - - private HttpServletRequest request; - private HttpServletResponse response; - private FilterChain chain; - - @BeforeEach - void setup() { - // モックの作成 - this.request = new MockHttpServletRequest(); - this.response = new MockHttpServletResponse(); - this.chain = new MockFilterChain(); - } - - @Test - @DisplayName("構成ファイルの設定がない場合") - void testDoFilter_01() throws Exception { - - // デフォルトの CookieSettings を呼び出す - CookieSettings cookieSettings = new CookieSettings(); - - // テスト対象の Filter を作成 - BuyerIdFilter filter = new BuyerIdFilter(cookieSettings); - - // doFilter の実行 - filter.doFilter(request, response, chain); - String setCookieHeader = response.getHeader(HttpHeaders.SET_COOKIE); - - // Set-Cookieヘッダーの値が期待通りであることを確認 - assertNotNull(setCookieHeader); - assertTrue(setCookieHeader.startsWith("Dressca-Bid=")); - assertTrue(setCookieHeader.contains("Path=/")); - assertTrue(setCookieHeader.contains("HttpOnly")); - assertFalse(setCookieHeader.contains("Secure")); - assertTrue(setCookieHeader.contains("Max-Age=86400")); - assertTrue(setCookieHeader.contains("SameSite=Strict")); - - } - - @Test - @DisplayName("構成ファイルの設定がある場合") - void testDoFilter_02() throws Exception { - - // モックオブジェクトを作成 - CookieSettings cookieSettings = Mockito.mock(CookieSettings.class); - Mockito.when(cookieSettings.isHttpOnly()).thenReturn(true); - Mockito.when(cookieSettings.isSecure()).thenReturn(true); - Mockito.when(cookieSettings.getExpiredDays()).thenReturn(7); - Mockito.when(cookieSettings.getSameSite()).thenReturn("None"); - - // テスト対象の Filter を作成 - BuyerIdFilter filter = new BuyerIdFilter(cookieSettings); - - // doFilter の実行 - filter.doFilter(request, response, chain); - String setCookieHeader = response.getHeader(HttpHeaders.SET_COOKIE); - - // Set-Cookieヘッダーの値が期待通りであることを確認 - assertNotNull(setCookieHeader); - assertTrue(setCookieHeader.startsWith("Dressca-Bid=")); - assertTrue(setCookieHeader.contains("Path=/")); - assertTrue(setCookieHeader.contains("HttpOnly")); - assertTrue(setCookieHeader.contains("Secure")); - assertTrue(setCookieHeader.contains("Max-Age=604800")); - assertTrue(setCookieHeader.contains("SameSite=None")); - - } - -} +package com.dressca.web.consumer.filter; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.HttpHeaders; +import org.springframework.mock.web.MockFilterChain; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import com.dressca.web.consumer.WebApplication; +import com.dressca.web.consumer.security.CookieSettings; +import jakarta.servlet.FilterChain; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +/** + * {@link BuyerIdFilter}の動作をテストするクラスです。 + */ +@SpringJUnitConfig +@SpringBootTest(classes = WebApplication.class) +public class BuyerIdFilterTest { + + private HttpServletRequest request; + private HttpServletResponse response; + private FilterChain chain; + + @BeforeEach + void setup() { + // モックの作成 + this.request = new MockHttpServletRequest(); + this.response = new MockHttpServletResponse(); + this.chain = new MockFilterChain(); + } + + @Test + @DisplayName("構成ファイルの設定がない場合") + void testDoFilter_01() throws Exception { + + // デフォルトの CookieSettings を呼び出す + CookieSettings cookieSettings = new CookieSettings(); + + // テスト対象の Filter を作成 + BuyerIdFilter filter = new BuyerIdFilter(cookieSettings); + + // doFilter の実行 + filter.doFilter(request, response, chain); + String setCookieHeader = response.getHeader(HttpHeaders.SET_COOKIE); + + // Set-Cookieヘッダーの値が期待通りであることを確認 + assertNotNull(setCookieHeader); + assertTrue(setCookieHeader.startsWith("Dressca-Bid=")); + assertTrue(setCookieHeader.contains("Path=/")); + assertTrue(setCookieHeader.contains("HttpOnly")); + assertFalse(setCookieHeader.contains("Secure")); + assertTrue(setCookieHeader.contains("Max-Age=86400")); + assertTrue(setCookieHeader.contains("SameSite=Strict")); + + } + + @Test + @DisplayName("構成ファイルの設定がある場合") + void testDoFilter_02() throws Exception { + + // モックオブジェクトを作成 + CookieSettings cookieSettings = Mockito.mock(CookieSettings.class); + Mockito.when(cookieSettings.isHttpOnly()).thenReturn(true); + Mockito.when(cookieSettings.isSecure()).thenReturn(true); + Mockito.when(cookieSettings.getExpiredDays()).thenReturn(7); + Mockito.when(cookieSettings.getSameSite()).thenReturn("None"); + + // テスト対象の Filter を作成 + BuyerIdFilter filter = new BuyerIdFilter(cookieSettings); + + // doFilter の実行 + filter.doFilter(request, response, chain); + String setCookieHeader = response.getHeader(HttpHeaders.SET_COOKIE); + + // Set-Cookieヘッダーの値が期待通りであることを確認 + assertNotNull(setCookieHeader); + assertTrue(setCookieHeader.startsWith("Dressca-Bid=")); + assertTrue(setCookieHeader.contains("Path=/")); + assertTrue(setCookieHeader.contains("HttpOnly")); + assertTrue(setCookieHeader.contains("Secure")); + assertTrue(setCookieHeader.contains("Max-Age=604800")); + assertTrue(setCookieHeader.contains("SameSite=None")); + + } + +} diff --git a/samples/web-csr/dressca-backend/web/build.gradle b/samples/web-csr/dressca-backend/web/build.gradle index b3720d4ac..f1f96f4fe 100644 --- a/samples/web-csr/dressca-backend/web/build.gradle +++ b/samples/web-csr/dressca-backend/web/build.gradle @@ -2,7 +2,6 @@ plugins { id 'java' id 'org.springframework.boot' version "${springBootVersion}" id 'io.spring.dependency-management' version "${springDependencyManagementVersion}" - id 'org.springdoc.openapi-gradle-plugin' version "${springdocOpenapiGradlePluginVersion}" } group = 'com.dressca' @@ -42,18 +41,10 @@ configurations { exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' } } -afterEvaluate { - tasks.named("forkedSpringBootRun") { - workingDir("$rootDir/api-docs") - } -} -openApi { - apiDocsUrl.set("http://localhost:8080/api-docs") - outputDir.set(file("$rootDir/api-docs")) - outputFileName.set("api-specification.json") -} + tasks.named('test') { useJUnitPlatform() } -build.dependsOn("generateOpenApiDocs") \ No newline at end of file +bootJar.enabled = false +jar.enabled = true \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdvice.java b/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdvice.java index 27b12130e..4e06ff56d 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdvice.java +++ b/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdvice.java @@ -1,19 +1,24 @@ package com.dressca.web.controller.advice; import jakarta.servlet.http.HttpServletRequest; +import com.dressca.applicationcore.authorization.PermissionDeniedException; import com.dressca.systemcommon.constant.ExceptionIdConstant; import com.dressca.systemcommon.constant.SystemPropertyConstants; import com.dressca.systemcommon.exception.LogicException; +import com.dressca.systemcommon.exception.OptimisticLockingFailureException; import com.dressca.systemcommon.exception.SystemException; import com.dressca.web.constant.ProblemDetailsConstant; import com.dressca.web.log.ErrorMessageBuilder; import java.util.Map; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ProblemDetail; import org.springframework.http.ResponseEntity; +import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; +import org.springframework.security.authorization.AuthorizationDeniedException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; @@ -28,6 +33,48 @@ public class ExceptionHandlerControllerAdvice extends ResponseEntityExceptionHan private static final Logger apLog = LoggerFactory.getLogger(SystemPropertyConstants.APPLICATION_LOG_LOGGER); + /** + * 未認証エラーをステータスコード401で返却する。 + * + * @param e 未認証エラー + * @param req リクエスト + * @return ステータースコード401のレスポンス + */ + @ExceptionHandler(AuthenticationCredentialsNotFoundException.class) + public ResponseEntity handleAuthenticationCredentialsNotFoundException( + AuthenticationCredentialsNotFoundException e, HttpServletRequest req) { + apLog.warn(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build(); + } + + /** + * 認可エラーをステータスコード404で返却する。 + * + * @param e 認可エラー + * @param req リクエスト + * @return ステータースコード404のレスポンス + */ + @ExceptionHandler({ AuthorizationDeniedException.class, PermissionDeniedException.class }) + public ResponseEntity handleAuthorizationDeniedException( + AuthorizationDeniedException e, HttpServletRequest req) { + apLog.warn(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.notFound().build(); + } + + /** + * 楽観ロックエラーをステータスコード409で返却する。 + * + * @param e 楽観ロックエラー + * @param req リクエスト + * @return ステータスコード409のレスポンス + */ + @ExceptionHandler(OptimisticLockingFailureException.class) + public ResponseEntity handleOptimisticLockingFailureException( + OptimisticLockingFailureException e, HttpServletRequest req) { + apLog.warn(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.CONFLICT).body(null); + } + /** * その他の業務エラーをステータースコード500で返却する(本番環境、テスト環境用)。 * diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/advice/LocalExceptionHandlerControllerAdvice.java b/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/advice/LocalExceptionHandlerControllerAdvice.java index 4b65b4431..2bc494d27 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/advice/LocalExceptionHandlerControllerAdvice.java +++ b/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/advice/LocalExceptionHandlerControllerAdvice.java @@ -1,92 +1,139 @@ -package com.dressca.web.controller.advice; - -import java.util.Map; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.Profile; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ProblemDetail; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.ControllerAdvice; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; -import com.dressca.systemcommon.constant.ExceptionIdConstant; -import com.dressca.systemcommon.constant.SystemPropertyConstants; -import com.dressca.systemcommon.exception.LogicException; -import com.dressca.systemcommon.exception.SystemException; -import com.dressca.web.constant.ProblemDetailsConstant; -import com.dressca.web.log.ErrorMessageBuilder; -import jakarta.servlet.http.HttpServletRequest; - -/** - * サーバーエラーのハンドリングを行うクラスです(開発環境用)。 - */ -@ControllerAdvice -@Profile("local") -public class LocalExceptionHandlerControllerAdvice extends ResponseEntityExceptionHandler { - - private static final Logger apLog = LoggerFactory.getLogger(SystemPropertyConstants.APPLICATION_LOG_LOGGER); - - /** - * その他の業務エラーをステータースコード500で返却する(開発環境用)。 - * - * @param e 業務例外 - * @param req リクエスト - * @return ステータースコード500のレスポンス - */ - @ExceptionHandler(LogicException.class) - public ResponseEntity localHandleLogicException(LogicException e, HttpServletRequest req) { - ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, e.getExceptionId(), e.getLogMessageValue(), - e.getFrontMessageValue()); - apLog.error(errorBuilder.createLogMessageStackTrace()); - ProblemDetail problemDetail = createProblemDetail(errorBuilder, ProblemDetailsConstant.LOGIC_ERROR_TITLE); - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) - .contentType(MediaType.APPLICATION_JSON) - .body(problemDetail); - } - - /** - * その他のシステムエラーをステータースコード500で返却する(開発環境用)。 - * - * @param e その他の例外 - * @param req リクエスト - * @return ステータースコード500のレスポンス - */ - @ExceptionHandler(SystemException.class) - public ResponseEntity localHandleException(SystemException e, HttpServletRequest req) { - ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, e.getExceptionId(), e.getLogMessageValue(), - e.getFrontMessageValue()); - apLog.error(errorBuilder.createLogMessageStackTrace()); - ProblemDetail problemDetail = createProblemDetail(errorBuilder, ProblemDetailsConstant.SYSTEM_ERROR_TITLE); - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) - .contentType(MediaType.APPLICATION_JSON) - .body(problemDetail); - } - - /** - * 上記のいずれにも当てはまらない例外をステータースコード500で返却する(開発環境用)。 - * - * @param e その他の例外 - * @param req リクエスト - * @return ステータースコード500のレスポンス - */ - @ExceptionHandler(Exception.class) - public ResponseEntity localHandleException(Exception e, HttpServletRequest req) { - ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, ExceptionIdConstant.E_SHARE0000, null, null); - apLog.error(errorBuilder.createLogMessageStackTrace()); - ProblemDetail problemDetail = createProblemDetail(errorBuilder, ProblemDetailsConstant.SYSTEM_ERROR_TITLE); - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) - .contentType(MediaType.APPLICATION_JSON) - .body(problemDetail); - } - - private ProblemDetail createProblemDetail(ErrorMessageBuilder errorBuilder, String title) { - Map errorProperty = Map.of(errorBuilder.getExceptionId(), errorBuilder.createFrontErrorMessage()); - ProblemDetail problemDetail = ProblemDetail.forStatusAndDetail(HttpStatus.INTERNAL_SERVER_ERROR, - errorBuilder.createLogMessageStackTrace()); - problemDetail.setTitle(title); - problemDetail.setProperty(ProblemDetailsConstant.ERROR_KEY, errorProperty); - return problemDetail; - } -} +package com.dressca.web.controller.advice; + +import java.util.Map; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Profile; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ProblemDetail; +import org.springframework.http.ResponseEntity; +import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; +import org.springframework.security.authorization.AuthorizationDeniedException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; +import com.dressca.applicationcore.authorization.PermissionDeniedException; +import com.dressca.systemcommon.constant.ExceptionIdConstant; +import com.dressca.systemcommon.constant.SystemPropertyConstants; +import com.dressca.systemcommon.exception.LogicException; +import com.dressca.systemcommon.exception.OptimisticLockingFailureException; +import com.dressca.systemcommon.exception.SystemException; +import com.dressca.web.constant.ProblemDetailsConstant; +import com.dressca.web.log.ErrorMessageBuilder; +import jakarta.servlet.http.HttpServletRequest; + +/** + * サーバーエラーのハンドリングを行うクラスです(開発環境用)。 + */ +@ControllerAdvice +@Profile("local") +public class LocalExceptionHandlerControllerAdvice extends ResponseEntityExceptionHandler { + + private static final Logger apLog = LoggerFactory.getLogger(SystemPropertyConstants.APPLICATION_LOG_LOGGER); + + /** + * 未認証エラーをステータスコード401で返却する。 + * + * @param e 未認証エラー + * @param req リクエスト + * @return ステータースコード401のレスポンス + */ + @ExceptionHandler(AuthenticationCredentialsNotFoundException.class) + public ResponseEntity handleAuthenticationCredentialsNotFoundException( + AuthenticationCredentialsNotFoundException e, HttpServletRequest req) { + apLog.warn(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build(); + } + + /** + * 認可エラーをステータスコード404で返却する。 + * + * @param e 認可エラー + * @param req リクエスト + * @return ステータースコード404のレスポンス + */ + @ExceptionHandler({ AuthorizationDeniedException.class, PermissionDeniedException.class }) + public ResponseEntity handleAuthorizationDeniedException( + AuthorizationDeniedException e, HttpServletRequest req) { + apLog.warn(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.notFound().build(); + } + + /** + * 楽観ロックエラーをステータスコード409で返却する。 + * + * @param e 楽観ロックエラー + * @param req リクエスト + * @return ステータスコード409のレスポンス + */ + @ExceptionHandler(OptimisticLockingFailureException.class) + public ResponseEntity handleOptimisticLockingFailureException( + OptimisticLockingFailureException e, HttpServletRequest req) { + apLog.warn(ExceptionUtils.getStackTrace(e)); + return ResponseEntity.status(HttpStatus.CONFLICT).body(null); + } + + /** + * その他の業務エラーをステータースコード500で返却する(開発環境用)。 + * + * @param e 業務例外 + * @param req リクエスト + * @return ステータースコード500のレスポンス + */ + @ExceptionHandler(LogicException.class) + public ResponseEntity localHandleLogicException(LogicException e, HttpServletRequest req) { + ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, e.getExceptionId(), e.getLogMessageValue(), + e.getFrontMessageValue()); + apLog.error(errorBuilder.createLogMessageStackTrace()); + ProblemDetail problemDetail = createProblemDetail(errorBuilder, ProblemDetailsConstant.LOGIC_ERROR_TITLE); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .contentType(MediaType.APPLICATION_JSON) + .body(problemDetail); + } + + /** + * その他のシステムエラーをステータースコード500で返却する(開発環境用)。 + * + * @param e その他の例外 + * @param req リクエスト + * @return ステータースコード500のレスポンス + */ + @ExceptionHandler(SystemException.class) + public ResponseEntity localHandleException(SystemException e, HttpServletRequest req) { + ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, e.getExceptionId(), e.getLogMessageValue(), + e.getFrontMessageValue()); + apLog.error(errorBuilder.createLogMessageStackTrace()); + ProblemDetail problemDetail = createProblemDetail(errorBuilder, ProblemDetailsConstant.SYSTEM_ERROR_TITLE); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .contentType(MediaType.APPLICATION_JSON) + .body(problemDetail); + } + + /** + * 上記のいずれにも当てはまらない例外をステータースコード500で返却する(開発環境用)。 + * + * @param e その他の例外 + * @param req リクエスト + * @return ステータースコード500のレスポンス + */ + @ExceptionHandler(Exception.class) + public ResponseEntity localHandleException(Exception e, HttpServletRequest req) { + ErrorMessageBuilder errorBuilder = new ErrorMessageBuilder(e, ExceptionIdConstant.E_SHARE0000, null, null); + apLog.error(errorBuilder.createLogMessageStackTrace()); + ProblemDetail problemDetail = createProblemDetail(errorBuilder, ProblemDetailsConstant.SYSTEM_ERROR_TITLE); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .contentType(MediaType.APPLICATION_JSON) + .body(problemDetail); + } + + private ProblemDetail createProblemDetail(ErrorMessageBuilder errorBuilder, String title) { + Map errorProperty = Map.of(errorBuilder.getExceptionId(), errorBuilder.createFrontErrorMessage()); + ProblemDetail problemDetail = ProblemDetail.forStatusAndDetail(HttpStatus.INTERNAL_SERVER_ERROR, + errorBuilder.createLogMessageStackTrace()); + problemDetail.setTitle(title); + problemDetail.setProperty(ProblemDetailsConstant.ERROR_KEY, errorProperty); + return problemDetail; + } +} diff --git a/samples/web-csr/dressca-backend/web/src/main/resources/application-common.properties b/samples/web-csr/dressca-backend/web/src/main/resources/application-common.properties index bab1946c6..e69de29bb 100644 --- a/samples/web-csr/dressca-backend/web/src/main/resources/application-common.properties +++ b/samples/web-csr/dressca-backend/web/src/main/resources/application-common.properties @@ -1,12 +0,0 @@ -# springdoc-openapi -springdoc.api-docs.path=/api-docs -springdoc.swagger-ui.path=/swagger-ui.html -springdoc.show-actuator=true - -# spring boot actuatorの設定(ステータスの変更,表示情報) -# ヘルスチェックAPIのURLを/apiから始まるように変更する -management.endpoints.web.base-path=/api -# サーバのヘルスチェック用のAPIを設定する(http://localhost:8080/api/health/check) -management.endpoint.health.group.check.include=ping -# データベースのヘルスチェック用のAPIを設定する(http://localhost:8080/api/health/datasource) -management.endpoint.health.group.datasource.include=db diff --git a/samples/web-csr/dressca-backend/web/src/main/resources/application-dev.properties b/samples/web-csr/dressca-backend/web/src/main/resources/application-dev.properties index 023bf0553..e69de29bb 100644 --- a/samples/web-csr/dressca-backend/web/src/main/resources/application-dev.properties +++ b/samples/web-csr/dressca-backend/web/src/main/resources/application-dev.properties @@ -1,15 +0,0 @@ -# h2 database -spring.datasource.hikari.driver-class-name=org.h2.Driver -spring.datasource.hikari.jdbc-url=jdbc:h2:mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; -spring.datasource.hikari.username= -spring.datasource.hikari.password= -spring.h2.console.enabled=true -spring.h2.console.path=/h2-console -spring.h2.console.settings.web-allow-others=true -spring.sql.init.mode=embedded - -# CORS 設定 -cors.allowed.origins=http://localhost,http://localhost:5173 - -# ヘルスチェックの API のログを検出するため logging level を変更する -logging.level.web=DEBUG diff --git a/samples/web-csr/dressca-backend/web/src/main/resources/application-prd.properties b/samples/web-csr/dressca-backend/web/src/main/resources/application-prd.properties index 640fda112..e69de29bb 100644 --- a/samples/web-csr/dressca-backend/web/src/main/resources/application-prd.properties +++ b/samples/web-csr/dressca-backend/web/src/main/resources/application-prd.properties @@ -1,15 +0,0 @@ -# PostgreSQL database -spring.datasource.hikari.driver-class-name=org.postgresql.Driver -spring.datasource.hikari.jdbc-url=jdbc:postgresql://localhost:5432/project -spring.datasource.hikari.username=project -spring.datasource.hikari.password=project -spring.sql.init.mode=never - -# CORS 設定 -cors.allowed.origins=https://本番環境のフロントエンド配布サーバーのドメイン - -# Cookie の設定 -cookie.settings.same-site=None -cookie.settings.http-only=true -cookie.settings.secure=true -cookie.settings.expired-days=7 \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web/src/main/resources/application-ut.properties b/samples/web-csr/dressca-backend/web/src/main/resources/application-ut.properties index ff7b76b87..e69de29bb 100644 --- a/samples/web-csr/dressca-backend/web/src/main/resources/application-ut.properties +++ b/samples/web-csr/dressca-backend/web/src/main/resources/application-ut.properties @@ -1,11 +0,0 @@ -# h2 database -spring.datasource.hikari.driver-class-name=org.h2.Driver -spring.datasource.hikari.jdbc-url=jdbc:h2:mem:./data;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE;DEFAULT_NULL_ORDERING=HIGH;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE; -spring.datasource.hikari.username= -spring.datasource.hikari.password= -spring.h2.console.enabled=true -spring.h2.console.path=/h2-console -spring.h2.console.settings.web-allow-others=true -spring.sql.init.mode=embedded -mybatis.configuration.map-underscore-to-camel-case=true - diff --git a/samples/web-csr/dressca-backend/web/src/main/resources/application.properties b/samples/web-csr/dressca-backend/web/src/main/resources/application.properties index 41fa11b1e..e69de29bb 100644 --- a/samples/web-csr/dressca-backend/web/src/main/resources/application.properties +++ b/samples/web-csr/dressca-backend/web/src/main/resources/application.properties @@ -1,9 +0,0 @@ -# 環境別のプロファイル設定(common:全環境共通の設定、test:UT用、local:ローカル打鍵用、production:本番環境用) -spring.profiles.group.local=common,dev -spring.profiles.group.production=common,prd -spring.profiles.group.test=common,ut -# 環境情報未指定の場合に使用するプロファイル(環境情報を指定する場合、起動コマンドに「-Dspring.profiles.active=<プロファイル名>'」を追加する) -spring.profiles.default=local - -# Open API 仕様書を自動生成する際keyをアルファベット順でソートする -springdoc.writer-with-order-by-keys=true \ No newline at end of file diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/AssetsController.java b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/AssetsController.java similarity index 99% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/AssetsController.java rename to samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/AssetsController.java index 6dd177d26..35cef8156 100644 --- a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/controller/AssetsController.java +++ b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/AssetsController.java @@ -1,4 +1,4 @@ -package com.dressca.web.controller; +package com.dressca.web; import com.dressca.applicationcore.applicationservice.AssetApplicationService; import com.dressca.applicationcore.assets.Asset; diff --git a/samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/WebApplication.java b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/WebApplication.java similarity index 100% rename from samples/web-csr/dressca-backend/web/src/main/java/com/dressca/web/WebApplication.java rename to samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/WebApplication.java diff --git a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdviceTest.java b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdviceTest.java index 4105385ca..ef222691f 100644 --- a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdviceTest.java +++ b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/ExceptionHandlerControllerAdviceTest.java @@ -5,10 +5,10 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.mockito.Mockito.anyString; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.times; -import com.dressca.web.controller.AssetsController; +import com.dressca.web.AssetsController; import com.dressca.systemcommon.constant.ExceptionIdConstant; import com.dressca.systemcommon.constant.SystemPropertyConstants; import com.dressca.systemcommon.exception.SystemException; @@ -24,6 +24,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.MessageSource; +import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.test.web.servlet.MockMvc; @@ -98,6 +99,7 @@ private void setLogLevel(Level level) { } @Test + @WithMockUser @DisplayName("testException_01_正常系_その他の業務エラーをステータースコード500で返却する(本番環境)。") void testException_01() throws Exception { // テスト用の入力データ @@ -124,6 +126,7 @@ void testException_01() throws Exception { } @Test + @WithMockUser @DisplayName("testException_02_正常系_その他のシステムエラーをステータースコード500で返却する(本番環境)。") void testException_02() throws Exception { // テスト用の入力データ @@ -151,6 +154,7 @@ void testException_02() throws Exception { } @Test + @WithMockUser @DisplayName("testException_03_正常系_上記のいずれにも当てはまらない例外をステータースコード500で返却する(本番環境)。") void testException_03() throws Exception { // テスト用の入力データ diff --git a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/LocalExceptionHandlerControllerAdviceTest.java b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/LocalExceptionHandlerControllerAdviceTest.java index 2a181d39d..7ce1a6f34 100644 --- a/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/LocalExceptionHandlerControllerAdviceTest.java +++ b/samples/web-csr/dressca-backend/web/src/test/java/com/dressca/web/controller/advice/LocalExceptionHandlerControllerAdviceTest.java @@ -5,10 +5,10 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.mockito.Mockito.anyString; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.times; -import com.dressca.web.controller.AssetsController; +import com.dressca.web.AssetsController; import com.dressca.systemcommon.constant.ExceptionIdConstant; import com.dressca.systemcommon.constant.SystemPropertyConstants; import com.dressca.systemcommon.exception.SystemException; @@ -24,6 +24,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.MessageSource; +import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.test.web.servlet.MockMvc; @@ -98,6 +99,7 @@ private void setLogLevel(Level level) { } @Test + @WithMockUser @DisplayName("testException_01_正常系_その他の業務エラーをステータースコード500で返却する(開発環境)。") void testException_01() throws Exception { // テスト用の入力データ @@ -123,6 +125,7 @@ void testException_01() throws Exception { } @Test + @WithMockUser @DisplayName("testException_02_正常系_その他のシステムエラーをステータースコード500で返却する(開発環境)。") void testException_02() throws Exception { // テスト用の入力データ @@ -150,6 +153,7 @@ void testException_02() throws Exception { } @Test + @WithMockUser @DisplayName("testException_03_正常系_上記のいずれにも当てはまらない例外をステータースコード500で返却する(開発環境)。") void testException_03() throws Exception { // テスト用の入力データ