Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringCloud-study
提交
00a53ded
S
SpringCloud-study
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
SpringCloud-study
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringCloud-study
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
00a53ded
编写于
1月 08, 2023
作者:
Q
qinyingjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:商品模块
上级
49985fa8
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
335 addition
and
1 deletion
+335
-1
pom.xml
pom.xml
+7
-0
springcloud-service-goods/pom.xml
springcloud-service-goods/pom.xml
+1
-1
springcloud-service-goods/src/main/java/com/kwan/springcloud/CommonConstant.java
...ds/src/main/java/com/kwan/springcloud/CommonConstant.java
+16
-0
springcloud-service-goods/src/main/java/com/kwan/springcloud/Result.java
...vice-goods/src/main/java/com/kwan/springcloud/Result.java
+118
-0
springcloud-service-goods/src/main/java/com/kwan/springcloud/controller/KwanGoodsInfoController.java
.../kwan/springcloud/controller/KwanGoodsInfoController.java
+86
-0
springcloud-service-goods/src/main/java/com/kwan/springcloud/dao/KwanGoodsInfoDao.java
.../main/java/com/kwan/springcloud/dao/KwanGoodsInfoDao.java
+17
-0
springcloud-service-goods/src/main/java/com/kwan/springcloud/entity/KwanGoodsInfo.java
.../main/java/com/kwan/springcloud/entity/KwanGoodsInfo.java
+55
-0
springcloud-service-goods/src/main/java/com/kwan/springcloud/service/KwanGoodsInfoService.java
...va/com/kwan/springcloud/service/KwanGoodsInfoService.java
+16
-0
springcloud-service-goods/src/main/java/com/kwan/springcloud/service/impl/KwanGoodsInfoServiceImpl.java
...an/springcloud/service/impl/KwanGoodsInfoServiceImpl.java
+19
-0
未找到文件。
pom.xml
浏览文件 @
00a53ded
...
@@ -24,6 +24,10 @@
...
@@ -24,6 +24,10 @@
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
</properties>
</properties>
<modules>
<module>
springcloud-service-goods
</module>
</modules>
<dependencyManagement>
<dependencyManagement>
<dependencies>
<dependencies>
<dependency>
<dependency>
...
@@ -36,4 +40,7 @@
...
@@ -36,4 +40,7 @@
</dependencies>
</dependencies>
</dependencyManagement>
</dependencyManagement>
<packaging>
pom
</packaging>
</project>
</project>
\ No newline at end of file
springcloud-service-goods/pom.xml
浏览文件 @
00a53ded
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
<dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-extension
</artifactId>
<artifactId>
mybatis-plus-extension
</artifactId>
<version>
3.5.
1
</version>
<version>
3.5.
2
</version>
</dependency>
</dependency>
<!--简化代码的工具包-->
<!--简化代码的工具包-->
<dependency>
<dependency>
...
...
springcloud-service-goods/src/main/java/com/kwan/springcloud/CommonConstant.java
0 → 100644
浏览文件 @
00a53ded
package
com.kwan.springcloud
;
public
class
CommonConstant
{
/**
* 成功
*/
public
static
final
Integer
SC_OK_200
=
200
;
/**
* 服务器错误
*/
public
static
final
Integer
SC_INTERNAL_SERVER_ERROR_500
=
500
;
/**
* 未认证
*/
public
static
final
int
SC_JEECG_NO_AUTHZ
=
401
;
}
\ No newline at end of file
springcloud-service-goods/src/main/java/com/kwan/springcloud/Result.java
0 → 100644
浏览文件 @
00a53ded
package
com.kwan.springcloud
;
import
java.io.Serializable
;
import
lombok.Data
;
/**
* 接口返回数据格式
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/1/8 10:48
*/
@Data
public
class
Result
<
T
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 成功标志
*/
private
boolean
success
=
true
;
/**
* 返回处理消息
*/
private
String
message
=
"操作成功!"
;
/**
* 返回代码
*/
private
Integer
code
=
0
;
/**
* 返回数据对象 data
*/
private
T
result
;
/**
* 时间戳
*/
private
long
timestamp
=
System
.
currentTimeMillis
();
public
Result
()
{
}
public
Result
<
T
>
success
(
String
message
)
{
this
.
message
=
message
;
this
.
code
=
CommonConstant
.
SC_OK_200
;
this
.
success
=
true
;
return
this
;
}
public
Result
<
T
>
good
(
T
t
)
{
this
.
setResult
(
t
);
this
.
code
=
CommonConstant
.
SC_OK_200
;
this
.
success
=
true
;
return
this
;
}
public
Result
<
T
>
good
()
{
this
.
code
=
CommonConstant
.
SC_OK_200
;
this
.
success
=
true
;
this
.
setMessage
(
"成功"
);
return
this
;
}
public
Result
<
T
>
fail
(
String
msg
)
{
this
.
setCode
(
CommonConstant
.
SC_INTERNAL_SERVER_ERROR_500
);
this
.
setMessage
(
msg
);
this
.
setSuccess
(
false
);
return
this
;
}
public
static
Result
<
Object
>
ok
()
{
Result
<
Object
>
r
=
new
Result
<>();
r
.
setSuccess
(
true
);
r
.
setCode
(
CommonConstant
.
SC_OK_200
);
r
.
setMessage
(
"成功"
);
return
r
;
}
public
static
Result
<
Object
>
ok
(
String
msg
)
{
Result
<
Object
>
r
=
new
Result
<
Object
>();
r
.
setSuccess
(
true
);
r
.
setCode
(
CommonConstant
.
SC_OK_200
);
r
.
setMessage
(
msg
);
return
r
;
}
public
static
Result
<
Object
>
ok
(
Object
data
)
{
Result
<
Object
>
r
=
new
Result
<
Object
>();
r
.
setSuccess
(
true
);
r
.
setCode
(
CommonConstant
.
SC_OK_200
);
r
.
setResult
(
data
);
return
r
;
}
public
static
Result
<
Object
>
error
(
String
msg
)
{
return
error
(
CommonConstant
.
SC_INTERNAL_SERVER_ERROR_500
,
msg
);
}
public
static
Result
<
Object
>
error
(
int
code
,
String
msg
)
{
Result
<
Object
>
r
=
new
Result
<
Object
>();
r
.
setCode
(
code
);
r
.
setMessage
(
msg
);
r
.
setSuccess
(
false
);
return
r
;
}
public
Result
<
T
>
error500
(
String
message
)
{
this
.
message
=
message
;
this
.
code
=
CommonConstant
.
SC_INTERNAL_SERVER_ERROR_500
;
this
.
success
=
false
;
return
this
;
}
/**
* 无权限访问返回结果
*/
public
static
Result
<
Object
>
noauth
(
String
msg
)
{
return
error
(
CommonConstant
.
SC_JEECG_NO_AUTHZ
,
msg
);
}
}
\ No newline at end of file
springcloud-service-goods/src/main/java/com/kwan/springcloud/controller/KwanGoodsInfoController.java
0 → 100644
浏览文件 @
00a53ded
package
com.kwan.springcloud.controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.kwan.springcloud.Result
;
import
com.kwan.springcloud.entity.KwanGoodsInfo
;
import
com.kwan.springcloud.service.KwanGoodsInfoService
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* (KwanGoodsInfo)表控制层
*
* @author makejava
* @since 2023-01-08 10:21:26
*/
@RestController
@RequestMapping
(
"kwanGoodsInfo"
)
public
class
KwanGoodsInfoController
{
/**
* 服务对象
*/
@Resource
private
KwanGoodsInfoService
kwanGoodsInfoService
;
/**
* 分页查询所有数据
*
* @param page 分页对象
* @param kwanGoodsInfo 查询实体
* @return 所有数据
*/
@GetMapping
public
Result
selectAll
(
Page
<
KwanGoodsInfo
>
page
,
KwanGoodsInfo
kwanGoodsInfo
)
{
return
Result
.
ok
(
this
.
kwanGoodsInfoService
.
page
(
page
,
new
QueryWrapper
<>(
kwanGoodsInfo
)));
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping
(
"{id}"
)
public
Result
selectOne
(
@PathVariable
Serializable
id
)
{
return
Result
.
ok
(
this
.
kwanGoodsInfoService
.
getById
(
id
));
}
/**
* 新增数据
*
* @param kwanGoodsInfo 实体对象
* @return 新增结果
*/
@PostMapping
public
Result
insert
(
@RequestBody
KwanGoodsInfo
kwanGoodsInfo
)
{
return
Result
.
ok
(
this
.
kwanGoodsInfoService
.
save
(
kwanGoodsInfo
));
}
/**
* 修改数据
*
* @param kwanGoodsInfo 实体对象
* @return 修改结果
*/
@PutMapping
public
Result
update
(
@RequestBody
KwanGoodsInfo
kwanGoodsInfo
)
{
return
Result
.
ok
(
this
.
kwanGoodsInfoService
.
updateById
(
kwanGoodsInfo
));
}
/**
* 删除数据
*
* @param idList 主键结合
* @return 删除结果
*/
@DeleteMapping
public
Result
delete
(
@RequestParam
(
"idList"
)
List
<
Long
>
idList
)
{
return
Result
.
ok
(
this
.
kwanGoodsInfoService
.
removeByIds
(
idList
));
}
}
springcloud-service-goods/src/main/java/com/kwan/springcloud/dao/KwanGoodsInfoDao.java
0 → 100644
浏览文件 @
00a53ded
package
com.kwan.springcloud.dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.kwan.springcloud.entity.KwanGoodsInfo
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* (KwanGoodsInfo)表数据库访问层
*
* @author makejava
* @since 2023-01-08 10:21:28
*/
@Mapper
public
interface
KwanGoodsInfoDao
extends
BaseMapper
<
KwanGoodsInfo
>
{
}
springcloud-service-goods/src/main/java/com/kwan/springcloud/entity/KwanGoodsInfo.java
0 → 100644
浏览文件 @
00a53ded
package
com.kwan.springcloud.entity
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
java.io.Serializable
;
/**
* (KwanGoodsInfo)表实体类
*
* @author makejava
* @since 2023-01-08 10:21:28
*/
public
class
KwanGoodsInfo
extends
Model
<
KwanGoodsInfo
>
{
private
Integer
id
;
//商品名称
private
String
goodsName
;
//商品价格
private
Integer
goodsPrice
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getGoodsName
()
{
return
goodsName
;
}
public
void
setGoodsName
(
String
goodsName
)
{
this
.
goodsName
=
goodsName
;
}
public
Integer
getGoodsPrice
()
{
return
goodsPrice
;
}
public
void
setGoodsPrice
(
Integer
goodsPrice
)
{
this
.
goodsPrice
=
goodsPrice
;
}
/**
* 获取主键值
*
* @return 主键值
*/
@Override
public
Serializable
pkVal
()
{
return
this
.
id
;
}
}
springcloud-service-goods/src/main/java/com/kwan/springcloud/service/KwanGoodsInfoService.java
0 → 100644
浏览文件 @
00a53ded
package
com.kwan.springcloud.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.kwan.springcloud.entity.KwanGoodsInfo
;
/**
* (KwanGoodsInfo)表服务接口
*
* @author makejava
* @since 2023-01-08 10:21:29
*/
public
interface
KwanGoodsInfoService
extends
IService
<
KwanGoodsInfo
>
{
}
springcloud-service-goods/src/main/java/com/kwan/springcloud/service/impl/KwanGoodsInfoServiceImpl.java
0 → 100644
浏览文件 @
00a53ded
package
com.kwan.springcloud.service.impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.kwan.springcloud.dao.KwanGoodsInfoDao
;
import
com.kwan.springcloud.entity.KwanGoodsInfo
;
import
com.kwan.springcloud.service.KwanGoodsInfoService
;
import
org.springframework.stereotype.Service
;
/**
* (KwanGoodsInfo)表服务实现类
*
* @author makejava
* @since 2023-01-08 10:21:30
*/
@Service
(
"kwanGoodsInfoService"
)
public
class
KwanGoodsInfoServiceImpl
extends
ServiceImpl
<
KwanGoodsInfoDao
,
KwanGoodsInfo
>
implements
KwanGoodsInfoService
{
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录