|
|
@@ -71,15 +71,18 @@ public class ActiveProductRecordController extends BladeController {
|
|
|
|
|
|
ActiveProductRecord detail = activeProductRecordService.getOne(Condition.getQueryWrapper(activeProductRecord));
|
|
|
|
|
|
- //获取排名
|
|
|
- String key = ActiveProductConstant.PRODUCT_SORT_CACHE_KEY.concat(":").concat(detail.getActiveId().toString());
|
|
|
- Long revrank = bladeRedis.zRevrank(key, detail.getId());
|
|
|
-
|
|
|
- //赋值
|
|
|
- ActiveProductRecordVO activeProductRecordVO = ActiveProductRecordWrapper.build().entityVO(detail);
|
|
|
- activeProductRecordVO.setRank(revrank + 1);
|
|
|
-
|
|
|
- return R.data(activeProductRecordVO);
|
|
|
+ if (detail != null){
|
|
|
+ //获取排名
|
|
|
+ String key = ActiveProductConstant.PRODUCT_SORT_CACHE_KEY.concat(":").concat(detail.getActiveId().toString());
|
|
|
+ Long revrank = bladeRedis.zRevrank(key, detail.getId());
|
|
|
+
|
|
|
+ ActiveProductRecordVO activeProductRecordVO = ActiveProductRecordWrapper.build().entityVO(detail);
|
|
|
+ if (revrank != null){
|
|
|
+ activeProductRecordVO.setRank(revrank + 1);
|
|
|
+ }
|
|
|
+ return R.data(activeProductRecordVO);
|
|
|
+ }
|
|
|
+ return R.data(null);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -132,7 +135,7 @@ public class ActiveProductRecordController extends BladeController {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@ApiOperation(value = "新增或修改", notes = "传入activeProductRecord")
|
|
|
public R submit(@Valid @RequestBody ActiveProductRecord activeProductRecord) {
|
|
|
- if(ObjectUtils.isNotEmpty(activeProductRecord.getProductNo())){
|
|
|
+ if(ObjectUtils.isEmpty(activeProductRecord.getProductNo())){
|
|
|
//查询最大值
|
|
|
Map<String, Object> map = activeProductRecordService.getMap(Wrappers.<ActiveProductRecord>query().select(new StringBuilder("IFNULL(max(")
|
|
|
.append(BeanPropertyUtil.getFieldNameToUnder(ActiveProductRecord::getProductNo)).append("),0) as NO").toString())
|