Commit 0935422c authored by zhangfeng's avatar zhangfeng

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

parent 8526f66c
......@@ -76,19 +76,49 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
@Override
public PageResult<RewardDO> getPage(RewardQueryVO query, PageVO page) {
PageResult<RewardDO> rewardDOPageResult = rewardMapper.selectPage(page, new LambdaQuery<RewardDO>()
.eqIfPresent(RewardDO::getCode, query.getCode())
.eqIfPresent(RewardDO::getTitleZh, query.getTitle())
.eqIfPresent(RewardDO::getTitleEn, query.getTitle())
.eqIfPresent(RewardDO::getTitleFr, query.getTitle())
.eqIfPresent(RewardDO::getPointsRequire, query.getPointsRequire())
.eqIfPresent(RewardDO::getNodeId, query.getNodeId())
.eqIfPresent(RewardDO::getQuantityRemain, query.getQuantityRemain())
LambdaQuery<RewardDO> lambdaQuery = new LambdaQuery<>();
//礼品ID
lambdaQuery.eqIfPresent(RewardDO::getCode, query.getCode());
//礼品名称,模糊匹配三种语言
if (query.getTitle() != null) {
lambdaQuery.and(wrapper ->
wrapper.like(RewardDO::getTitleZh, query.getTitle())
.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::getStatus, query.getStatus())
.betweenIfPresent(RewardDO::getCreateTime, query.getBeginCreateTime(), query.getEndCreateTime())
.orderByDesc(RewardDO::getId));
return rewardDOPageResult;
.eqIfPresent(RewardDO::getStatus, query.getStatus());
//备注,模糊匹配三种语言
if (query.getRemark() != null) {
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
......
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;
@Validated
@RestController
@Api(tags = "管理后台 - 礼品")
@Api(tags = "管理后台 - 礼品管理")
@RequestMapping("/ecw/reward/")
public class RewardController {
......@@ -33,14 +33,14 @@ public class RewardController {
@PostMapping("/create")
@ApiOperation("创建礼品")
@PreAuthorize("@ss.hasPermission('reward::create')")
//@PreAuthorize("@ss.hasPermission('reward::create')")
public CommonResult<Long> create(@Valid @RequestBody RewardCreateReqVO createReqVO) {
return success(rewardService.create(createReqVO));
}
@PutMapping("/update")
@ApiOperation("更新礼品")
@PreAuthorize("@ss.hasPermission('reward::update')")
//@PreAuthorize("@ss.hasPermission('reward::update')")
public CommonResult<Boolean> update(@Valid @RequestBody RewardUpdateReqVO updateReqVO) {
rewardService.update(updateReqVO);
return success(true);
......@@ -49,7 +49,7 @@ public class RewardController {
@DeleteMapping("/delete")
@ApiOperation("删除礼品")
@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) {
rewardService.delete(id);
return success(true);
......@@ -58,7 +58,7 @@ public class RewardController {
@GetMapping("/get")
@ApiOperation("获得礼品详情")
@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) {
RewardDO rewardDO = rewardService.get(id);
return success(RewardConvert.INSTANCE.convert(rewardDO));
......@@ -67,7 +67,7 @@ public class RewardController {
@GetMapping("/list")
@ApiOperation("获得礼品列表")
@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) {
List<RewardDO> list = rewardService.getList(ids);
return success(RewardConvert.INSTANCE.convertList(list));
......@@ -75,7 +75,7 @@ public class RewardController {
@GetMapping("/page")
@ApiOperation("获得礼品分页")
@PreAuthorize("@ss.hasPermission('reward::query')")
//@PreAuthorize("@ss.hasPermission('reward::query')")
public CommonResult<PageResult<RewardBackVO>> getPage(@Valid RewardQueryVO query, PageVO page) {
PageResult<RewardDO> pageResult = rewardService.getPage(query, page);
return success(RewardConvert.INSTANCE.convertPage(pageResult));
......@@ -83,7 +83,7 @@ public class RewardController {
@GetMapping("/export-excel")
@ApiOperation("导出礼品 Excel")
@PreAuthorize("@ss.hasPermission('reward::export')")
//@PreAuthorize("@ss.hasPermission('reward::export')")
@OperateLog(type = EXPORT)
public void exportExcel(@Valid RewardQueryVO query,
HttpServletResponse response) throws IOException {
......
......@@ -114,6 +114,11 @@
<!-- <version>${revision}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-reward-impl</artifactId>
<version>${revision}</version>
</dependency>
<!-- spring boot 配置所需依赖 -->
<dependency>
<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