胡锐 6 months ago
commit 08926a892b
  1. 14
      bweb/src/main/java/com/bweb/controller/goods/GoodsBrandController.java
  2. 75
      bweb/src/main/java/com/bweb/controller/goods/GoodsController.java
  3. 5
      bweb/src/main/java/com/bweb/controller/goods/GoodsTypeController.java
  4. 13
      service/src/main/java/com/hfkj/model/goods/GoodsModel.java
  5. 5
      service/src/main/java/com/hfkj/model/goods/GoodsModelSpecs.java
  6. 2
      service/src/main/java/com/hfkj/model/goods/GoodsTypeModel.java
  7. 2
      service/src/main/java/com/hfkj/service/goods/GoodsTypeService.java
  8. 5
      service/src/main/java/com/hfkj/service/goods/impl/GoodsBrandServiceImpl.java
  9. 27
      service/src/main/java/com/hfkj/service/goods/impl/GoodsMsgServiceImpl.java
  10. 13
      service/src/main/java/com/hfkj/service/goods/impl/GoodsSpecsServiceImpl.java
  11. 9
      service/src/main/java/com/hfkj/service/goods/impl/GoodsTypeServiceImpl.java

@ -102,6 +102,20 @@ public class GoodsBrandController {
}
}
@RequestMapping(value="/getListBrandAll",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询列表")
public ResponseData getListBrandAll() {
try {
return ResponseMsgUtil.success(goodsBrandService.getList(new HashMap<>()));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/delete",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "删除")

@ -1,5 +1,7 @@
package com.bweb.controller.goods;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
@ -7,7 +9,8 @@ import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.*;
import com.hfkj.model.GoodsModel;
import com.hfkj.model.goods.GoodsModel;
import com.hfkj.model.goods.GoodsModelSpecs;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.goods.*;
@ -23,7 +26,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.*;
@Controller
@RequestMapping(value="/goods")
@ -106,7 +109,7 @@ public class GoodsController {
@RequestMapping(value="/editGoodsSpecs",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "编辑商品规格")
public ResponseData editGoodsSpecs(@RequestBody GoodsModel body, HttpServletRequest request) {
public ResponseData editGoodsSpecs(@RequestBody GoodsModelSpecs body, HttpServletRequest request) {
SessionObject sessionObject = userCenter.getSessionObject(request);
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject();
@ -150,7 +153,6 @@ public class GoodsController {
goodsSpecs.setCreateTime(new Date());
}
goodsSpecs.setUpdateTime(new Date());
goodsSpecs.setGoodsId(body.getGoodsId());
goodsSpecs.setOriginalPrice(body.getOriginalPrice());
@ -209,5 +211,70 @@ public class GoodsController {
return ResponseMsgUtil.success("操作成功");
}
@RequestMapping(value="/getListGoods",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询列表")
public ResponseData getListGoods(@RequestParam(value = "title" , required = false) String title,
@RequestParam(value = "goodsType" , required = false) Long goodsType,
@RequestParam(value = "goodsBrand" , required = false) Long goodsBrand,
@RequestParam(value = "type" , required = false) Integer type,
@RequestParam(value = "status" , required = false) Integer status,
@RequestParam(value = "pageNum" , required = true) Integer pageNum,
@RequestParam(value = "pageSize" , required = true) Integer pageSize) {
try {
Map<String , Object> map = new HashMap<>();
map.put("title", title);
map.put("goodsType", goodsType);
map.put("goodsBrand", goodsBrand);
map.put("type", type);
map.put("status", status);
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(goodsMsgService.getList(map)));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getGoodsDetail",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询商品详情")
public ResponseData getGoodsDetail(@RequestParam(value = "id" , required = false) Long id) {
try {
GoodsModel goodsModel = new GoodsModel();
GoodsMsg goodsMsg = goodsMsgService.queryDetail(id);
BeanUtils.copyProperties(goodsMsg, goodsModel);
Map<String , Object> map = new HashMap<>();
map.put("goodsId" , id);
List<GoodsSpecs> goodsSpecs = goodsSpecsService.getList(map);
List<GoodsModelSpecs> goodsModelSpecs = new ArrayList<>();
for (GoodsSpecs goodsSpec : goodsSpecs) {
GoodsModelSpecs goodsModelSpec = new GoodsModelSpecs();
BeanUtils.copyProperties(goodsSpec, goodsModelSpec);
GoodsVpd goodsVpd = goodsVpdService.queryDetailBySpecsId(goodsSpec.getId());
if (goodsVpd != null) {
BeanUtils.copyProperties(goodsVpd, goodsModelSpec);
}
goodsModelSpecs.add(goodsModelSpec);
}
return ResponseMsgUtil.success(goodsModelSpecs);
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,6 +1,5 @@
package com.bweb.controller.goods;
import com.bweb.controller.FileUploadController;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
@ -8,8 +7,7 @@ import com.hfkj.common.security.SessionObject;
import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.GoodsType;
import com.hfkj.entity.SecMenu;
import com.hfkj.model.GoodsTypeModel;
import com.hfkj.model.goods.GoodsTypeModel;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.goods.GoodsTypeService;
@ -24,7 +22,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.stream.Collectors;
@Controller
@RequestMapping(value="/goodsType")

@ -0,0 +1,13 @@
package com.hfkj.model.goods;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsSpecs;
import lombok.Data;
import java.util.List;
@Data
public class GoodsModel extends GoodsMsg {
List<GoodsModelSpecs> goodsModelSpecs;
}

@ -1,14 +1,13 @@
package com.hfkj.model;
package com.hfkj.model.goods;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsSpecs;
import com.hfkj.entity.GoodsVpd;
import lombok.Data;
import java.util.Date;
@Data
public class GoodsModel extends GoodsSpecs {
public class GoodsModelSpecs extends GoodsSpecs {
GoodsMsg goodsMsg;

@ -1,4 +1,4 @@
package com.hfkj.model;
package com.hfkj.model.goods;
import com.hfkj.entity.GoodsType;
import lombok.Data;

@ -1,7 +1,7 @@
package com.hfkj.service.goods;
import com.hfkj.entity.GoodsType;
import com.hfkj.model.GoodsTypeModel;
import com.hfkj.model.goods.GoodsTypeModel;
import java.util.List;
import java.util.Map;

@ -7,6 +7,7 @@ import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsType;
import com.hfkj.service.goods.GoodsBrandService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -58,8 +59,8 @@ public class GoodsBrandServiceImpl implements GoodsBrandService {
GoodsBrandExample example = new GoodsBrandExample();
GoodsBrandExample.Criteria criteria = example.createCriteria();
if (MapUtils.getString(map, "title") != null) {
criteria.andTitleEqualTo(MapUtils.getString(map, "title"));
if (StringUtils.isNotBlank(MapUtils.getString(map, "title"))) {
criteria.andTitleLike("%"+MapUtils.getString(map, "title")+"%");
}
criteria.andStatusNotEqualTo(0);

@ -3,7 +3,10 @@ package com.hfkj.service.goods.impl;
import com.hfkj.dao.GoodsMsgMapper;
import com.hfkj.entity.GoodsBrand;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsMsgExample;
import com.hfkj.service.goods.GoodsMsgService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -52,6 +55,28 @@ public class GoodsMsgServiceImpl implements GoodsMsgService {
@Override
public List<GoodsMsg> getList(Map<String, Object> map) {
return Collections.emptyList();
GoodsMsgExample example = new GoodsMsgExample();
GoodsMsgExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "goodsType") != null) {
criteria.andGoodsTypeEqualTo(MapUtils.getLong(map, "goodsType"));
}
if (MapUtils.getInteger(map, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type"));
}
if (MapUtils.getLong(map, "goodsBrand") != null) {
criteria.andGoodsBrandEqualTo(MapUtils.getLong(map, "goodsBrand"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map, "title"))) {
criteria.andTitleLike("%"+MapUtils.getString(map, "title")+"%");
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
} else {
criteria.andStatusNotEqualTo(0);
}
return goodsMsgMapper.selectByExample(example);
}
}

@ -6,6 +6,7 @@ import com.hfkj.entity.GoodsSpecs;
import com.hfkj.entity.GoodsSpecsExample;
import com.hfkj.service.goods.GoodsSpecsService;
import com.hfkj.service.goods.GoodsVpdService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -75,6 +76,16 @@ public class GoodsSpecsServiceImpl implements GoodsSpecsService {
@Override
public List<GoodsSpecs> getList(Map<String, Object> map) {
return Collections.emptyList();
GoodsSpecsExample goodsSpecsExample = new GoodsSpecsExample();
GoodsSpecsExample.Criteria criteria = goodsSpecsExample.createCriteria();
if (MapUtils.getLong(map, "goodsId") != null) {
criteria.andGoodsIdEqualTo(MapUtils.getLong(map, "goodsId"));
}
criteria.andStatusNotEqualTo(0);
return goodsSpecsMapper.selectByExample(goodsSpecsExample);
}
}

@ -3,11 +3,10 @@ package com.hfkj.service.goods.impl;
import com.hfkj.dao.GoodsTypeMapper;
import com.hfkj.entity.GoodsType;
import com.hfkj.entity.GoodsTypeExample;
import com.hfkj.entity.SecMenu;
import com.hfkj.model.GoodsTypeModel;
import com.hfkj.model.MenuTreeModel;
import com.hfkj.model.goods.GoodsTypeModel;
import com.hfkj.service.goods.GoodsTypeService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -84,8 +83,8 @@ public class GoodsTypeServiceImpl implements GoodsTypeService {
if (MapUtils.getLong(map, "parentId") != null) {
criteria.andParentIdEqualTo(MapUtils.getLong(map, "parentId"));
}
if (MapUtils.getString(map, "title") != null) {
criteria.andTitleEqualTo(MapUtils.getString(map, "title"));
if (StringUtils.isNotBlank(MapUtils.getString(map, "title"))) {
criteria.andTitleLike("%"+MapUtils.getString(map, "title")+"%");
}
if (MapUtils.getInteger(map, "businessType") != null) {
criteria.andBusinessTypeEqualTo(MapUtils.getInteger(map, "businessType"));

Loading…
Cancel
Save