记得上下班打卡 | git大法好,push需谨慎

Commit 3da7b275 authored by zhengfuxin's avatar zhengfuxin

修改魔方

parent 760b5020
......@@ -56,7 +56,7 @@ public class GoblinFrontCubeParam implements Serializable {
/**
* 商品id
*/
@ApiModelProperty(value = "商品id")
@ApiModelProperty(value = "商品id,用逗号拼接")
private String spuId;
/**
......
package com.liquidnet.client.admin.web.controller.zhengzai.goblin;
import com.alibaba.fastjson.JSON;
import com.liquidnet.client.admin.common.core.controller.BaseController;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.zhengzai.goblin.service.impl.GoblinFrontCubeServiceImpl;
import com.liquidnet.service.goblin.entity.GoblinFrontCube;
import com.liquidnet.service.goblin.param.GoblinFrontCubeParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
......@@ -35,30 +39,43 @@ public class GoblinFrontCubeController extends BaseController {
public AjaxResult list() {
return AjaxResult.success(goblinFrontCubeService.listGoblinFrontCubeParam());
}
/* *//***
/***
* @author zhangfuxin
* @Description: 修改或者删除魔方
* @date 2022/1/7 下午6:30
*//*
*/
@PostMapping("updateOrCreate")
@ApiOperation(value = "修改或者删除魔方")
@ResponseBody
public AjaxResult updateOrCreate(@RequestBody List<GoblinFrontBannerBuildParam> list) {
List<GoblinFrontBanner> goblinFrontBannerList=new ArrayList<>();
for(GoblinFrontBannerBuildParam goblinFrontBannerBuildParam1:list){
GoblinFrontBanner goblinFrontBanner=new GoblinFrontBanner();
BeanUtils.copyProperties(goblinFrontBannerBuildParam1,goblinFrontBanner);
goblinFrontBannerList.add(goblinFrontBanner);
public AjaxResult updateOrCreate(@RequestBody List<GoblinFrontCubeParam> list) {
List<GoblinFrontCube> list1=new ArrayList<>();
for(GoblinFrontCubeParam goblinFrontCubeParam:list){
GoblinFrontCube goblinFrontCube=new GoblinFrontCube();
BeanUtils.copyProperties(goblinFrontCubeParam,goblinFrontCube);
list1.add(goblinFrontCube);
}
logger.info("修改banner{}", JSON.toJSONString(list));
boolean result=goblinFrontBannerService.update(goblinFrontBannerList);
boolean result=goblinFrontCubeService.updateOrCreate(list1);
if (result ) {
return success("操作成功");
} else {
return error("操作失败");
}
}
@PostMapping("delete")
@ApiOperation(value = "删除魔方")
@ResponseBody
public AjaxResult delete( @RequestBody GoblinFrontCubeParam goblinFrontCubeParam) {
boolean result=goblinFrontCubeService.deleteGoblinFrontCube(goblinFrontCubeParam.getMid());
if (result ) {
return success("操作成功");
} else {
return error("操作失败");
}
}
*/
}
......@@ -47,8 +47,17 @@ public class GoblinFrontCubeServiceImpl extends ServiceImpl<GoblinFrontCubeMappe
goblinFrontCubeMapper.insert(goblinFrontCube);
return true;
}
public boolean deleteGoblinFrontCube(Long id){
GoblinFrontCube goblinFrontCube=goblinFrontCubeMapper.selectById(id);
goblinFrontCube.setDelTag(1);
goblinFrontCube.setUpdateTime(LocalDateTime.now());
//数据库修改
goblinFrontCubeMapper.updateById(goblinFrontCube);
return true;
}
public boolean updateOrCreate(GoblinFrontCube goblinFrontCube) {
public boolean updateOrCreate(List<GoblinFrontCube> list) {
for(GoblinFrontCube goblinFrontCube:list){
if (goblinFrontCube.getMid() == 0) {
this.create(goblinFrontCube);
} else {
......@@ -56,6 +65,7 @@ public class GoblinFrontCubeServiceImpl extends ServiceImpl<GoblinFrontCubeMappe
//数据库修改
goblinFrontCubeMapper.updateById(goblinFrontCube);
}
}
return true;
}
public List<GoblinFrontCubeParam> listGoblinFrontCubeParam(){
......@@ -64,16 +74,23 @@ public class GoblinFrontCubeServiceImpl extends ServiceImpl<GoblinFrontCubeMappe
List<GoblinFrontCube> list=goblinFrontCubeMapper.selectList(queryWrapper);
List<GoblinFrontCubeParam> list1=new ArrayList<>();
for(GoblinFrontCube goblinFrontCube:list){
String[] spuIds=goblinFrontCube.getSpuId().split(",");
for(String supid:spuIds){
//找到 spu详情
LambdaQueryWrapper<GoblinGoods> queryWrappers = Wrappers.lambdaQuery(GoblinGoods.class);
queryWrappers.ne(GoblinGoods::getDelFlg,"1");
queryWrappers.eq(GoblinGoods::getSpuId,goblinFrontCube.getSpuId());
queryWrappers.eq(GoblinGoods::getSpuId,supid);
List<GoblinGoods> goodsList= goblinGoodsMapper.selectList(queryWrappers);
GoblinFrontCubeParam goblinFrontCubeParam=new GoblinFrontCubeParam();
BeanUtils.copyProperties(goblinFrontCube,goblinFrontCubeParam);
goblinFrontCubeParam.setGoblinGoods(goodsList.get(0));
list1.add(goblinFrontCubeParam);
}
}
return list1;
}
......
......@@ -50,11 +50,6 @@ public class GoblinFrontCube implements Serializable {
*/
private String spuId;
/**
* 推荐文案
*/
private String information;
/**
* 合集id
*/
......@@ -68,6 +63,12 @@ public class GoblinFrontCube implements Serializable {
* 0未删除1已删除
*/
private Integer delTag;
/**
* 推荐文案
*/
private String informationA;
private String informationB;
private String informationC;
private String informationD;
}
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