Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringBoot-kwan
提交
2b371853
S
SpringBoot-kwan
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
SpringBoot-kwan
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringBoot-kwan
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
2b371853
编写于
2月 08, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:时间格式化
上级
ee4bd7b4
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
48 addition
and
9 deletion
+48
-9
src/main/java/com/kwan/springbootkwan/SpringBootKwanApplication.java
...va/com/kwan/springbootkwan/SpringBootKwanApplication.java
+2
-0
src/main/java/com/kwan/springbootkwan/controller/UserController.java
...va/com/kwan/springbootkwan/controller/UserController.java
+9
-2
src/main/java/com/kwan/springbootkwan/entity/User.java
src/main/java/com/kwan/springbootkwan/entity/User.java
+4
-4
src/main/java/com/kwan/springbootkwan/mapper/UserMapper.java
src/main/java/com/kwan/springbootkwan/mapper/UserMapper.java
+1
-0
src/main/java/com/kwan/springbootkwan/schedule/ScheduleTest.java
...n/java/com/kwan/springbootkwan/schedule/ScheduleTest.java
+1
-1
src/main/java/com/kwan/springbootkwan/schedule/ScheduleTestTwo.java
...ava/com/kwan/springbootkwan/schedule/ScheduleTestTwo.java
+1
-1
src/main/java/com/kwan/springbootkwan/service/IUserService.java
...in/java/com/kwan/springbootkwan/service/IUserService.java
+7
-0
src/main/java/com/kwan/springbootkwan/service/impl/UserServiceImpl.java
...com/kwan/springbootkwan/service/impl/UserServiceImpl.java
+10
-0
src/main/resources/mapper/AdsDimFinancialYearWeekInfoDao.xml
src/main/resources/mapper/AdsDimFinancialYearWeekInfoDao.xml
+1
-1
src/main/resources/mapper/UserMapper.xml
src/main/resources/mapper/UserMapper.xml
+12
-0
未找到文件。
src/main/java/com/kwan/springbootkwan/SpringBootKwanApplication.java
浏览文件 @
2b371853
package
com.kwan.springbootkwan
;
package
com.kwan.springbootkwan
;
import
org.springframework.batch.core.configuration.annotation.EnableBatchProcessing
;
import
org.springframework.batch.core.configuration.annotation.EnableBatchProcessing
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
...
@@ -12,6 +13,7 @@ public class SpringBootKwanApplication {
...
@@ -12,6 +13,7 @@ public class SpringBootKwanApplication {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
SpringBootKwanApplication
.
class
,
args
);
SpringApplication
.
run
(
SpringBootKwanApplication
.
class
,
args
);
System
.
out
.
println
(
"------------------SpringBootKwan应用启动成功--------------------"
);
}
}
}
}
src/main/java/com/kwan/springbootkwan/controller/UserController.java
浏览文件 @
2b371853
...
@@ -6,6 +6,7 @@ import com.kwan.springbootkwan.service.IUserService;
...
@@ -6,6 +6,7 @@ import com.kwan.springbootkwan.service.IUserService;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpRequest
;
import
org.springframework.http.HttpRequest
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.BindingResult
;
...
@@ -48,8 +49,8 @@ public class UserController {
...
@@ -48,8 +49,8 @@ public class UserController {
}
}
@PostMapping
(
value
=
"/student"
,
produces
=
"application/json;charset=utf-8"
)
@PostMapping
(
value
=
"/student"
,
produces
=
"application/json;charset=utf-8"
)
public
List
<
String
>
addUser
(
@RequestBody
@Validated
Student
student
,
BindingResult
result
)
throws
UnsupportedEncodingException
{
public
List
<
String
>
addUser
(
@RequestBody
@Validated
Student
student
,
BindingResult
result
)
throws
UnsupportedEncodingException
{
List
<
String
>
errors
=
new
ArrayList
<>();
List
<
String
>
errors
=
new
ArrayList
<>();
if
(
result
.
hasErrors
())
{
if
(
result
.
hasErrors
())
{
List
<
ObjectError
>
allErrors
=
result
.
getAllErrors
();
List
<
ObjectError
>
allErrors
=
result
.
getAllErrors
();
...
@@ -60,4 +61,10 @@ public class UserController {
...
@@ -60,4 +61,10 @@ public class UserController {
log
.
info
(
"errors={}"
,
errors
);
log
.
info
(
"errors={}"
,
errors
);
return
errors
;
return
errors
;
}
}
@ApiOperation
(
value
=
"根据name获取用户信息"
,
notes
=
"根据name获取用户信息"
)
@RequestMapping
(
value
=
"/getUserByName"
,
method
=
RequestMethod
.
GET
)
public
User
getUserByName
(
@RequestParam
String
sex
)
{
return
userService
.
getUserByName
(
sex
);
}
}
}
\ No newline at end of file
src/main/java/com/kwan/springbootkwan/entity/User.java
浏览文件 @
2b371853
...
@@ -5,13 +5,17 @@ import com.baomidou.mybatisplus.annotation.TableId;
...
@@ -5,13 +5,17 @@ import com.baomidou.mybatisplus.annotation.TableId;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Data
@Builder
@Builder
@TableName
(
value
=
"user"
)
@TableName
(
value
=
"user"
)
@ApiModel
(
value
=
"用户基本信息"
)
@ApiModel
(
value
=
"用户基本信息"
)
@AllArgsConstructor
@NoArgsConstructor
public
class
User
{
public
class
User
{
@ApiModelProperty
(
value
=
"主键id"
)
@ApiModelProperty
(
value
=
"主键id"
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
...
@@ -20,8 +24,4 @@ public class User {
...
@@ -20,8 +24,4 @@ public class User {
private
String
name
;
private
String
name
;
@ApiModelProperty
(
value
=
"性别"
)
@ApiModelProperty
(
value
=
"性别"
)
private
String
sex
;
private
String
sex
;
@ApiModelProperty
(
value
=
"密码"
)
private
String
pwd
;
@ApiModelProperty
(
value
=
"邮箱"
)
private
String
email
;
}
}
src/main/java/com/kwan/springbootkwan/mapper/UserMapper.java
浏览文件 @
2b371853
...
@@ -15,5 +15,6 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -15,5 +15,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
@Mapper
public
interface
UserMapper
extends
BaseMapper
<
User
>
{
public
interface
UserMapper
extends
BaseMapper
<
User
>
{
User
getUserByName
(
String
sex
);
}
}
src/main/java/com/kwan/springbootkwan/schedule/ScheduleTest.java
浏览文件 @
2b371853
...
@@ -17,7 +17,7 @@ import org.springframework.stereotype.Component;
...
@@ -17,7 +17,7 @@ import org.springframework.stereotype.Component;
@Slf4j
@Slf4j
public
class
ScheduleTest
{
public
class
ScheduleTest
{
@Scheduled
(
cron
=
"0/10 * * * * ?"
)
//
@Scheduled(cron = "0/10 * * * * ?")
public
void
execute
()
{
public
void
execute
()
{
log
.
info
(
"Scheduled task is running ... ..."
);
log
.
info
(
"Scheduled task is running ... ..."
);
}
}
...
...
src/main/java/com/kwan/springbootkwan/schedule/ScheduleTestTwo.java
浏览文件 @
2b371853
...
@@ -18,7 +18,7 @@ import java.util.concurrent.TimeUnit;
...
@@ -18,7 +18,7 @@ import java.util.concurrent.TimeUnit;
@Component
@Component
@Slf4j
@Slf4j
public
class
ScheduleTestTwo
{
public
class
ScheduleTestTwo
{
@Scheduled
(
cron
=
"0/10 * * * * *"
)
//
@Scheduled(cron = "0/10 * * * * *")
public
void
second
()
throws
InterruptedException
{
public
void
second
()
throws
InterruptedException
{
log
.
info
(
"Second scheduled task is running... ..."
);
log
.
info
(
"Second scheduled task is running... ..."
);
TimeUnit
.
SECONDS
.
sleep
(
5
);
TimeUnit
.
SECONDS
.
sleep
(
5
);
...
...
src/main/java/com/kwan/springbootkwan/service/IUserService.java
浏览文件 @
2b371853
...
@@ -21,4 +21,11 @@ public interface IUserService extends IService<User> {
...
@@ -21,4 +21,11 @@ public interface IUserService extends IService<User> {
*/
*/
User
getUserById
(
Integer
id
);
User
getUserById
(
Integer
id
);
/**
* 根据姓名查询
*
* @param sex
* @return
*/
User
getUserByName
(
String
sex
);
}
}
src/main/java/com/kwan/springbootkwan/service/impl/UserServiceImpl.java
浏览文件 @
2b371853
...
@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
@Service
@Service
public
class
UserServiceImpl
extends
ServiceImpl
<
UserMapper
,
User
>
implements
IUserService
{
public
class
UserServiceImpl
extends
ServiceImpl
<
UserMapper
,
User
>
implements
IUserService
{
...
@@ -24,4 +25,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
...
@@ -24,4 +25,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
public
User
getUserById
(
Integer
id
)
{
public
User
getUserById
(
Integer
id
)
{
return
userMapper
.
selectById
(
id
);
return
userMapper
.
selectById
(
id
);
}
}
@Override
public
User
getUserByName
(
String
sex
)
{
User
userByName
=
userMapper
.
getUserByName
(
sex
);
if
(
Objects
.
isNull
(
userByName
))
{
userByName
=
new
User
();
}
return
userByName
;
}
}
}
\ No newline at end of file
src/main/resources/mapper/AdsDimFinancialYearWeekInfoDao.xml
浏览文件 @
2b371853
<?xml version="1.0" encoding="UTF-8"?>
<?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">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.kwan.springbootkwan.mapper.AdsDimFinancialYearWeekInfo
Dao
"
>
<mapper
namespace=
"com.kwan.springbootkwan.mapper.AdsDimFinancialYearWeekInfo
Mapper
"
>
<resultMap
type=
"com.kwan.springbootkwan.entity.AdsDimFinancialYearWeekInfo"
id=
"AdsDimFinancialYearWeekInfoMap"
>
<resultMap
type=
"com.kwan.springbootkwan.entity.AdsDimFinancialYearWeekInfo"
id=
"AdsDimFinancialYearWeekInfoMap"
>
<result
property=
"financialYear"
column=
"financial_year"
jdbcType=
"INTEGER"
/>
<result
property=
"financialYear"
column=
"financial_year"
jdbcType=
"INTEGER"
/>
...
...
src/main/resources/mapper/UserMapper.xml
浏览文件 @
2b371853
<?xml version="1.0" encoding="UTF-8"?>
<?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">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.kwan.springbootkwan.mapper.UserMapper"
>
<mapper
namespace=
"com.kwan.springbootkwan.mapper.UserMapper"
>
<!-- <select id="getUserByName" resultType="com.kwan.springbootkwan.entity.User">-->
<!-- SELECT * from user-->
<!-- where 1=1-->
<!-- <if test="name != null and name != ''">-->
<!-- and name = #{name}-->
<!-- </if>-->
<!-- </select>-->
<select
id=
"getUserByName"
resultType=
"com.kwan.springbootkwan.entity.User"
>
SELECT *
FROM user
WHERE sex = #{sex}
</select>
</mapper>
</mapper>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录