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

Commit 691efc05 authored by zhengfuxin's avatar zhengfuxin

精选商品后台管理

parent e7cae9dd
...@@ -2,6 +2,8 @@ package com.liquidnet.service.goblin.param; ...@@ -2,6 +2,8 @@ package com.liquidnet.service.goblin.param;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.liquidnet.commons.lang.util.DateUtil;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
...@@ -42,11 +44,13 @@ public class GoblinFrontSelectGoodsParam implements Serializable { ...@@ -42,11 +44,13 @@ public class GoblinFrontSelectGoodsParam implements Serializable {
/** /**
* 创建时间 * 创建时间
*/ */
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime createTime; private LocalDateTime createTime;
/** /**
* 修改时间 * 修改时间
*/ */
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime updateTime; private LocalDateTime updateTime;
/** /**
* 1、上架时间2、销量3、价格高到低4、价格低到高 * 1、上架时间2、销量3、价格高到低4、价格低到高
......
package com.liquidnet.client.admin.web.controller.zhengzai.goblin; package com.liquidnet.client.admin.web.controller.zhengzai.goblin;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.liquidnet.client.admin.common.core.controller.BaseController; import com.liquidnet.client.admin.common.core.controller.BaseController;
import com.liquidnet.client.admin.common.core.domain.AjaxResult; import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.zhengzai.goblin.service.impl.GoblinFrontSelectGoodsServiceImpl;
import com.liquidnet.commons.lang.util.StringUtil; import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.goblin.entity.GoblinFrontSelectGoods;
import com.liquidnet.service.goblin.entity.GoblinGoods; import com.liquidnet.service.goblin.entity.GoblinGoods;
import com.liquidnet.service.goblin.mapper.GoblinGoodsMapper; import com.liquidnet.service.goblin.mapper.GoblinGoodsMapper;
import com.liquidnet.service.goblin.param.GoblinFrontSelectGoodsParam;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
...@@ -28,7 +34,11 @@ import java.util.List; ...@@ -28,7 +34,11 @@ import java.util.List;
@RequestMapping("/selectGoods") @RequestMapping("/selectGoods")
public class GoblinFrontSelectGoodsController extends BaseController { public class GoblinFrontSelectGoodsController extends BaseController {
@Autowired
private GoblinGoodsMapper goblinGoodsMapper; private GoblinGoodsMapper goblinGoodsMapper;
@Autowired
private GoblinFrontSelectGoodsServiceImpl goblinFrontSelectGoodsService;
/*** /***
* @author zhangfuxin * @author zhangfuxin
* @Description: 商品列表 * @Description: 商品列表
...@@ -61,18 +71,56 @@ public class GoblinFrontSelectGoodsController extends BaseController { ...@@ -61,18 +71,56 @@ public class GoblinFrontSelectGoodsController extends BaseController {
* @Description:精选商品保存 * @Description:精选商品保存
* @date 2022/1/4 下午2:49 * @date 2022/1/4 下午2:49
*/ */
@PostMapping("create")
@ApiOperation(value = "精选商品保存")
@ResponseBody
public AjaxResult create(@RequestBody GoblinFrontSelectGoodsParam goblinFrontSelectGoodsParam) {
GoblinFrontSelectGoods goblinFrontSelectGoods =new GoblinFrontSelectGoods();
BeanUtils.copyProperties(goblinFrontSelectGoodsParam,goblinFrontSelectGoods);
logger.info("精选商品保存{}", JSON.toJSONString(goblinFrontSelectGoods));
boolean result=goblinFrontSelectGoodsService.create(goblinFrontSelectGoods);
if (result ) {
return success("操作成功");
} else {
return error("操作失败");
}
}
/** /**
* @author zhangfuxin * @author zhangfuxin
* @Description:精选商品修改 * @Description:精选商品修改
* @date 2022/1/4 下午2:49 * @date 2022/1/4 下午2:49
*/ */
@PostMapping("update")
@ApiOperation(value = "精选商品修改")
@ResponseBody
public AjaxResult update( @RequestBody GoblinFrontSelectGoodsParam goblinFrontSelectGoodsParam) {
GoblinFrontSelectGoods goblinFrontSelectGoods =new GoblinFrontSelectGoods();
BeanUtils.copyProperties(goblinFrontSelectGoodsParam,goblinFrontSelectGoods);
logger.info("精选商品修改{}", JSON.toJSONString(goblinFrontSelectGoods));
boolean result=goblinFrontSelectGoodsService.update(goblinFrontSelectGoods);
if (result ) {
return success("操作成功");
} else {
return error("操作失败");
}
}
/** /**
* @author zhangfuxin * @author zhangfuxin
* @Description: 精选商品获得 * @Description: 精选商品list
* @date 2022/1/4 下午2:49 * @date 2022/1/4 下午2:49
*/ */
@PostMapping("getList")
@ApiOperation(value = "精选商品list")
@ResponseBody
public AjaxResult getList(){
return AjaxResult.success(goblinFrontSelectGoodsService.getList());
}
......
...@@ -43,7 +43,7 @@ public class GoblinFrontBannerServiceImpl extends ServiceImpl<GoblinFrontBannerM ...@@ -43,7 +43,7 @@ public class GoblinFrontBannerServiceImpl extends ServiceImpl<GoblinFrontBannerM
public boolean create(GoblinFrontBanner goblinFrontBanner){ public boolean create(GoblinFrontBanner goblinFrontBanner){
goblinFrontBanner.setCreateTime(LocalDateTime.now()); goblinFrontBanner.setCreateTime(LocalDateTime.now());
//设置bannerid //设置bannerid
goblinFrontBanner.setBannerId(GoblinRedisConst.FRONT_BANNER+ IDGenerator.nextTimeId()); goblinFrontBanner.setBannerId(IDGenerator.nextSnowId());
//增加 banner //增加 banner
goblinFrontBannerMapper.insert(goblinFrontBanner); goblinFrontBannerMapper.insert(goblinFrontBanner);
/* //mongo db增加 /* //mongo db增加
......
...@@ -44,7 +44,7 @@ public class GoblinFrontHotWordServiceImpl extends ServiceImpl<GoblinFrontHotWor ...@@ -44,7 +44,7 @@ public class GoblinFrontHotWordServiceImpl extends ServiceImpl<GoblinFrontHotWor
public boolean create(GoblinFrontHotWord goblinFrontHotWord){ public boolean create(GoblinFrontHotWord goblinFrontHotWord){
goblinFrontHotWord.setCreateTime(LocalDateTime.now()); goblinFrontHotWord.setCreateTime(LocalDateTime.now());
//设置bannerid //设置bannerid
goblinFrontHotWord.setHotWordId(GoblinRedisConst.FRONT_HOTWORD+ IDGenerator.nextTimeId()); goblinFrontHotWord.setHotWordId(IDGenerator.nextSnowId());
//增加 banner //增加 banner
goblinFrontHotWordMapper.insert(goblinFrontHotWord); goblinFrontHotWordMapper.insert(goblinFrontHotWord);
/* //mongo db增加 /* //mongo db增加
......
...@@ -44,7 +44,7 @@ public class GoblinFrontNavigationServiceImpl extends ServiceImpl<GoblinFrontNav ...@@ -44,7 +44,7 @@ public class GoblinFrontNavigationServiceImpl extends ServiceImpl<GoblinFrontNav
public boolean create(GoblinFrontNavigation goblinFrontNavigation){ public boolean create(GoblinFrontNavigation goblinFrontNavigation){
goblinFrontNavigation.setCreateTime(LocalDateTime.now()); goblinFrontNavigation.setCreateTime(LocalDateTime.now());
//设置金刚位id //设置金刚位id
goblinFrontNavigation.setNavigationId(GoblinRedisConst.FRONT_NAVIGATION+ IDGenerator.nextTimeId()); goblinFrontNavigation.setNavigationId(IDGenerator.nextSnowId());
//mysql插入 //mysql插入
goblinFrontNavigationMapper.insert(goblinFrontNavigation); goblinFrontNavigationMapper.insert(goblinFrontNavigation);
/* //mongo db增加 /* //mongo db增加
......
...@@ -56,7 +56,7 @@ public class GoblinFrontSeckillServiceImpl extends ServiceImpl<GoblinFrontSeckil ...@@ -56,7 +56,7 @@ public class GoblinFrontSeckillServiceImpl extends ServiceImpl<GoblinFrontSeckil
public boolean create(GoblinFrontSeckill goblinFrontSeckill){ public boolean create(GoblinFrontSeckill goblinFrontSeckill){
goblinFrontSeckill.setCreateTime(LocalDateTime.now()); goblinFrontSeckill.setCreateTime(LocalDateTime.now());
//设置bannerid //设置bannerid
goblinFrontSeckill.setSeckilId(GoblinRedisConst.FRONT_SECKILL+ IDGenerator.nextTimeId()); goblinFrontSeckill.setSeckilId(IDGenerator.nextSnowId());
//增加 banner //增加 banner
goblinFrontSeckillMapper.insert(goblinFrontSeckill); goblinFrontSeckillMapper.insert(goblinFrontSeckill);
return true; return true;
......
package com.liquidnet.client.admin.zhengzai.goblin.service.impl; package com.liquidnet.client.admin.zhengzai.goblin.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinFrontSelectGoodsService; import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinFrontSelectGoodsService;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.goblin.entity.GoblinFrontSelectGoods; import com.liquidnet.service.goblin.entity.GoblinFrontSelectGoods;
import com.liquidnet.service.goblin.mapper.GoblinFrontSelectGoodsMapper; import com.liquidnet.service.goblin.mapper.GoblinFrontSelectGoodsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
/** /**
* <p> * <p>
* 精选商品 * 精选商品
...@@ -18,4 +25,45 @@ import org.springframework.stereotype.Service; ...@@ -18,4 +25,45 @@ import org.springframework.stereotype.Service;
@Service @Service
public class GoblinFrontSelectGoodsServiceImpl extends ServiceImpl<GoblinFrontSelectGoodsMapper, GoblinFrontSelectGoods> implements IGoblinFrontSelectGoodsService { public class GoblinFrontSelectGoodsServiceImpl extends ServiceImpl<GoblinFrontSelectGoodsMapper, GoblinFrontSelectGoods> implements IGoblinFrontSelectGoodsService {
//private GoblinGoodsMapper goblinGoodsMapper;
@Autowired
private GoblinFrontSelectGoodsMapper goblinFrontSelectGoodsMapper;
public boolean create(GoblinFrontSelectGoods goblinFrontSelectGoods){
List list= this.getList();
if(list.size()>0){
return false;
}
//
goblinFrontSelectGoods.setCreateTime(LocalDateTime.now());
//设置bannerid
goblinFrontSelectGoods.setSelectGoodsId(IDGenerator.nextSnowId());
//增加 banner
//goblinFrontSeckillMapper.insert(goblinFrontSeckill);
goblinFrontSelectGoodsMapper.insert(goblinFrontSelectGoods);
return true;
}
public GoblinFrontSelectGoods getOne(Long id){
return goblinFrontSelectGoodsMapper.selectById(id);
}
public boolean delte(Long id){
GoblinFrontSelectGoods goblinFrontSelectGoods=goblinFrontSelectGoodsMapper.selectById(id);
goblinFrontSelectGoods.setDelTag(1);
this.update(goblinFrontSelectGoods);
return true;
}
public boolean update(GoblinFrontSelectGoods goblinFrontSelectGoods){
goblinFrontSelectGoods.setUpdateTime(LocalDateTime.now());
goblinFrontSelectGoodsMapper.updateById(goblinFrontSelectGoods);
return true;
}
public List getList(){
LambdaQueryWrapper<GoblinFrontSelectGoods> queryWrapper = Wrappers.lambdaQuery(GoblinFrontSelectGoods.class);
queryWrapper.eq(GoblinFrontSelectGoods::getDelTag,0);
return goblinFrontSelectGoodsMapper.selectList(queryWrapper);
}
} }
...@@ -34,7 +34,7 @@ public class GoblinFrontSelectGoods implements Serializable { ...@@ -34,7 +34,7 @@ public class GoblinFrontSelectGoods implements Serializable {
/** /**
* spu的 ids拼接 * spu的 ids拼接
*/ */
private Integer goodsId; private String goodsId;
/** /**
* 0未删除1已删除 * 0未删除1已删除
...@@ -51,5 +51,11 @@ public class GoblinFrontSelectGoods implements Serializable { ...@@ -51,5 +51,11 @@ public class GoblinFrontSelectGoods implements Serializable {
*/ */
private LocalDateTime updateTime; private LocalDateTime updateTime;
/**
* 1、上架时间2、销量3、价格高到低4、价格低到高
*/
private int orderType;
} }
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