解决跨域;修改MySQL语法错误;获取分类树形数据
This commit is contained in:
parent
3bdfc932dd
commit
35c44ac961
|
@ -4,47 +4,11 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="6ee93b58-a7e0-45a0-9e98-4c363b192afb" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/spzx-server-gateway/pom.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-server-gateway/src/main/java/cn/bunny/web/App.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-server-gateway/src/test/java/cn/bunny/web/AppTest.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service-client/pom.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service-client/service-product-client/pom.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service-client/service-product-client/src/main/java/cn/bunny/web/App.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service-client/service-product-client/src/test/java/cn/bunny/web/AppTest.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service-client/service-user-client/pom.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service-client/service-user-client/src/main/java/cn/bunny/web/App.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service-client/service-user-client/src/test/java/cn/bunny/web/AppTest.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/pom.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-order/pom.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-order/src/main/java/cn/bunny/web/App.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-order/src/test/java/cn/bunny/web/AppTest.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-product/pom.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-product/src/main/java/cn/bunny/web/product/mapper/ProductSkuMapper.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-product/src/main/resources/application-dev.yml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-product/src/main/resources/application.yml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-product/src/main/resources/logback-spring.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-product/src/main/resources/mapper/product/CategoryMapper.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-product/src/main/resources/mapper/product/ProductSkuMapper.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-product/src/main/resources/mybatis-config.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-product/src/test/java/cn/bunny/web/AppTest.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-user/pom.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-user/src/main/java/cn/bunny/web/App.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-user/src/test/java/cn/bunny/web/AppTest.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.local.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/dataSources.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/dataSources/3eae447a-3ae1-4be3-aa70-1183cffb0765.xml" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/dataSources/3eae447a-3ae1-4be3-aa70-1183cffb0765/storage_v2/_src_/schema/db_spzx.fMWaVg.meta" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/dataSources/3eae447a-3ae1-4be3-aa70-1183cffb0765/storage_v2/_src_/schema/information_schema.FNRwLQ.meta" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/dataSources/3eae447a-3ae1-4be3-aa70-1183cffb0765/storage_v2/_src_/schema/mysql.osA4Bg.meta" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/dataSources/3eae447a-3ae1-4be3-aa70-1183cffb0765/storage_v2/_src_/schema/performance_schema.kIw0nw.meta" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/dataSources/3eae447a-3ae1-4be3-aa70-1183cffb0765/storage_v2/_src_/schema/sys.zb4BAA.meta" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/uiDesigner.xml" beforeDir="false" />
|
||||
<list default="true" id="6ee93b58-a7e0-45a0-9e98-4c363b192afb" name="Changes" comment="前端接口初始化;显示商品页面">
|
||||
<change afterPath="$PROJECT_DIR$/spzx-service/service-product/src/main/java/cn/bunny/web/product/controller/CategoryController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/spzx-service/service-product/src/main/resources/application-dev.yml" beforeDir="false" afterPath="$PROJECT_DIR$/spzx-service/service-product/src/main/resources/application-dev.yml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/spzx-service/service-product/src/main/resources/mapper/product/CategoryMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/spzx-service/service-product/src/main/resources/mapper/product/CategoryMapper.xml" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -56,6 +20,7 @@
|
|||
<list>
|
||||
<option value="Interface" />
|
||||
<option value="mybatis-mapper" />
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
@ -90,6 +55,10 @@
|
|||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RequestMappingsPanelOrder0": "0",
|
||||
"RequestMappingsPanelOrder1": "1",
|
||||
"RequestMappingsPanelWidth0": "75",
|
||||
"RequestMappingsPanelWidth1": "75",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
|
@ -172,11 +141,24 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1703487755445</updated>
|
||||
<workItem from="1703487757122" duration="903000" />
|
||||
<workItem from="1703488670206" duration="2420000" />
|
||||
<workItem from="1703488670206" duration="5327000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="前端接口初始化;显示商品页面">
|
||||
<option name="closed" value="true" />
|
||||
<created>1703491174875</created>
|
||||
<option name="number" value="00001" />
|
||||
<option name="presentableId" value="LOCAL-00001" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1703491174875</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="2" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="前端接口初始化;显示商品页面" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="前端接口初始化;显示商品页面" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,31 @@
|
|||
package cn.bunny.web.product.controller;
|
||||
|
||||
import cn.bunny.common.spzx.model.entity.product.Category;
|
||||
import cn.bunny.common.spzx.model.vo.common.Result;
|
||||
import cn.bunny.common.spzx.model.vo.common.ResultCodeEnum;
|
||||
import cn.bunny.web.product.service.CategoryService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@Tag(name = "分类接口管理")
|
||||
@RequestMapping(value="/api/product/category")
|
||||
@CrossOrigin
|
||||
public class CategoryController {
|
||||
@Resource
|
||||
private CategoryService categoryService;
|
||||
|
||||
@Operation(summary = "获取分类树形数据",description = "按照树型方式进行封装")
|
||||
@GetMapping("findCategoryTree")
|
||||
public Result findCategoryTree() {
|
||||
List<Category> categoryList= categoryService.findCategoryTree();
|
||||
return Result.build(categoryList, ResultCodeEnum.SUCCESS);
|
||||
}
|
||||
}
|
|
@ -4,16 +4,16 @@ server:
|
|||
spring:
|
||||
application:
|
||||
name: service-product
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: localhost:8848
|
||||
# cloud:
|
||||
# nacos:
|
||||
# discovery:
|
||||
# server-addr: localhost:8848
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://60.204.230.80:3306/db_spzx?characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: root
|
||||
password: "02120212"
|
||||
|
||||
mybatis:
|
||||
config-location: classpath:mybatis-config.xml
|
||||
|
|
|
@ -11,7 +11,17 @@
|
|||
<select id="selectOneCategory" resultMap="categoryMap">
|
||||
select
|
||||
<include refid="columns"/>
|
||||
from category where parent_id=0 and and is_deleted = 0
|
||||
from category where parent_id=0 and is_deleted = 0
|
||||
order by order_num
|
||||
</select>
|
||||
|
||||
<!-- 1. 查询所有分类,返回list集合 -->
|
||||
<select id="findAll" resultType="cn.bunny.common.spzx.model.entity.product.Category">
|
||||
select <include refid="columns" />
|
||||
from category
|
||||
where
|
||||
status = 1
|
||||
and is_deleted = 0
|
||||
order by order_num
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue