Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
aedecc44
提交
aedecc44
authored
2月 21, 2019
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
把 mybatis 整合到其中
上级
85846516
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
78 行增加
和
13 行删除
+78
-13
pom.xml
product/product-application/pom.xml
+13
-0
ProductRestApplication.java
.../java/cn/iocoder/mall/product/ProductRestApplication.java
+9
-1
ProductCategoryController.java
...ll/product/controller/user/ProductCategoryController.java
+2
-2
ProductSpuController.java
...er/mall/product/controller/user/ProductSpuController.java
+2
-2
ProductSpuMapper.java
...in/java/cn/iocoder/mall/product/dao/ProductSpuMapper.java
+3
-6
ProductSpuService.java
...va/cn/iocoder/mall/product/service/ProductSpuService.java
+2
-2
application.yaml
...t/product-application/src/main/resources/application.yaml
+14
-0
ProductCategoryMapper.xml
...c/main/resources/mybatis/mapper/ProductCategoryMapper.xml
+13
-0
mybatis-config.xml
...application/src/main/resources/mybatis/mybatis-config.xml
+20
-0
没有找到文件。
product/product-application/pom.xml
浏览文件 @
aedecc44
...
@@ -22,6 +22,19 @@
...
@@ -22,6 +22,19 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-jdbc
</artifactId>
</dependency>
<dependency>
<groupId>
org.mybatis.spring.boot
</groupId>
<artifactId>
mybatis-spring-boot-starter
</artifactId>
<version>
2.0.0
</version>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
...
...
product/product-application/src/main/java/cn/iocoder/mall/product/ProductRestApplication.java
浏览文件 @
aedecc44
package
cn
.
iocoder
.
mall
.
product
;
package
cn
.
iocoder
.
mall
.
product
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
javax.sql.DataSource
;
@SpringBootApplication
@SpringBootApplication
@MapperScan
(
"cn.iocoder.mall.product.dao"
)
// 扫描对应的 Mapper 接口
public
class
ProductRestApplication
{
public
class
ProductRestApplication
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
ProductRestApplication
.
class
,
args
);
ConfigurableApplicationContext
ctx
=
SpringApplication
.
run
(
ProductRestApplication
.
class
,
args
);
DataSource
ds
=
ctx
.
getBean
(
DataSource
.
class
);
System
.
out
.
println
(
ds
);
}
}
}
}
\ No newline at end of file
product/product-application/src/main/java/cn/iocoder/mall/product/controller/ProductCategoryController.java
→
product/product-application/src/main/java/cn/iocoder/mall/product/controller/
user/
ProductCategoryController.java
浏览文件 @
aedecc44
package
cn
.
iocoder
.
mall
.
product
.
controller
;
package
cn
.
iocoder
.
mall
.
product
.
controller
.
user
;
import
cn.iocoder.mall.product.vo.ProductCategoryVO
;
import
cn.iocoder.mall.product.vo.ProductCategoryVO
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
@@ -10,7 +10,7 @@ import java.util.ArrayList;
...
@@ -10,7 +10,7 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.List
;
@RestController
@RestController
@RequestMapping
(
"/product/category"
)
@RequestMapping
(
"
user
/product/category"
)
public
class
ProductCategoryController
{
public
class
ProductCategoryController
{
// TODO 获得父编号为 id 的分类们 后面,使用 swagger 注释
// TODO 获得父编号为 id 的分类们 后面,使用 swagger 注释
...
...
product/product-application/src/main/java/cn/iocoder/mall/product/controller/ProductSpuController.java
→
product/product-application/src/main/java/cn/iocoder/mall/product/controller/
user/
ProductSpuController.java
浏览文件 @
aedecc44
package
cn
.
iocoder
.
mall
.
product
.
controller
;
package
cn
.
iocoder
.
mall
.
product
.
controller
.
user
;
import
cn.iocoder.mall.product.bo.ProductSpuBO
;
import
cn.iocoder.mall.product.bo.ProductSpuBO
;
import
cn.iocoder.mall.product.service.ProductSpuService
;
import
cn.iocoder.mall.product.service.ProductSpuService
;
...
@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam;
...
@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RestController
@RequestMapping
(
"/product/spu"
)
@RequestMapping
(
"
user
/product/spu"
)
public
class
ProductSpuController
{
public
class
ProductSpuController
{
@Autowired
@Autowired
...
...
product/product-application/src/main/java/cn/iocoder/mall/product/dao/ProductSpu
DAO
.java
→
product/product-application/src/main/java/cn/iocoder/mall/product/dao/ProductSpu
Mapper
.java
浏览文件 @
aedecc44
...
@@ -4,12 +4,8 @@ import cn.iocoder.mall.product.dataobject.ProductSpuDO;
...
@@ -4,12 +4,8 @@ import cn.iocoder.mall.product.dataobject.ProductSpuDO;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
@Repository
@Repository
public
class
ProductSpuDAO
{
public
interface
ProductSpuMapper
{
public
ProductSpuDO
selectById
(
Integer
id
)
{
ProductSpuDO
selectById
(
Integer
id
);
ProductSpuDO
spu
=
new
ProductSpuDO
();
spu
.
setId
(
id
);
return
spu
;
}
}
}
\ No newline at end of file
product/product-application/src/main/java/cn/iocoder/mall/product/service/ProductSpuService.java
浏览文件 @
aedecc44
package
cn
.
iocoder
.
mall
.
product
.
service
;
package
cn
.
iocoder
.
mall
.
product
.
service
;
import
cn.iocoder.mall.product.bo.ProductSpuBO
;
import
cn.iocoder.mall.product.bo.ProductSpuBO
;
import
cn.iocoder.mall.product.dao.ProductSpu
DAO
;
import
cn.iocoder.mall.product.dao.ProductSpu
Mapper
;
import
cn.iocoder.mall.product.dataobject.ProductSpuDO
;
import
cn.iocoder.mall.product.dataobject.ProductSpuDO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Service;
...
@@ -11,7 +11,7 @@ import org.springframework.stereotype.Service;
public
class
ProductSpuService
implements
cn
.
iocoder
.
mall
.
product
.
service
.
api
.
ProductSpuService
{
public
class
ProductSpuService
implements
cn
.
iocoder
.
mall
.
product
.
service
.
api
.
ProductSpuService
{
@Autowired
@Autowired
private
ProductSpu
DAO
productSpuDAO
;
private
ProductSpu
Mapper
productSpuDAO
;
public
ProductSpuBO
getProductSpu
(
Integer
id
)
{
public
ProductSpuBO
getProductSpu
(
Integer
id
)
{
ProductSpuDO
productSpuDO
=
productSpuDAO
.
selectById
(
id
);
ProductSpuDO
productSpuDO
=
productSpuDAO
.
selectById
(
id
);
...
...
product/product-application/src/main/resources/application.yaml
0 → 100644
浏览文件 @
aedecc44
spring
:
# datasource
datasource
:
url
:
jdbc:mysql://127.0.0.1:33061/mall_product?useSSL=false
driver-class-name
:
com.mysql.jdbc.Driver
username
:
root
password
:
123456
# mybatis
mybatis
:
config-location
:
classpath:mybatis/mybatis-config.xml
mapper-locations
:
classpath:mybatis/mapper/*.xml
type-aliases-package
:
cn.iocoder.mall.product.dataobject
\ No newline at end of file
product/product-application/src/main/resources/mybatis/mapper/ProductCategoryMapper.xml
0 → 100644
浏览文件 @
aedecc44
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.iocoder.mall.product.dao.ProductSpuMapper"
>
<select
id=
"selectById"
parameterType=
"Integer"
resultType=
"ProductSpuDO"
>
SELECT
id
FROM product_spu
WHERE id = #{id}
</select>
</mapper>
\ No newline at end of file
product/product-application/src/main/resources/mybatis/mybatis-config.xml
0 → 100644
浏览文件 @
aedecc44
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!-- 使用驼峰命名法转换字段。 -->
<setting
name=
"mapUnderscoreToCamelCase"
value=
"true"
/>
</settings>
<typeAliases>
<typeAlias
alias=
"Integer"
type=
"java.lang.Integer"
/>
<typeAlias
alias=
"Long"
type=
"java.lang.Long"
/>
<typeAlias
alias=
"HashMap"
type=
"java.util.HashMap"
/>
<typeAlias
alias=
"LinkedHashMap"
type=
"java.util.LinkedHashMap"
/>
<typeAlias
alias=
"ArrayList"
type=
"java.util.ArrayList"
/>
<typeAlias
alias=
"LinkedList"
type=
"java.util.LinkedList"
/>
</typeAliases>
</configuration>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论