提交 243e3266 作者: xiaowang

修改:修改类型

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