@ -1,9 +1,22 @@
@@ -1,9 +1,22 @@
package com.cloud.kicc.commonbiz.controller ;
import org.springframework.web.bind.annotation.RequestMapping ;
import cn.hutool.core.util.StrUtil ;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper ;
import com.baomidou.mybatisplus.core.metadata.IPage ;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page ;
import com.cloud.kicc.common.core.api.R ;
import com.cloud.kicc.common.core.constant.AppConstants ;
import com.cloud.kicc.commonbiz.api.entity.PushRecord ;
import com.cloud.kicc.commonbiz.api.entity.PushThirdParty ;
import com.cloud.kicc.commonbiz.service.IPushRecordService ;
import io.swagger.annotations.Api ;
import io.swagger.annotations.ApiOperation ;
import lombok.RequiredArgsConstructor ;
import org.springframework.web.bind.annotation.* ;
import org.springframework.stereotype.Controller ;
import javax.validation.Valid ;
import java.util.Arrays ;
/ * *
* < p >
@ -13,9 +26,55 @@ import org.springframework.stereotype.Controller;
@@ -13,9 +26,55 @@ import org.springframework.stereotype.Controller;
* @author wangxiang4
* @since 2023 - 02 - 17
* /
@Controller
@RequestMapping ( "/pushRecord" )
@RestController
@RequestMapping ( AppConstants . APP_COMMON + "/pushRecord" )
@RequiredArgsConstructor
@Api ( tags = "推送消息记录" )
public class PushRecordController {
private final IPushRecordService iPushRecordService ;
private LambdaQueryWrapper < PushRecord > getQueryWrapper ( PushRecord pushRecord ) {
return new LambdaQueryWrapper < PushRecord > ( )
. like ( StrUtil . isNotBlank ( pushRecord . getTitle ( ) ) , PushRecord : : getTitle , pushRecord . getTitle ( ) )
. eq ( StrUtil . isNotBlank ( pushRecord . getApplicationId ( ) ) , PushRecord : : getApplicationId , pushRecord . getApplicationId ( ) )
. eq ( StrUtil . isNotBlank ( pushRecord . getAliasUserId ( ) ) , PushRecord : : getAliasUserId , pushRecord . getAliasUserId ( ) )
. eq ( StrUtil . isNotBlank ( pushRecord . getAliasType ( ) ) , PushRecord : : getAliasType , pushRecord . getAliasType ( ) ) ;
}
@ApiOperation ( "分页查询" )
@GetMapping ( "/list" )
public R list ( Page page , PushRecord pushRecord ) {
IPage < PushThirdParty > list = iPushRecordService . page ( page , getQueryWrapper ( pushRecord ) ) ;
return R . ok ( list . getRecords ( ) , list . getTotal ( ) ) ;
}
@ApiOperation ( "根据ID查询" )
@GetMapping ( "/{id:\\w+}" )
public R getById ( @PathVariable ( "id" ) String id ) {
return R . ok ( iPushRecordService . getById ( id ) ) ;
}
@ApiOperation ( "保存" )
@PostMapping ( "/save" )
public R save ( @Valid @RequestBody PushRecord pushRecord ) {
iPushRecordService . save ( pushRecord ) ;
return R . ok ( ) ;
}
@ApiOperation ( "修改" )
@PutMapping ( "/update" )
public R update ( @Valid @RequestBody PushRecord pushRecord ) {
iPushRecordService . updateById ( pushRecord ) ;
return R . ok ( ) ;
}
@ApiOperation ( "删除" )
@DeleteMapping ( "/remove/{ids:[\\w,]+}" )
public R < Boolean > removeById ( @PathVariable String [ ] ids ) {
iPushRecordService . removeByIds ( Arrays . asList ( ids ) ) ;
return R . ok ( ) ;
}
}