提交 243e3266 作者: xiaowang

修改:修改类型

上级 f5b6a4de
......@@ -31,7 +31,7 @@ public class AppMallGoodsController extends BaseController {
@ApiOperation(value = "小程序商品详情")
@GetMapping("appMallGoodsDetails")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsVO.class)})
public ResultBody<MallGoodsVO> appMallGoodsDetails(@RequestParam Long id) {
public ResultBody<MallGoodsVO> appMallGoodsDetails(@RequestParam Integer id) {
return mallGoodsService.mallGoodsDetails(id);
}
......
......@@ -33,7 +33,7 @@ public class MallGoodsController extends BaseController {
@ApiOperation(value = "商城商品详情")
@GetMapping("mallGoodsDetails")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MallGoodsVO.class)})
public ResultBody<MallGoodsVO> mallGoodsDetails(@RequestParam Long id) {
public ResultBody<MallGoodsVO> mallGoodsDetails(@RequestParam Integer id) {
return mallGoodsService.mallGoodsDetails(id);
}
......@@ -61,15 +61,15 @@ public class MallGoodsController extends BaseController {
@ApiOperation(value = "商品列表-排序")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("exchange")
public ResultBody exchange(@ApiParam(value = "第一个商品id", required = true) @RequestParam(value = "firstId") Long firstId,
@ApiParam(value = "第二个商品id", required = true) @RequestParam(value = "secondId") Long secondId) {
public ResultBody exchange(@ApiParam(value = "第一个商品id", required = true) @RequestParam(value = "firstId") Integer firstId,
@ApiParam(value = "第二个商品id", required = true) @RequestParam(value = "secondId") Integer secondId) {
return mallGoodsService.exchange(firstId, secondId);
}
@ApiOperation(value = "商品列表-上架或下架")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("upOrDownShelf")
public ResultBody upOrDownShelf(@ApiParam(value = "商品id", required = true) @RequestParam(value = "id") Long id,
public ResultBody upOrDownShelf(@ApiParam(value = "商品id", required = true) @RequestParam(value = "id") Integer id,
@ApiParam(value = "状态 0:下架 1: 上架", required = true) @RequestParam(value = "status") Integer status) {
return mallGoodsService.upOrDownShelf(id, status);
}
......@@ -77,7 +77,7 @@ public class MallGoodsController extends BaseController {
@ApiOperation(value = "商品列表-删除")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("removeMallGoods")
public ResultBody removeMallGoods(@ApiParam(value = "商品id", required = true) @RequestParam(value = "id") Long id) {
public ResultBody removeMallGoods(@ApiParam(value = "商品id", required = true) @RequestParam(value = "id") Integer id) {
return mallGoodsService.removeMallGoods(id);
}
}
......@@ -30,17 +30,17 @@ public interface MallGoodsDao {
void batchInsertMallGoodsResources(List<MallGoodsResourcesDO> mallGoodsResourcesList);
MallGoodsDO getMallGoodsBaseInfo(Long id);
MallGoodsDO getMallGoodsBaseInfo(Integer id);
List<MallGoodsResourcesDO> getMallGoodsResources(Long id);
List<MallGoodsResourcesDO> getMallGoodsResources(Integer id);
List<GoodsSpecDO> getMallGoodsSpec(Long id);
List<GoodsSpecDO> getMallGoodsSpec(Integer id);
List<GoodsSpecValuesDO> getMallGoodsSpecValues(List<Integer> ids);
void updateMallGoods(@Param("mallGoodsDO") MallGoodsDO mallGoodsDO);
void deleteMallGoodsResources(Long id);
void deleteMallGoodsResources(Integer id);
void deleteGoodsSpec(List<Integer> deleteSpec);
......@@ -56,9 +56,9 @@ public interface MallGoodsDao {
List<MallGoodsDO> listMallGoods(MallGoodsQO param);
int updateMallGoodsSort(Long id, Integer sort);
int updateMallGoodsSort(Integer id, Integer sort);
void updateMallGoodsByShelf(Long id, Integer status);
void updateMallGoodsByShelf(Integer id, Integer status);
void removeMallGoods(Long id);
void removeMallGoods(Integer id);
}
......@@ -24,7 +24,7 @@ public class GoodsSpecDO implements Serializable {
/**
* 商品id
*/
private Long mallGoodsId;
private Integer mallGoodsId;
/**
* 规格名称
*/
......
......@@ -23,7 +23,7 @@ import java.util.List;
public class MallGoodsDO implements Serializable {
private static final long serialVersionUID = 709941898403563905L;
private Long id;
private Integer id;
/**
* 商品编号(ID12345678)
*/
......
......@@ -22,7 +22,7 @@ public class MallGoodsResourcesDO implements Serializable {
private Integer id;
private Long mallGoodsId;
private Integer mallGoodsId;
/**
* 资源url
*/
......
......@@ -21,7 +21,7 @@ public class GoodsSpecVO {
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "商品id")
private Long mallGoodsId;
private Integer mallGoodsId;
@ApiModelProperty(value = "规格名称", example = "规格名称", required = true)
private String specName;
@ApiModelProperty(value = "选择方式 :0单选,1多选", example = "1", required = true)
......
......@@ -26,7 +26,7 @@ import java.util.List;
public class MallGoodsVO {
@ApiModelProperty(value = "id", example = "1")
@NotNull(message = "id不能为空", groups = {Update.class})
private Long id;
private Integer id;
@ApiModelProperty(value = "商品名称", example = "这是商品名称", required = true)
@NotBlank(message = "商品名称不能为空", groups = {Update.class, Create.class})
......@@ -67,7 +67,7 @@ public class MallGoodsVO {
@ApiModelProperty(value = "创建时间 用作列表回显")
private Date createTime;
@ApiModelProperty(value = "店铺id 小程序用")
private Integer userAccountId;
}
......@@ -13,7 +13,7 @@ import com.mmc.pms.page.PageResult;
public interface MallGoodsService {
ResultBody addMallGoods(MallGoodsVO mallGoodsVO, Integer userAccountId);
ResultBody<MallGoodsVO> mallGoodsDetails(Long id);
ResultBody<MallGoodsVO> mallGoodsDetails(Integer id);
ResultBody editMallGoods(MallGoodsVO mallGoodsVO, Integer userAccountId);
......@@ -21,9 +21,9 @@ public interface MallGoodsService {
PageResult listPageGoodsInfo(MallGoodsQO param, LoginSuccessDTO loginSuccessDTO);
ResultBody exchange(Long firstId, Long secondId);
ResultBody exchange(Integer firstId, Integer secondId);
ResultBody upOrDownShelf(Long id, Integer status);
ResultBody upOrDownShelf(Integer id, Integer status);
ResultBody removeMallGoods(Long id);
ResultBody removeMallGoods(Integer id);
}
......@@ -18,7 +18,6 @@ import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.mall.MallGoodsService;
import com.mmc.pms.util.CodeUtil;
import com.mmc.pms.util.SnowFlake;
import com.mmc.pms.util.TDateUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
......@@ -47,10 +46,6 @@ public class MallGoodsServiceImpl implements MallGoodsService {
ResultBody resultError = checkInformation(mallGoodsVO, userAccountId);
if (resultError != null) return resultError;
int count = mallGoodsDao.countMallGoods(userAccountId);
// 使用雪花算法生成雪花id,用作商品id,及其他id
SnowFlake snowFlake = new SnowFlake(2, 3);
long id = snowFlake.nextId();
mallGoodsVO.setId(id);
MallGoodsDO mallGoodsDO = new MallGoodsDO(mallGoodsVO);
mallGoodsDO.setGoodsNo("MG" + TDateUtil.getDateStr(new Date(), "yyyyMMddHHmmss") + CodeUtil.getRandomNum(4));
mallGoodsDO.setUserAccountId(userAccountId);
......@@ -58,14 +53,14 @@ public class MallGoodsServiceImpl implements MallGoodsService {
// 将基础信息存储入库
mallGoodsDao.insertMallGoodsBaseInfo(mallGoodsDO);
// 将商品图片等资源存入数据库中
insertMallGoodsResources(mallGoodsVO, id);
insertMallGoodsResources(mallGoodsVO, mallGoodsDO.getId());
// 将商品规格存入数据库
insertMallGoodsSpec(mallGoodsVO.getGoodsSpecList(), id);
insertMallGoodsSpec(mallGoodsVO.getGoodsSpecList(), mallGoodsDO.getId());
return ResultBody.success();
}
@Transactional(rollbackFor = Exception.class)
public void insertMallGoodsSpec(List<GoodsSpecVO> goodsSpecList, long id) {
public void insertMallGoodsSpec(List<GoodsSpecVO> goodsSpecList, Integer id) {
// 获取输入的规格信息
for (GoodsSpecVO goodsSpecVO : goodsSpecList) {
goodsSpecVO.setMallGoodsId(id);
......@@ -82,7 +77,7 @@ public class MallGoodsServiceImpl implements MallGoodsService {
}
@Transactional(rollbackFor = Exception.class)
public void insertMallGoodsResources(MallGoodsVO mallGoodsVO, long id) {
public void insertMallGoodsResources(MallGoodsVO mallGoodsVO, Integer id) {
List<MallGoodsResourcesDO> mallGoodsResourcesList = mallGoodsVO.getResourcesList().stream().map(d -> {
MallGoodsResourcesDO mallGoodsResourcesDO = new MallGoodsResourcesDO(d);
mallGoodsResourcesDO.setMallGoodsId(id);
......@@ -107,7 +102,7 @@ public class MallGoodsServiceImpl implements MallGoodsService {
}
@Override
public ResultBody<MallGoodsVO> mallGoodsDetails(Long id) {
public ResultBody<MallGoodsVO> mallGoodsDetails(Integer id) {
MallGoodsDO mallGoodsDO = mallGoodsDao.getMallGoodsBaseInfo(id);
if (mallGoodsDO == null) {
return ResultBody.error("商品不存在或已删除!");
......@@ -230,7 +225,7 @@ public class MallGoodsServiceImpl implements MallGoodsService {
@Override
@Transactional(rollbackFor = Exception.class)
public ResultBody exchange(Long firstId, Long secondId) {
public ResultBody exchange(Integer firstId, Integer secondId) {
MallGoodsDO firstMallGoodsBaseInfo = mallGoodsDao.getMallGoodsBaseInfo(firstId);
MallGoodsDO secondMallGoodsBaseInfo = mallGoodsDao.getMallGoodsBaseInfo(secondId);
int updateCount1 = mallGoodsDao.updateMallGoodsSort(firstId, firstMallGoodsBaseInfo.getSort());
......@@ -244,13 +239,13 @@ public class MallGoodsServiceImpl implements MallGoodsService {
}
@Override
public ResultBody upOrDownShelf(Long id, Integer status) {
public ResultBody upOrDownShelf(Integer id, Integer status) {
mallGoodsDao.updateMallGoodsByShelf(id, status);
return ResultBody.success();
}
@Override
public ResultBody removeMallGoods(Long id) {
public ResultBody removeMallGoods(Integer id) {
mallGoodsDao.removeMallGoods(id);
return ResultBody.success();
}
......
......@@ -3,9 +3,9 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmc.pms.dao.mall.MallGoodsDao">
<insert id="insertMallGoodsBaseInfo">
insert into mall_goods(id,
goods_no,
<insert id="insertMallGoodsBaseInfo" keyProperty="id"
useGeneratedKeys="true" parameterType="com.mmc.pms.entity.mall.MallGoodsDO">
insert into mall_goods(goods_no,
trade_name,
description,
category_primary_id,
......@@ -16,7 +16,7 @@
goods_details,
user_account_id,
sort)
values ( #{id}, #{goodsNo}, #{tradeName}, #{description}, #{categoryPrimaryId}, #{categorySubId}
values ( #{goodsNo}, #{tradeName}, #{description}, #{categoryPrimaryId}, #{categorySubId}
, #{shelfStatus}, #{goodsLabel}, #{labelShow}, #{goodsDetails}, #{userAccountId}, #{sort})
</insert>
<insert id="insertGoodsSpec" parameterType="com.mmc.pms.entity.mall.GoodsSpecDO"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论