parent
f06af39f13
commit
ae2773168a
@ -0,0 +1,213 @@ |
||||
package com.bweb.controller.goods; |
||||
|
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
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.ResponseData; |
||||
import com.hfkj.model.SecUserSessionObject; |
||||
import com.hfkj.service.goods.*; |
||||
import com.hfkj.sysenum.SecUserObjectTypeEnum; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import java.util.Date; |
||||
|
||||
@Controller |
||||
@RequestMapping(value="/goods") |
||||
@Api(value="商品信息") |
||||
public class GoodsController { |
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(GoodsController.class); |
||||
|
||||
@Resource |
||||
private GoodsMsgService goodsMsgService; |
||||
|
||||
@Resource |
||||
private GoodsBrandService goodsBrandService; |
||||
|
||||
@Resource |
||||
private GoodsSpecsService goodsSpecsService; |
||||
|
||||
@Resource |
||||
private GoodsTypeService goodsTypeService; |
||||
|
||||
@Resource |
||||
private GoodsVpdService goodsVpdService; |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
@RequestMapping(value="/editGoodsMsg",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "编辑商品信息") |
||||
public ResponseData editGoodsMsg(@RequestBody GoodsMsg body, HttpServletRequest request) { |
||||
|
||||
SessionObject sessionObject = userCenter.getSessionObject(request); |
||||
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject(); |
||||
|
||||
if (userModel.getAccount().getObjectType() != SecUserObjectTypeEnum.type2.getCode()) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, ""); |
||||
} |
||||
|
||||
if (body == null |
||||
|| body.getGoodsBrand() == null |
||||
|| body.getGoodsType() == null |
||||
|| body.getType() == null |
||||
|| StringUtils.isBlank(body.getListImg()) |
||||
|| StringUtils.isBlank(body.getBannerImg()) |
||||
|| StringUtils.isBlank(body.getDetailImg()) |
||||
|| StringUtils.isBlank(body.getTitle())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
GoodsMsg goodsMsg; |
||||
|
||||
if (body.getId() != null) { |
||||
// 查询品牌
|
||||
goodsMsg = goodsMsgService.queryDetail(body.getId()); |
||||
if (goodsMsg == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.CONTENT_NOT_FOUND, ""); |
||||
} |
||||
} else { |
||||
goodsMsg = new GoodsMsg(); |
||||
goodsMsg.setCreateTime(new Date()); |
||||
} |
||||
|
||||
goodsMsg.setUpdateTime(new Date()); |
||||
goodsMsg.setGoodsBrandName(goodsBrandService.findGoodsBrandName(body.getGoodsBrand())); |
||||
goodsMsg.setGoodsTypeName(goodsTypeService.findGoodsType(body.getGoodsType())); |
||||
goodsMsg.setStatus(2); |
||||
goodsMsg.setTitle(body.getTitle()); |
||||
goodsMsg.setMerId(userModel.getAccount().getId()); |
||||
goodsMsg.setMerName(userModel.getAccount().getUserName()); |
||||
|
||||
if (body.getId() != null) { |
||||
goodsMsgService.update(goodsMsg); |
||||
} else { |
||||
goodsMsgService.create(goodsMsg); |
||||
} |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
} |
||||
|
||||
@RequestMapping(value="/editGoodsSpecs",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "编辑商品规格") |
||||
public ResponseData editGoodsSpecs(@RequestBody GoodsModel body, HttpServletRequest request) { |
||||
|
||||
SessionObject sessionObject = userCenter.getSessionObject(request); |
||||
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject(); |
||||
|
||||
if (userModel.getAccount().getObjectType() != SecUserObjectTypeEnum.type2.getCode()) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, ""); |
||||
} |
||||
|
||||
if (body == null |
||||
|| body.getGoodsId() == null |
||||
|| body.getOriginalPrice() == null |
||||
|| body.getSalePrice() == null |
||||
|| body.getPurLimit() == null |
||||
|| body.getStock() == null |
||||
|| StringUtils.isBlank(body.getBannerImg()) |
||||
|| StringUtils.isBlank(body.getShowImg()) |
||||
|| StringUtils.isBlank(body.getName())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
GoodsMsg goodsMsg = goodsMsgService.queryDetail(body.getGoodsId()); |
||||
|
||||
if (goodsMsg == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.CONTENT_NOT_FOUND, ""); |
||||
} |
||||
|
||||
|
||||
|
||||
GoodsSpecs goodsSpecs; |
||||
GoodsVpd goodsVpd; |
||||
|
||||
|
||||
if (body.getId() != null) { |
||||
// 查询规格
|
||||
goodsSpecs = goodsSpecsService.queryDetail(body.getId()); |
||||
if (goodsSpecs == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.CONTENT_NOT_FOUND, ""); |
||||
} |
||||
} else { |
||||
goodsSpecs = new GoodsSpecs(); |
||||
goodsSpecs.setCreateTime(new Date()); |
||||
} |
||||
|
||||
|
||||
goodsSpecs.setUpdateTime(new Date()); |
||||
goodsSpecs.setGoodsId(body.getGoodsId()); |
||||
goodsSpecs.setOriginalPrice(body.getOriginalPrice()); |
||||
goodsSpecs.setSalePrice(body.getSalePrice()); |
||||
goodsSpecs.setPurLimit(body.getPurLimit()); |
||||
goodsSpecs.setStock(body.getStock()); |
||||
goodsSpecs.setBannerImg(body.getBannerImg()); |
||||
goodsSpecs.setShowImg(body.getShowImg()); |
||||
goodsSpecs.setName(body.getName()); |
||||
goodsSpecs.setStatus(1); |
||||
|
||||
|
||||
if (goodsSpecs.getId() != null) { |
||||
goodsSpecsService.update(goodsSpecs); |
||||
} else { |
||||
goodsSpecsService.create(goodsSpecs); |
||||
} |
||||
|
||||
// 判断当前商品是否是虚拟商品
|
||||
if(goodsMsg.getType() == 2) { |
||||
// 判断必填项
|
||||
if ( body.getSpecsId() == null |
||||
|| body.getRecycleDay() == null |
||||
|| body.getType() == null |
||||
|| body.getSalesEndTime() == null |
||||
|| body.getSource() == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
// 查询虚拟产品
|
||||
goodsVpd = goodsVpdService.queryDetailBySpecsId(goodsSpecs.getId()); |
||||
|
||||
if (goodsVpd == null) { |
||||
goodsVpd = new GoodsVpd(); |
||||
goodsVpd.setCreateTime(new Date()); |
||||
} |
||||
|
||||
goodsVpd.setSpecsId(goodsSpecs.getId()); |
||||
goodsVpd.setRecycleDay(body.getRecycleDay()); |
||||
goodsVpd.setType(body.getType()); |
||||
goodsVpd.setJumpType(body.getJumpType()); |
||||
goodsVpd.setJumpUrl(body.getJumpUrl()); |
||||
goodsVpd.setAppidId(body.getAppidId()); |
||||
goodsVpd.setSalesEndTime(body.getSalesEndTime()); |
||||
goodsVpd.setSource(body.getSource()); |
||||
goodsVpd.setSalesEndTime(body.getSalesEndTime()); |
||||
goodsVpd.setUpdateTime(new Date()); |
||||
|
||||
if (goodsVpd.getId() != null) { |
||||
goodsVpdService.update(goodsVpd); |
||||
} else { |
||||
goodsVpdService.create(goodsVpd); |
||||
} |
||||
} |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,59 @@ |
||||
package com.hfkj.model; |
||||
|
||||
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 { |
||||
|
||||
GoodsMsg goodsMsg; |
||||
|
||||
/** |
||||
* 商品规格id |
||||
*/ |
||||
private Long specsId; |
||||
|
||||
/** |
||||
* 编号 |
||||
*/ |
||||
private String key; |
||||
|
||||
/** |
||||
* 归库天数 |
||||
*/ |
||||
private Integer recycleDay; |
||||
|
||||
/** |
||||
* 销售截止日期 |
||||
*/ |
||||
private Date salesEndTime; |
||||
|
||||
/** |
||||
* 类型 1:内部虚拟商品 2:外部虚拟产品 |
||||
*/ |
||||
private Integer type; |
||||
|
||||
/** |
||||
* 产品来源:1.内部虚拟商品 4.贵州中石化 5.重庆中石油 6.比邻星停车券 7.四川中石油 10.中油优途中石油 |
||||
*/ |
||||
private Integer source; |
||||
|
||||
/** |
||||
* 跳转类型:1.小程序 2.h5 |
||||
*/ |
||||
private Integer jumpType; |
||||
|
||||
/** |
||||
* 跳转地址 |
||||
*/ |
||||
private String jumpUrl; |
||||
|
||||
/** |
||||
* 应用ID |
||||
*/ |
||||
private String appidId; |
||||
} |
@ -0,0 +1,77 @@ |
||||
package com.hfkj.service.goods; |
||||
|
||||
|
||||
|
||||
import com.hfkj.entity.GoodsMsg; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @serviceName GoodsMsgService.java |
||||
* @author Sum1Dream |
||||
* @version 1.0.0 |
||||
* @Description // 商品信息管理
|
||||
* @createTime 15:07 2024/4/19 |
||||
**/ |
||||
public interface GoodsMsgService { |
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name create |
||||
* @Description // 创建
|
||||
* @Date 15:11 2024/4/19 |
||||
* @Param GoodsMsg |
||||
* @return void |
||||
*/ |
||||
void create(GoodsMsg goodsMsg); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name update |
||||
* @Description // 修改
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param GoodsMsg |
||||
* @return void |
||||
*/ |
||||
void update(GoodsMsg goodsMsg); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name delete |
||||
* @Description // 修改
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param id |
||||
* @return void |
||||
*/ |
||||
void delete(Long id , Boolean fullDelete); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name queryDetail |
||||
* @Description // 根据ID查询产品类型详情
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param id |
||||
* @return com.hfkj.entity.GoodsMsg |
||||
*/ |
||||
GoodsMsg queryDetail(Long id); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name queryDetailByMap |
||||
* @Description // 根据多条件查询产品类型
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param map |
||||
* @return com.hfkj.entity.GoodsMsg |
||||
*/ |
||||
GoodsMsg queryDetailByMap(Map<String , Object> map); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getList |
||||
* @Description // 根据多条件查询列表
|
||||
* @Date 15:13 2024/4/19 |
||||
* @Param map |
||||
* @return java.util.List<com.hfkj.entity.GoodsMsg> |
||||
*/ |
||||
List<GoodsMsg> getList(Map<String , Object> map); |
||||
} |
@ -0,0 +1,79 @@ |
||||
package com.hfkj.service.goods; |
||||
|
||||
import com.hfkj.entity.GoodsSpecs; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @serviceName .java |
||||
* @author Sum1Dream |
||||
* @version 1.0.0 |
||||
* @Description // 商品规格管理
|
||||
* @createTime 15:07 2024/4/19 |
||||
**/ |
||||
public interface GoodsSpecsService { |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name create |
||||
* @Description // 创建
|
||||
* @Date 15:11 2024/4/19 |
||||
* @Param GoodsSpecs |
||||
* @return void |
||||
*/ |
||||
void create(GoodsSpecs goodsSpecs); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name update |
||||
* @Description // 修改
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param GoodsSpecs |
||||
* @return void |
||||
*/ |
||||
void update(GoodsSpecs goodsSpecs); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name delete |
||||
* @Description // 修改
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param id |
||||
* @return void |
||||
*/ |
||||
void delete(Long id , Boolean fullDelete); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name queryDetail |
||||
* @Description // 根据ID查询产品类型详情
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param id |
||||
* @return com.hfkj.entity.GoodsSpecs |
||||
*/ |
||||
GoodsSpecs queryDetail(Long id); |
||||
|
||||
GoodsSpecs queryDetailByGoodsId(Long id); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name queryDetailByMap |
||||
* @Description // 根据多条件查询产品类型
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param map |
||||
* @return com.hfkj.entity.GoodsSpecs |
||||
*/ |
||||
GoodsSpecs queryDetailByMap(Map<String , Object> map); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getList |
||||
* @Description // 根据多条件查询列表
|
||||
* @Date 15:13 2024/4/19 |
||||
* @Param map |
||||
* @return java.util.List<com.hfkj.entity.GoodsSpecs> |
||||
*/ |
||||
List<GoodsSpecs> getList(Map<String , Object> map); |
||||
|
||||
} |
@ -0,0 +1,80 @@ |
||||
package com.hfkj.service.goods; |
||||
|
||||
import com.hfkj.entity.GoodsVpd; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @serviceName .java |
||||
* @author Sum1Dream |
||||
* @version 1.0.0 |
||||
* @Description // 虚拟商品管理
|
||||
* @createTime 15:07 2024/4/19 |
||||
**/ |
||||
public interface GoodsVpdService { |
||||
|
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name create |
||||
* @Description // 创建
|
||||
* @Date 15:11 2024/4/19 |
||||
* @Param GoodsVpd |
||||
* @return void |
||||
*/ |
||||
void create(GoodsVpd goodsVpd); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name update |
||||
* @Description // 修改
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param GoodsVpd |
||||
* @return void |
||||
*/ |
||||
void update(GoodsVpd goodsVpd); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name delete |
||||
* @Description // 修改
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param id |
||||
* @return void |
||||
*/ |
||||
void delete(Long id); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name queryDetail |
||||
* @Description // 根据ID查询产品类型详情
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param id |
||||
* @return com.hfkj.entity.GoodsVpd |
||||
*/ |
||||
GoodsVpd queryDetail(Long id); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name queryDetailBySpecsId |
||||
* @Description // 根据多条件查询产品类型
|
||||
* @Date 15:12 2024/4/19 |
||||
* @Param map |
||||
* @return com.hfkj.entity.GoodsVpd |
||||
*/ |
||||
void deleteSpecsId(Long specsId); |
||||
|
||||
GoodsVpd queryDetailBySpecsId(Long specsId); |
||||
|
||||
/** |
||||
* @Author Sum1Dream |
||||
* @Name getList |
||||
* @Description // 根据多条件查询列表
|
||||
* @Date 15:13 2024/4/19 |
||||
* @Param map |
||||
* @return java.util.List<com.hfkj.entity.GoodsVpd> |
||||
*/ |
||||
List<GoodsVpd> getList(Map<String , Object> map); |
||||
|
||||
} |
@ -0,0 +1,57 @@ |
||||
package com.hfkj.service.goods.impl; |
||||
|
||||
import com.hfkj.dao.GoodsMsgMapper; |
||||
import com.hfkj.entity.GoodsBrand; |
||||
import com.hfkj.entity.GoodsMsg; |
||||
import com.hfkj.service.goods.GoodsMsgService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Collections; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service("goodsMsgService") |
||||
public class GoodsMsgServiceImpl implements GoodsMsgService { |
||||
|
||||
@Resource |
||||
private GoodsMsgMapper goodsMsgMapper; |
||||
|
||||
@Override |
||||
public void create(GoodsMsg goodsMsg) { |
||||
goodsMsgMapper.insert(goodsMsg); |
||||
} |
||||
|
||||
@Override |
||||
public void update(GoodsMsg goodsMsg) { |
||||
goodsMsgMapper.updateByPrimaryKeySelective(goodsMsg); |
||||
} |
||||
|
||||
@Override |
||||
public void delete(Long id, Boolean fullDelete) { |
||||
if (fullDelete) { |
||||
goodsMsgMapper.deleteByPrimaryKey(id); |
||||
} else { |
||||
GoodsMsg goodsMsg = queryDetail(id); |
||||
goodsMsg.setStatus(0); |
||||
goodsMsg.setUpdateTime(new Date()); |
||||
update(goodsMsg); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public GoodsMsg queryDetail(Long id) { |
||||
return goodsMsgMapper.selectByPrimaryKey(id); |
||||
} |
||||
|
||||
@Override |
||||
public GoodsMsg queryDetailByMap(Map<String, Object> map) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public List<GoodsMsg> getList(Map<String, Object> map) { |
||||
return Collections.emptyList(); |
||||
} |
||||
} |
@ -0,0 +1,80 @@ |
||||
package com.hfkj.service.goods.impl; |
||||
|
||||
import com.hfkj.dao.GoodsSpecsMapper; |
||||
import com.hfkj.entity.GoodsMsg; |
||||
import com.hfkj.entity.GoodsSpecs; |
||||
import com.hfkj.entity.GoodsSpecsExample; |
||||
import com.hfkj.service.goods.GoodsSpecsService; |
||||
import com.hfkj.service.goods.GoodsVpdService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Collections; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service("goodsSpecsService") |
||||
public class GoodsSpecsServiceImpl implements GoodsSpecsService { |
||||
|
||||
@Resource |
||||
private GoodsSpecsMapper goodsSpecsMapper; |
||||
|
||||
@Resource |
||||
private GoodsVpdService goodsVpdService; |
||||
|
||||
|
||||
@Override |
||||
public void create(GoodsSpecs goodsSpecs) { |
||||
goodsSpecsMapper.insert(goodsSpecs); |
||||
} |
||||
|
||||
@Override |
||||
public void update(GoodsSpecs goodsSpecs) { |
||||
goodsSpecsMapper.updateByPrimaryKeySelective(goodsSpecs); |
||||
} |
||||
|
||||
@Override |
||||
public void delete(Long id, Boolean fullDelete) { |
||||
if (fullDelete) { |
||||
goodsSpecsMapper.deleteByPrimaryKey(id); |
||||
} else { |
||||
GoodsSpecs goodsSpecs = queryDetail(id); |
||||
goodsSpecs.setStatus(0); |
||||
goodsSpecs.setUpdateTime(new Date()); |
||||
update(goodsSpecs); |
||||
} |
||||
|
||||
goodsVpdService.deleteSpecsId(id); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public GoodsSpecs queryDetail(Long id) { |
||||
return goodsSpecsMapper.selectByPrimaryKey(id); |
||||
} |
||||
|
||||
@Override |
||||
public GoodsSpecs queryDetailByGoodsId(Long id) { |
||||
GoodsSpecsExample goodsSpecsExample = new GoodsSpecsExample(); |
||||
goodsSpecsExample.createCriteria().andGoodsIdEqualTo(id); |
||||
|
||||
List<GoodsSpecs> goodsSpecs = goodsSpecsMapper.selectByExample(goodsSpecsExample); |
||||
|
||||
if (!goodsSpecs.isEmpty()) { |
||||
return goodsSpecs.get(0); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public GoodsSpecs queryDetailByMap(Map<String, Object> map) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public List<GoodsSpecs> getList(Map<String, Object> map) { |
||||
return Collections.emptyList(); |
||||
} |
||||
} |
@ -0,0 +1,74 @@ |
||||
package com.hfkj.service.goods.impl; |
||||
|
||||
import com.hfkj.dao.GoodsVpdMapper; |
||||
import com.hfkj.entity.GoodsMsg; |
||||
import com.hfkj.entity.GoodsVpd; |
||||
import com.hfkj.entity.GoodsVpdExample; |
||||
import com.hfkj.service.goods.GoodsVpdService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Collections; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service("goodsVpdService") |
||||
public class GoodsVpdServiceImpl implements GoodsVpdService { |
||||
|
||||
@Resource |
||||
private GoodsVpdMapper goodsVpdMapper; |
||||
|
||||
@Override |
||||
public void create(GoodsVpd goodsVpd) { |
||||
goodsVpdMapper.insert(goodsVpd); |
||||
} |
||||
|
||||
@Override |
||||
public void update(GoodsVpd goodsVpd) { |
||||
goodsVpdMapper.updateByPrimaryKeySelective(goodsVpd); |
||||
} |
||||
|
||||
@Override |
||||
public void delete(Long id) { |
||||
goodsVpdMapper.deleteByPrimaryKey(id); |
||||
} |
||||
|
||||
@Override |
||||
public GoodsVpd queryDetail(Long id) { |
||||
return goodsVpdMapper.selectByPrimaryKey(id); |
||||
} |
||||
|
||||
@Override |
||||
public void deleteSpecsId(Long specsId) { |
||||
GoodsVpdExample example = new GoodsVpdExample(); |
||||
example.createCriteria().andSpecsIdEqualTo(specsId); |
||||
|
||||
List<GoodsVpd> list = goodsVpdMapper.selectByExample(example); |
||||
|
||||
for (GoodsVpd goodsVpd : list) { |
||||
goodsVpdMapper.deleteByPrimaryKey(goodsVpd.getId()); |
||||
} |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public GoodsVpd queryDetailBySpecsId(Long specsId) { |
||||
|
||||
GoodsVpdExample example = new GoodsVpdExample(); |
||||
example.createCriteria().andSpecsIdEqualTo(specsId); |
||||
|
||||
List<GoodsVpd> list = goodsVpdMapper.selectByExample(example); |
||||
|
||||
if (!list.isEmpty()) { |
||||
return list.get(0); |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public List<GoodsVpd> getList(Map<String, Object> map) { |
||||
return Collections.emptyList(); |
||||
} |
||||
} |
Loading…
Reference in new issue