Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1-office-web-sit
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴迪
gs1-office-web-sit
Commits
26abc8dc
Commit
26abc8dc
authored
Oct 25, 2021
by
吴迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】培训计划管理模块接口新增
parent
99cc08b0
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
264 additions
and
18 deletions
+264
-18
Query.java
src/main/java/io/office/common/utils/Query.java
+15
-15
CorsConfig.java
src/main/java/io/office/config/CorsConfig.java
+3
-2
NewsMovieController.java
...office/modules/manage/controller/NewsMovieController.java
+1
-1
PlanBranchController.java
...ffice/modules/manage/controller/PlanBranchController.java
+90
-0
PlanBranchDao.java
...main/java/io/office/modules/manage/dao/PlanBranchDao.java
+17
-0
PlanBranchEntity.java
...ava/io/office/modules/manage/entity/PlanBranchEntity.java
+64
-0
PlanBranchService.java
...a/io/office/modules/manage/service/PlanBranchService.java
+20
-0
PlanBranchServiceImpl.java
...ce/modules/manage/service/impl/PlanBranchServiceImpl.java
+32
-0
PlanBranchDao.xml
src/main/resources/mapper/manage/PlanBranchDao.xml
+22
-0
No files found.
src/main/java/io/office/common/utils/Query.java
View file @
26abc8dc
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
*
<p>
* https://www.renren.io
*
*
<p>
* 版权所有,侵权必究!
*/
...
...
@@ -32,11 +32,11 @@ public class Query<T> {
long
curPage
=
1
;
long
limit
=
10
;
if
(
params
.
get
(
Constant
.
PAGE
)
!=
null
)
{
curPage
=
Long
.
parseLong
((
String
)
params
.
get
(
Constant
.
PAGE
));
if
(
params
.
get
(
Constant
.
PAGE
)
!=
null
)
{
curPage
=
Long
.
parseLong
((
String
)
params
.
get
(
Constant
.
PAGE
));
}
if
(
params
.
get
(
Constant
.
LIMIT
)
!=
null
)
{
limit
=
Long
.
parseLong
((
String
)
params
.
get
(
Constant
.
LIMIT
));
if
(
params
.
get
(
Constant
.
LIMIT
)
!=
null
)
{
limit
=
Long
.
parseLong
((
String
)
params
.
get
(
Constant
.
LIMIT
));
}
//分页对象
...
...
@@ -47,28 +47,28 @@ public class Query<T> {
//排序字段
//防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险)
String
orderField
=
SQLFilter
.
sqlInject
((
String
)
params
.
get
(
Constant
.
ORDER_FIELD
));
String
order
=
(
String
)
params
.
get
(
Constant
.
ORDER
);
String
orderField
=
SQLFilter
.
sqlInject
((
String
)
params
.
get
(
Constant
.
ORDER_FIELD
));
String
order
=
(
String
)
params
.
get
(
Constant
.
ORDER
);
//前端字段排序
if
(
StringUtils
.
isNotEmpty
(
orderField
)
&&
StringUtils
.
isNotEmpty
(
order
))
{
if
(
Constant
.
ASC
.
equalsIgnoreCase
(
order
))
{
return
page
.
addOrder
(
OrderItem
.
asc
(
orderField
));
}
else
{
if
(
StringUtils
.
isNotEmpty
(
orderField
)
&&
StringUtils
.
isNotEmpty
(
order
))
{
if
(
Constant
.
ASC
.
equalsIgnoreCase
(
order
))
{
return
page
.
addOrder
(
OrderItem
.
asc
(
orderField
));
}
else
{
return
page
.
addOrder
(
OrderItem
.
desc
(
orderField
));
}
}
//没有排序字段,则不排序
if
(
StringUtils
.
isBlank
(
defaultOrderField
))
{
if
(
StringUtils
.
isBlank
(
defaultOrderField
))
{
return
page
;
}
//默认排序
if
(
isAsc
)
{
if
(
isAsc
)
{
page
.
addOrder
(
OrderItem
.
asc
(
defaultOrderField
));
}
else
{
}
else
{
page
.
addOrder
(
OrderItem
.
desc
(
defaultOrderField
));
}
...
...
src/main/java/io/office/config/CorsConfig.java
View file @
26abc8dc
...
...
@@ -11,12 +11,12 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public
class
CorsConfig
implements
WebMvcConfigurer
{
/*
@Override
@Override
public
void
addCorsMappings
(
CorsRegistry
registry
)
{
registry
.
addMapping
(
"/**"
)
.
allowedOrigins
(
"*"
)
.
allowCredentials
(
true
)
.
allowedMethods
(
"GET"
,
"POST"
,
"PUT"
,
"DELETE"
,
"OPTIONS"
)
.
maxAge
(
3600
);
}
*/
}
}
\ No newline at end of file
src/main/java/io/office/modules/manage/controller/NewsMovieController.java
View file @
26abc8dc
...
...
@@ -46,7 +46,7 @@ public class NewsMovieController extends AbstractController {
*/
@RequestMapping
(
"/list"
)
// @RequiresPermissions("manage:newsmovie:list")
public
R
list
(
@Request
Param
Map
<
String
,
Object
>
params
){
public
R
list
(
@Request
Body
Map
<
String
,
Object
>
params
){
PageUtils
page
=
newsMovieService
.
queryPage
(
params
);
return
R
.
ok
().
put
(
"page"
,
page
);
...
...
src/main/java/io/office/modules/manage/controller/PlanBranchController.java
0 → 100644
View file @
26abc8dc
package
io
.
office
.
modules
.
manage
.
controller
;
import
java.util.Arrays
;
import
java.util.Map
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
io.office.modules.manage.entity.PlanBranchEntity
;
import
io.office.modules.manage.service.PlanBranchService
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.R
;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-25 16:00:07
*/
@RestController
@RequestMapping
(
"/planbranch"
)
public
class
PlanBranchController
{
@Autowired
private
PlanBranchService
planBranchService
;
/**
* 列表
*/
@RequestMapping
(
"/list"
)
// @RequiresPermissions("manage:planbranch:list")
public
R
list
(
@RequestBody
Map
<
String
,
Object
>
params
){
PageUtils
page
=
planBranchService
.
queryPage
(
params
);
return
R
.
ok
().
put
(
"page"
,
page
);
}
/**
* 信息
*/
@RequestMapping
(
"/info/{id}"
)
// @RequiresPermissions("manage:planbranch:info")
public
R
info
(
@PathVariable
(
"id"
)
Integer
id
){
PlanBranchEntity
planBranch
=
planBranchService
.
getById
(
id
);
return
R
.
ok
().
put
(
"planBranch"
,
planBranch
);
}
/**
* 保存
*/
@RequestMapping
(
"/save"
)
// @RequiresPermissions("manage:planbranch:save")
public
R
save
(
@RequestBody
PlanBranchEntity
planBranch
){
planBranchService
.
save
(
planBranch
);
return
R
.
ok
();
}
/**
* 修改
*/
@RequestMapping
(
"/update"
)
// @RequiresPermissions("manage:planbranch:update")
public
R
update
(
@RequestBody
PlanBranchEntity
planBranch
){
planBranchService
.
updateById
(
planBranch
);
return
R
.
ok
();
}
/**
* 删除
*/
@RequestMapping
(
"/delete"
)
// @RequiresPermissions("manage:planbranch:delete")
public
R
delete
(
@RequestBody
Integer
[]
ids
){
planBranchService
.
removeByIds
(
Arrays
.
asList
(
ids
));
return
R
.
ok
();
}
}
src/main/java/io/office/modules/manage/dao/PlanBranchDao.java
0 → 100644
View file @
26abc8dc
package
io
.
office
.
modules
.
manage
.
dao
;
import
io.office.modules.manage.entity.PlanBranchEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-25 16:00:07
*/
@Mapper
public
interface
PlanBranchDao
extends
BaseMapper
<
PlanBranchEntity
>
{
}
src/main/java/io/office/modules/manage/entity/PlanBranchEntity.java
0 → 100644
View file @
26abc8dc
package
io
.
office
.
modules
.
manage
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-25 16:00:07
*/
@Data
@TableName
(
"Plan_branch"
)
public
class
PlanBranchEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* $column.comments
*/
@TableId
private
Integer
id
;
/**
* $column.comments
*/
private
Integer
idNum
;
/**
* $column.comments
*/
private
String
name
;
/**
* $column.comments
*/
private
String
ppath
;
/**
* $column.comments
*/
private
Integer
classnum
;
/**
* $column.comments
*/
private
String
lasteditor
;
/**
* $column.comments
*/
private
Date
updatetime
;
/**
* $column.comments
*/
private
Integer
state
;
/**
* $column.comments
*/
private
String
auditor
;
/**
* $column.comments
*/
private
Integer
checkflag
;
}
src/main/java/io/office/modules/manage/service/PlanBranchService.java
0 → 100644
View file @
26abc8dc
package
io
.
office
.
modules
.
manage
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
io.office.common.utils.PageUtils
;
import
io.office.modules.manage.entity.PlanBranchEntity
;
import
java.util.Map
;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-25 16:00:07
*/
public
interface
PlanBranchService
extends
IService
<
PlanBranchEntity
>
{
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
}
src/main/java/io/office/modules/manage/service/impl/PlanBranchServiceImpl.java
0 → 100644
View file @
26abc8dc
package
io
.
office
.
modules
.
manage
.
service
.
impl
;
import
org.springframework.stereotype.Service
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.Query
;
import
io.office.modules.manage.dao.PlanBranchDao
;
import
io.office.modules.manage.entity.PlanBranchEntity
;
import
io.office.modules.manage.service.PlanBranchService
;
@Service
(
"planBranchService"
)
public
class
PlanBranchServiceImpl
extends
ServiceImpl
<
PlanBranchDao
,
PlanBranchEntity
>
implements
PlanBranchService
{
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
QueryWrapper
<
PlanBranchEntity
>
planBranchEntityQueryWrapper
=
new
QueryWrapper
<>();
planBranchEntityQueryWrapper
.
eq
(
params
.
containsKey
(
"classnum"
),
"classnum"
,
params
.
get
(
"classnum"
));
planBranchEntityQueryWrapper
.
orderByAsc
(
"id"
);
IPage
<
PlanBranchEntity
>
page
=
this
.
page
(
new
Query
<
PlanBranchEntity
>().
getPage
(
params
),
planBranchEntityQueryWrapper
);
return
new
PageUtils
(
page
);
}
}
\ No newline at end of file
src/main/resources/mapper/manage/PlanBranchDao.xml
0 → 100644
View file @
26abc8dc
<?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=
"io.office.modules.manage.dao.PlanBranchDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"io.office.modules.manage.entity.PlanBranchEntity"
id=
"planBranchMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"idNum"
column=
"id_num"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"ppath"
column=
"Ppath"
/>
<result
property=
"classnum"
column=
"classnum"
/>
<result
property=
"lasteditor"
column=
"lasteditor"
/>
<result
property=
"updatetime"
column=
"updatetime"
/>
<result
property=
"state"
column=
"state"
/>
<result
property=
"auditor"
column=
"auditor"
/>
<result
property=
"checkflag"
column=
"checkflag"
/>
</resultMap>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment