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
65c7eb79
Commit
65c7eb79
authored
Nov 16, 2021
by
rongkailun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】提供商管理新增修改删除列表
parent
606b59a2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
133 additions
and
22 deletions
+133
-22
PartnersController.java
.../office/modules/manage/controller/PartnersController.java
+47
-20
PartnersDao.java
src/main/java/io/office/modules/manage/dao/PartnersDao.java
+7
-1
PartnersService.java
...ava/io/office/modules/manage/service/PartnersService.java
+10
-0
PartnersServiceImpl.java
...fice/modules/manage/service/impl/PartnersServiceImpl.java
+40
-0
PartnersDao.xml
src/main/resources/mapper/manage/PartnersDao.xml
+29
-1
No files found.
src/main/java/io/office/modules/manage/controller/PartnersController.java
View file @
65c7eb79
package
io
.
office
.
modules
.
manage
.
controller
;
package
io
.
office
.
modules
.
manage
.
controller
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.office.modules.manage.entity.ProductEntity
;
import
io.office.modules.sys.controller.AbstractController
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.*
;
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.PartnersEntity
;
import
io.office.modules.manage.entity.PartnersEntity
;
import
io.office.modules.manage.service.PartnersService
;
import
io.office.modules.manage.service.PartnersService
;
...
@@ -27,7 +29,8 @@ import io.office.common.utils.R;
...
@@ -27,7 +29,8 @@ import io.office.common.utils.R;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/partners"
)
@RequestMapping
(
"/partners"
)
public
class
PartnersController
{
@Slf4j
public
class
PartnersController
extends
AbstractController
{
@Autowired
@Autowired
private
PartnersService
partnersService
;
private
PartnersService
partnersService
;
...
@@ -37,9 +40,11 @@ public class PartnersController {
...
@@ -37,9 +40,11 @@ public class PartnersController {
@RequestMapping
(
"/list"
)
@RequestMapping
(
"/list"
)
// @RequiresPermissions("manage:partners:list")
// @RequiresPermissions("manage:partners:list")
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
PageUtils
page
=
partnersService
.
queryPage
(
params
);
Page
<
PartnersEntity
>
page
=
this
.
partnersService
.
selectPartnersList
(
params
,
new
Page
(
Integer
.
valueOf
(
params
.
get
(
"page"
).
toString
()),
return
R
.
ok
().
put
(
"page"
,
page
);
Integer
.
valueOf
(
params
.
get
(
"limit"
).
toString
())));
PageUtils
pageUtils
=
new
PageUtils
(
page
);
return
R
.
ok
().
put
(
"page"
,
pageUtils
);
}
}
...
@@ -57,34 +62,56 @@ public class PartnersController {
...
@@ -57,34 +62,56 @@ public class PartnersController {
/**
/**
* 保存
* 保存
*/
*/
@
Reque
stMapping
(
"/save"
)
@
Po
stMapping
(
"/save"
)
// @RequiresPermissions("manage:partners:save")
// @RequiresPermissions("manage:partners:save")
public
R
save
(
@RequestBody
PartnersEntity
partners
){
public
R
save
(
@RequestBody
PartnersEntity
partners
){
partners
.
setEditor
(
getUser
().
getUsername
());
partners
.
setLasteditor
(
getUser
().
getUsername
());
partnersService
.
save
(
partners
);
partnersService
.
save
(
partners
);
return
R
.
ok
(
"新增成功!"
);
return
R
.
ok
();
}
}
/**
/**
* 修改
* 修改
*/
*/
@
Reque
stMapping
(
"/update"
)
@
Po
stMapping
(
"/update"
)
// @RequiresPermissions("manage:partners:update")
// @RequiresPermissions("manage:partners:update")
public
R
update
(
@RequestBody
PartnersEntity
partners
){
public
R
update
(
@RequestBody
PartnersEntity
partners
){
partners
.
setEditor
(
getUser
().
getUsername
());
partners
.
setLasteditor
(
getUser
().
getUsername
());
partners
.
setUpdatedate
(
new
Date
());
partnersService
.
updateById
(
partners
);
partnersService
.
updateById
(
partners
);
return
R
.
ok
(
"修改成功!"
);
return
R
.
ok
();
}
}
/**
/**
* 删除
* 删除
*/
*/
@
Reque
stMapping
(
"/delete"
)
@
Po
stMapping
(
"/delete"
)
// @RequiresPermissions("manage:partners:delete")
// @RequiresPermissions("manage:partners:delete")
public
R
delete
(
@RequestBody
Integer
[]
ids
){
public
R
delete
(
@RequestBody
List
<
Long
>
ids
){
partnersService
.
removeByIds
(
Arrays
.
asList
(
ids
));
try
{
R
r
=
this
.
partnersService
.
deletePartners
(
ids
,
getUser
());
return
R
.
ok
();
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"delete error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
}
/**
* 审核
*/
@PostMapping
(
"/verifyPartners"
)
// @RequiresPermissions("manage:partners:delete")
public
R
verifyPartners
(
@RequestBody
PartnersEntity
partnersEntity
){
try
{
R
r
=
this
.
partnersService
.
verifyPartners
(
partnersEntity
,
getUser
());
return
r
;
}
catch
(
Exception
e
)
{
log
.
error
(
"verifyPartners error:"
,
e
);
return
R
.
error
(
e
.
getMessage
());
}
}
}
}
src/main/java/io/office/modules/manage/dao/PartnersDao.java
View file @
65c7eb79
package
io
.
office
.
modules
.
manage
.
dao
;
package
io
.
office
.
modules
.
manage
.
dao
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.office.modules.manage.entity.PartnersEntity
;
import
io.office.modules.manage.entity.PartnersEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 提供商管理
* 提供商管理
...
@@ -13,5 +18,6 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -13,5 +18,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
*/
@Mapper
@Mapper
public
interface
PartnersDao
extends
BaseMapper
<
PartnersEntity
>
{
public
interface
PartnersDao
extends
BaseMapper
<
PartnersEntity
>
{
List
<
PartnersEntity
>
selectPartnersList
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
,
Page
page
);
}
}
src/main/java/io/office/modules/manage/service/PartnersService.java
View file @
65c7eb79
package
io
.
office
.
modules
.
manage
.
service
;
package
io
.
office
.
modules
.
manage
.
service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.PageUtils
;
import
io.office.common.utils.R
;
import
io.office.modules.manage.entity.PartnersEntity
;
import
io.office.modules.manage.entity.PartnersEntity
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
...
@@ -16,5 +20,11 @@ import java.util.Map;
...
@@ -16,5 +20,11 @@ import java.util.Map;
public
interface
PartnersService
extends
IService
<
PartnersEntity
>
{
public
interface
PartnersService
extends
IService
<
PartnersEntity
>
{
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
);
R
deletePartners
(
List
<
Long
>
ids
,
SysUserEntity
user
);
Page
<
PartnersEntity
>
selectPartnersList
(
Map
<
String
,
Object
>
params
,
Page
page
);
R
verifyPartners
(
PartnersEntity
partnersEntity
,
SysUserEntity
user
);
}
}
src/main/java/io/office/modules/manage/service/impl/PartnersServiceImpl.java
View file @
65c7eb79
package
io
.
office
.
modules
.
manage
.
service
.
impl
;
package
io
.
office
.
modules
.
manage
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.office.common.utils.R
;
import
io.office.modules.sys.entity.SysUserEntity
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
@@ -16,6 +23,8 @@ import io.office.modules.manage.service.PartnersService;
...
@@ -16,6 +23,8 @@ import io.office.modules.manage.service.PartnersService;
@Service
(
"partnersService"
)
@Service
(
"partnersService"
)
public
class
PartnersServiceImpl
extends
ServiceImpl
<
PartnersDao
,
PartnersEntity
>
implements
PartnersService
{
public
class
PartnersServiceImpl
extends
ServiceImpl
<
PartnersDao
,
PartnersEntity
>
implements
PartnersService
{
@Autowired
PartnersDao
partnersDao
;
@Override
@Override
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
public
PageUtils
queryPage
(
Map
<
String
,
Object
>
params
)
{
IPage
<
PartnersEntity
>
page
=
this
.
page
(
IPage
<
PartnersEntity
>
page
=
this
.
page
(
...
@@ -26,4 +35,34 @@ public class PartnersServiceImpl extends ServiceImpl<PartnersDao, PartnersEntity
...
@@ -26,4 +35,34 @@ public class PartnersServiceImpl extends ServiceImpl<PartnersDao, PartnersEntity
return
new
PageUtils
(
page
);
return
new
PageUtils
(
page
);
}
}
@Override
public
R
deletePartners
(
List
<
Long
>
ids
,
SysUserEntity
user
)
{
PartnersEntity
partnersEntity
=
new
PartnersEntity
();
partnersEntity
.
setUpdatedate
(
new
Date
());
partnersEntity
.
setEditor
(
user
.
getUsername
());
partnersEntity
.
setLasteditor
(
user
.
getUsername
());
partnersEntity
.
setLevels
(
0
);
QueryWrapper
<
PartnersEntity
>
partnersEntityQueryWrapper
=
new
QueryWrapper
<>();
partnersEntityQueryWrapper
.
in
(
"id"
,
ids
);
int
update
=
this
.
baseMapper
.
update
(
partnersEntity
,
partnersEntityQueryWrapper
);
if
(
update
>
0
){
return
R
.
ok
(
"删除成功!"
);
}
else
{
return
R
.
error
(
"删除失败!"
);
}
}
@Override
public
Page
<
PartnersEntity
>
selectPartnersList
(
Map
<
String
,
Object
>
params
,
Page
page
)
{
List
<
PartnersEntity
>
list
=
this
.
partnersDao
.
selectPartnersList
(
params
,
page
);
page
.
setRecords
(
list
);
return
page
;
}
@Override
public
R
verifyPartners
(
PartnersEntity
partnersEntity
,
SysUserEntity
user
)
{
return
null
;
}
}
}
\ No newline at end of file
src/main/resources/mapper/manage/PartnersDao.xml
View file @
65c7eb79
...
@@ -25,5 +25,32 @@
...
@@ -25,5 +25,32 @@
<result
property=
"checkdate"
column=
"checkdate"
/>
<result
property=
"checkdate"
column=
"checkdate"
/>
</resultMap>
</resultMap>
<select
id=
"selectPartnersList"
resultMap=
"partnersMap"
parameterType=
"java.util.Map"
>
select * from Partners where levels>0
<if
test=
"params.firmname !=null and params.firmname !=''"
>
and firmname like concat('%',#{params.firmname},'%')
</if>
<if
test=
"params.editor !=null and params.editor !=''"
>
and editor = #{params.editor}
</if>
<if
test=
"params.status !=null and params.status !=''"
>
and status = #{params.status}
</if>
<if
test=
"params.technology !=null and params.technology !=''"
>
and technology = #{params.technology}
</if>
<if
test=
"params.service !=null and params.service !=''"
>
and service = #{params.service}
</if>
<if
test=
"params.levels !=''"
>
and levels = #{params.levels}
</if>
<if
test=
"params.releaseTimeStart !=null and params.releaseTimeEnd !=null"
>
and releasedate BETWEEN #{params.releaseTimeStart} AND #{params.releaseTimeEnd}
</if>
<if
test=
"params.updateTimeStart !=null and params.updateTimeEnd !=null"
>
and updatedate BETWEEN #{params.updateTimeStart} AND #{params.updateTimeEnd}
</if>
order by id desc
</select>
</mapper>
</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