Commit 0935422c authored by zhangfeng's avatar zhangfeng

feature-reward:增删改分页查询基础功能

parent 8526f66c
...@@ -76,19 +76,49 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i ...@@ -76,19 +76,49 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
@Override @Override
public PageResult<RewardDO> getPage(RewardQueryVO query, PageVO page) { public PageResult<RewardDO> getPage(RewardQueryVO query, PageVO page) {
PageResult<RewardDO> rewardDOPageResult = rewardMapper.selectPage(page, new LambdaQuery<RewardDO>() LambdaQuery<RewardDO> lambdaQuery = new LambdaQuery<>();
.eqIfPresent(RewardDO::getCode, query.getCode()) //礼品ID
.eqIfPresent(RewardDO::getTitleZh, query.getTitle()) lambdaQuery.eqIfPresent(RewardDO::getCode, query.getCode());
.eqIfPresent(RewardDO::getTitleEn, query.getTitle()) //礼品名称,模糊匹配三种语言
.eqIfPresent(RewardDO::getTitleFr, query.getTitle()) if (query.getTitle() != null) {
.eqIfPresent(RewardDO::getPointsRequire, query.getPointsRequire()) lambdaQuery.and(wrapper ->
.eqIfPresent(RewardDO::getNodeId, query.getNodeId()) wrapper.like(RewardDO::getTitleZh, query.getTitle())
.eqIfPresent(RewardDO::getQuantityRemain, query.getQuantityRemain()) .or()
.like(RewardDO::getTitleEn, query.getTitle())
.or()
.like(RewardDO::getTitleFr, query.getTitle())
);
}
//兑换积分
if (query.getPointsRequireSymbol() != null && query.getPointsRequire() != null) {
lambdaQuery.gt(query.getPointsRequireSymbol() == 1, RewardDO::getPointsRequire, query.getPointsRequire())
.eq(query.getPointsRequireSymbol() == 2, RewardDO::getPointsRequire, query.getPointsRequire())
.lt(query.getPointsRequireSymbol() == 3, RewardDO::getPointsRequire, query.getPointsRequire());
}
//兑换网点id,领取方式,状态
lambdaQuery.eqIfPresent(RewardDO::getNodeId, query.getNodeId())
.eqIfPresent(RewardDO::getPickMethod, query.getPickMethod()) .eqIfPresent(RewardDO::getPickMethod, query.getPickMethod())
.eqIfPresent(RewardDO::getStatus, query.getStatus()) .eqIfPresent(RewardDO::getStatus, query.getStatus());
.betweenIfPresent(RewardDO::getCreateTime, query.getBeginCreateTime(), query.getEndCreateTime()) //备注,模糊匹配三种语言
.orderByDesc(RewardDO::getId)); if (query.getRemark() != null) {
return rewardDOPageResult; lambdaQuery.and(wrapper ->
wrapper.like(RewardDO::getRemarkZh, query.getRemark())
.or()
.like(RewardDO::getRemarkEn, query.getRemark())
.or()
.like(RewardDO::getRemarkFr, query.getRemark())
);
}
//剩余数量
if (query.getQuantityRemainSymbol() != null && query.getQuantityRemain() != null) {
lambdaQuery.gt(query.getQuantityRemainSymbol() == 1, RewardDO::getQuantityRemain, query.getQuantityRemain())
.eq(query.getQuantityRemainSymbol() == 2, RewardDO::getQuantityRemain, query.getQuantityRemain())
.lt(query.getQuantityRemainSymbol() == 3, RewardDO::getQuantityRemain, query.getQuantityRemain());
}
//创建时间
lambdaQuery.betweenIfPresent(RewardDO::getCreateTime, query.getBeginCreateTime(), query.getEndCreateTime())
.orderByDesc(RewardDO::getId);
return rewardMapper.selectPage(page, lambdaQuery);
} }
@Override @Override
......
package cn.iocoder.yudao.module.reward.controller.admin.config;
import cn.iocoder.yudao.framework.swagger.config.YudaoSwaggerAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.spring.web.plugins.Docket;
import javax.annotation.Resource;
/**
* Swagger2 自动配置类
* @author 捷道源码
*/
@Configuration
public class SwaggerRewardConfiguration {
@Bean
public Docket createAdminShipmentApi() {
String title = "管理端-礼品管理";
String author = "管理端-礼品管理";
String basePackage = "cn.iocoder.yudao.module.reward.controller.admin";
// 创建 Docket 对象
return autoConfiguration.docket(title, author, basePackage);
}
@Resource
private YudaoSwaggerAutoConfiguration autoConfiguration;
}
...@@ -24,7 +24,7 @@ import cn.iocoder.yudao.module.reward.service.reward.RewardService; ...@@ -24,7 +24,7 @@ import cn.iocoder.yudao.module.reward.service.reward.RewardService;
@Validated @Validated
@RestController @RestController
@Api(tags = "管理后台 - 礼品") @Api(tags = "管理后台 - 礼品管理")
@RequestMapping("/ecw/reward/") @RequestMapping("/ecw/reward/")
public class RewardController { public class RewardController {
...@@ -33,14 +33,14 @@ public class RewardController { ...@@ -33,14 +33,14 @@ public class RewardController {
@PostMapping("/create") @PostMapping("/create")
@ApiOperation("创建礼品") @ApiOperation("创建礼品")
@PreAuthorize("@ss.hasPermission('reward::create')") //@PreAuthorize("@ss.hasPermission('reward::create')")
public CommonResult<Long> create(@Valid @RequestBody RewardCreateReqVO createReqVO) { public CommonResult<Long> create(@Valid @RequestBody RewardCreateReqVO createReqVO) {
return success(rewardService.create(createReqVO)); return success(rewardService.create(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@ApiOperation("更新礼品") @ApiOperation("更新礼品")
@PreAuthorize("@ss.hasPermission('reward::update')") //@PreAuthorize("@ss.hasPermission('reward::update')")
public CommonResult<Boolean> update(@Valid @RequestBody RewardUpdateReqVO updateReqVO) { public CommonResult<Boolean> update(@Valid @RequestBody RewardUpdateReqVO updateReqVO) {
rewardService.update(updateReqVO); rewardService.update(updateReqVO);
return success(true); return success(true);
...@@ -49,7 +49,7 @@ public class RewardController { ...@@ -49,7 +49,7 @@ public class RewardController {
@DeleteMapping("/delete") @DeleteMapping("/delete")
@ApiOperation("删除礼品") @ApiOperation("删除礼品")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('reward::delete')") //@PreAuthorize("@ss.hasPermission('reward::delete')")
public CommonResult<Boolean> delete(@RequestParam("id") Long id) { public CommonResult<Boolean> delete(@RequestParam("id") Long id) {
rewardService.delete(id); rewardService.delete(id);
return success(true); return success(true);
...@@ -58,7 +58,7 @@ public class RewardController { ...@@ -58,7 +58,7 @@ public class RewardController {
@GetMapping("/get") @GetMapping("/get")
@ApiOperation("获得礼品详情") @ApiOperation("获得礼品详情")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('reward::query')") //@PreAuthorize("@ss.hasPermission('reward::query')")
public CommonResult<RewardBackVO> get(@RequestParam("id") Long id) { public CommonResult<RewardBackVO> get(@RequestParam("id") Long id) {
RewardDO rewardDO = rewardService.get(id); RewardDO rewardDO = rewardService.get(id);
return success(RewardConvert.INSTANCE.convert(rewardDO)); return success(RewardConvert.INSTANCE.convert(rewardDO));
...@@ -67,7 +67,7 @@ public class RewardController { ...@@ -67,7 +67,7 @@ public class RewardController {
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("获得礼品列表") @ApiOperation("获得礼品列表")
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
@PreAuthorize("@ss.hasPermission('reward::query')") //@PreAuthorize("@ss.hasPermission('reward::query')")
public CommonResult<List<RewardBackVO>> getList(@RequestParam("ids") Collection<Long> ids) { public CommonResult<List<RewardBackVO>> getList(@RequestParam("ids") Collection<Long> ids) {
List<RewardDO> list = rewardService.getList(ids); List<RewardDO> list = rewardService.getList(ids);
return success(RewardConvert.INSTANCE.convertList(list)); return success(RewardConvert.INSTANCE.convertList(list));
...@@ -75,7 +75,7 @@ public class RewardController { ...@@ -75,7 +75,7 @@ public class RewardController {
@GetMapping("/page") @GetMapping("/page")
@ApiOperation("获得礼品分页") @ApiOperation("获得礼品分页")
@PreAuthorize("@ss.hasPermission('reward::query')") //@PreAuthorize("@ss.hasPermission('reward::query')")
public CommonResult<PageResult<RewardBackVO>> getPage(@Valid RewardQueryVO query, PageVO page) { public CommonResult<PageResult<RewardBackVO>> getPage(@Valid RewardQueryVO query, PageVO page) {
PageResult<RewardDO> pageResult = rewardService.getPage(query, page); PageResult<RewardDO> pageResult = rewardService.getPage(query, page);
return success(RewardConvert.INSTANCE.convertPage(pageResult)); return success(RewardConvert.INSTANCE.convertPage(pageResult));
...@@ -83,7 +83,7 @@ public class RewardController { ...@@ -83,7 +83,7 @@ public class RewardController {
@GetMapping("/export-excel") @GetMapping("/export-excel")
@ApiOperation("导出礼品 Excel") @ApiOperation("导出礼品 Excel")
@PreAuthorize("@ss.hasPermission('reward::export')") //@PreAuthorize("@ss.hasPermission('reward::export')")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public void exportExcel(@Valid RewardQueryVO query, public void exportExcel(@Valid RewardQueryVO query,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
......
...@@ -114,6 +114,11 @@ ...@@ -114,6 +114,11 @@
<!-- <version>${revision}</version>--> <!-- <version>${revision}</version>-->
<!-- </dependency>--> <!-- </dependency>-->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-reward-impl</artifactId>
<version>${revision}</version>
</dependency>
<!-- spring boot 配置所需依赖 --> <!-- spring boot 配置所需依赖 -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment