From 227f733ff9d3be283c83cad22f976a7ae9896e33 Mon Sep 17 00:00:00 2001 From: Renpc-kilig <308442850@qq.com> Date: Tue, 23 Mar 2021 15:14:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=97=E9=93=BA=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../category/CategoryController.java | 2 +- .../industry/IndustryController.java | 2 +- .../shopgoods/ShopGoodsController.java | 8 +- .../pojo/vos/shopgoods/ShopGoodsVO.java | 5 - .../service/shopgoods/IShopGoodsService.java | 4 +- .../shopgoods/impl/ShopGoodsServiceImpl.java | 24 ++-- .../mapper/shopGoods/shopGoods-mapper.xml | 19 +-- .../route/{shopGoods => shopgoods}/list.html | 111 ++++-------------- .../route/{shopGoods => shopgoods}/save.html | 92 +++------------ .../{shopGoods => shopgoods}/update.html | 94 ++++----------- 10 files changed, 97 insertions(+), 264 deletions(-) rename src/main/java/cn/com/tenlion/controller/{apis => api}/category/CategoryController.java (99%) rename src/main/java/cn/com/tenlion/controller/{apis => api}/industry/IndustryController.java (99%) rename src/main/java/cn/com/tenlion/controller/{apis => api}/shopgoods/ShopGoodsController.java (94%) rename src/main/resources/static/route/{shopGoods => shopgoods}/list.html (76%) rename src/main/resources/static/route/{shopGoods => shopgoods}/save.html (81%) rename src/main/resources/static/route/{shopGoods => shopgoods}/update.html (82%) diff --git a/src/main/java/cn/com/tenlion/controller/apis/category/CategoryController.java b/src/main/java/cn/com/tenlion/controller/api/category/CategoryController.java similarity index 99% rename from src/main/java/cn/com/tenlion/controller/apis/category/CategoryController.java rename to src/main/java/cn/com/tenlion/controller/api/category/CategoryController.java index e057783..f2e8e2f 100644 --- a/src/main/java/cn/com/tenlion/controller/apis/category/CategoryController.java +++ b/src/main/java/cn/com/tenlion/controller/api/category/CategoryController.java @@ -1,4 +1,4 @@ -package cn.com.tenlion.controller.apis.category; +package cn.com.tenlion.controller.api.category; import cn.com.tenlion.controller.AbstractController; import cn.com.tenlion.pojo.dtos.industry.IndustryZTreeDTO; diff --git a/src/main/java/cn/com/tenlion/controller/apis/industry/IndustryController.java b/src/main/java/cn/com/tenlion/controller/api/industry/IndustryController.java similarity index 99% rename from src/main/java/cn/com/tenlion/controller/apis/industry/IndustryController.java rename to src/main/java/cn/com/tenlion/controller/api/industry/IndustryController.java index 618cb90..aff2c74 100644 --- a/src/main/java/cn/com/tenlion/controller/apis/industry/IndustryController.java +++ b/src/main/java/cn/com/tenlion/controller/api/industry/IndustryController.java @@ -1,4 +1,4 @@ -package cn.com.tenlion.controller.apis.industry; +package cn.com.tenlion.controller.api.industry; import cn.com.tenlion.controller.AbstractController; import cn.com.tenlion.pojo.dtos.industry.IndustryDTO; diff --git a/src/main/java/cn/com/tenlion/controller/apis/shopgoods/ShopGoodsController.java b/src/main/java/cn/com/tenlion/controller/api/shopgoods/ShopGoodsController.java similarity index 94% rename from src/main/java/cn/com/tenlion/controller/apis/shopgoods/ShopGoodsController.java rename to src/main/java/cn/com/tenlion/controller/api/shopgoods/ShopGoodsController.java index c05f4da..ed7a163 100644 --- a/src/main/java/cn/com/tenlion/controller/apis/shopgoods/ShopGoodsController.java +++ b/src/main/java/cn/com/tenlion/controller/api/shopgoods/ShopGoodsController.java @@ -1,4 +1,4 @@ -package cn.com.tenlion.controller.apis.shopgoods; +package cn.com.tenlion.controller.api.shopgoods; import cn.com.tenlion.pojo.dtos.shopgoods.ShopGoodsDTO; import cn.com.tenlion.pojo.vos.shopgoods.ShopGoodsVO; @@ -59,10 +59,10 @@ public class ShopGoodsController extends DefaultBaseController { @ApiImplicitParam(name = "shopGoodsId", value = "ID", paramType = "path") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) - @PutMapping("update/{shopGoodsId}") + @PutMapping("update/{goodsId}") @CheckRequestBodyAnnotation - public SuccessResult update(@PathVariable("shopGoodsId") String shopGoodsId, @RequestBody ShopGoodsVO shopGoodsVO) { - shopGoodsService.update(shopGoodsId, shopGoodsVO); + public SuccessResult update(@PathVariable("goodsId") String goodsId, @RequestBody ShopGoodsVO shopGoodsVO) { + shopGoodsService.update(goodsId, shopGoodsVO); return new SuccessResult(); } diff --git a/src/main/java/cn/com/tenlion/pojo/vos/shopgoods/ShopGoodsVO.java b/src/main/java/cn/com/tenlion/pojo/vos/shopgoods/ShopGoodsVO.java index 20bf3af..61cc2eb 100644 --- a/src/main/java/cn/com/tenlion/pojo/vos/shopgoods/ShopGoodsVO.java +++ b/src/main/java/cn/com/tenlion/pojo/vos/shopgoods/ShopGoodsVO.java @@ -50,23 +50,18 @@ public class ShopGoodsVO { @ApiModelProperty(name = "goodsVideo", value = "商品视频,最多1个") private String goodsVideo; @ApiModelProperty(name = "goodStar", value = "商品星级,最高5星") - @CheckNumberAnnotation(name = "商品星级,最高5星") private Double goodStar; @ApiModelProperty(name = "userEvaluate", value = "用户评价,分数,满分10分,通过用户的评价自动计算") - @CheckNumberAnnotation(name = "用户评价,分数,满分10分,通过用户的评价自动计算") private Double userEvaluate; @ApiModelProperty(name = "gmtCreate", value = "创建时间") - @CheckEmptyAnnotation(name = "创建时间", verifyType = "datetime") private String gmtCreate; @ApiModelProperty(name = "creator", value = "创建人") private String creator; @ApiModelProperty(name = "gmtModified", value = "修改时间") - @CheckEmptyAnnotation(name = "修改时间", verifyType = "datetime") private String gmtModified; @ApiModelProperty(name = "modifier", value = "修改人") private String modifier; @ApiModelProperty(name = "isDelete", value = "是否删除0:是,1:否") - @CheckNumberAnnotation(name = "是否删除0:是,1:否") private Integer isDelete; public String getGoodsId() { diff --git a/src/main/java/cn/com/tenlion/service/shopgoods/IShopGoodsService.java b/src/main/java/cn/com/tenlion/service/shopgoods/IShopGoodsService.java index 1fc4a99..225e8b9 100644 --- a/src/main/java/cn/com/tenlion/service/shopgoods/IShopGoodsService.java +++ b/src/main/java/cn/com/tenlion/service/shopgoods/IShopGoodsService.java @@ -81,11 +81,11 @@ public interface IShopGoodsService { /** * 修改 * - * @param shopGoodsId + * @param goodsId * @param shopGoodsVO * @return */ - void update(String shopGoodsId, ShopGoodsVO shopGoodsVO); + void update(String goodsId, ShopGoodsVO shopGoodsVO); /** * 修改 diff --git a/src/main/java/cn/com/tenlion/service/shopgoods/impl/ShopGoodsServiceImpl.java b/src/main/java/cn/com/tenlion/service/shopgoods/impl/ShopGoodsServiceImpl.java index 6e74556..824df84 100644 --- a/src/main/java/cn/com/tenlion/service/shopgoods/impl/ShopGoodsServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/shopgoods/impl/ShopGoodsServiceImpl.java @@ -7,6 +7,7 @@ import cn.com.tenlion.pojo.pos.shopgoods.ShopGoodsPO; import cn.com.tenlion.pojo.vos.shopgoods.ShopGoodsVO; import cn.com.tenlion.service.shopgoods.IShopGoodsService; import ink.wgink.common.base.DefaultBaseService; +import ink.wgink.exceptions.ParamsException; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.util.map.HashMapUtil; @@ -49,16 +50,25 @@ public class ShopGoodsServiceImpl extends DefaultBaseService implements IShopGoo @Override public String saveReturnId(String token, ShopGoodsVO shopGoodsVO) { - String shopGoodsId = UUIDUtil.getUUID(); + /** + * 数据非空验证 + */ + /*if(StringUtils.isEmpty(shopGoodsVO.getShopId())) { + throw new ParamsException("店铺ID不允许为空"); + } + if(StringUtils.isEmpty(shopGoodsVO.getCategoryId())) { + throw new ParamsException("类目ID不允许为空"); + }*/ Map params = HashMapUtil.beanToMap(shopGoodsVO); - params.put("shopGoodsId", shopGoodsId); + String goodsId = UUIDUtil.getUUID(); + params.put("goodsId", goodsId); if (StringUtils.isBlank(token)) { setSaveInfo(params); } else { setAppSaveInfo(token, params); } shopGoodsDao.save(params); - return shopGoodsId; + return goodsId; } @Override @@ -86,14 +96,14 @@ public class ShopGoodsServiceImpl extends DefaultBaseService implements IShopGoo } @Override - public void update(String shopGoodsId, ShopGoodsVO shopGoodsVO) { - update(null, shopGoodsId, shopGoodsVO); + public void update(String goodsId, ShopGoodsVO shopGoodsVO) { + update(null, goodsId, shopGoodsVO); } @Override - public void update(String token, String shopGoodsId, ShopGoodsVO shopGoodsVO) { + public void update(String token, String goodsId, ShopGoodsVO shopGoodsVO) { Map params = HashMapUtil.beanToMap(shopGoodsVO); - params.put("shopGoodsId", shopGoodsId); + params.put("goodsId", goodsId); if (StringUtils.isBlank(token)) { setUpdateInfo(params); } else { diff --git a/src/main/resources/mybatis/mapper/shopGoods/shopGoods-mapper.xml b/src/main/resources/mybatis/mapper/shopGoods/shopGoods-mapper.xml index 4e087f8..affc7a9 100644 --- a/src/main/resources/mybatis/mapper/shopGoods/shopGoods-mapper.xml +++ b/src/main/resources/mybatis/mapper/shopGoods/shopGoods-mapper.xml @@ -148,9 +148,6 @@ UPDATE svc_shop_goods SET - - goods_id = #{goodsId}, - goods_name = #{goodsName}, @@ -212,7 +209,9 @@ is_delete = #{isDelete} WHERE - + + goods_id = #{goodsId} + @@ -244,7 +243,9 @@ svc_shop_goods t1 WHERE t1.is_delete = 0 - + + AND goods_id = #{goodsId} + @@ -275,7 +276,9 @@ svc_shop_goods t1 WHERE t1.is_delete = 0 - + + AND goods_id = #{goodsId} + @@ -306,7 +309,9 @@ svc_shop_goods t1 WHERE t1.is_delete = 0 - + + AND goods_id = #{goodsId} + diff --git a/src/main/resources/static/route/shopGoods/list.html b/src/main/resources/static/route/shopgoods/list.html similarity index 76% rename from src/main/resources/static/route/shopGoods/list.html rename to src/main/resources/static/route/shopgoods/list.html index 3ea0bfa..677d126 100644 --- a/src/main/resources/static/route/shopGoods/list.html +++ b/src/main/resources/static/route/shopgoods/list.html @@ -1,7 +1,7 @@ - + @@ -86,15 +86,6 @@ [ {type:'checkbox', fixed: 'left'}, {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, - {field: 'goodsId', width: 180, title: '商品ID', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, {field: 'goodsName', width: 180, title: '商品名称', align:'center', templet: function(row) { var rowData = row[this.field]; @@ -130,7 +121,7 @@ return downloadFile; } }, - {field: 'shopId', width: 180, title: '店铺ID', align:'center', + {field: 'shopId', width: 180, title: '所属店铺', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -139,7 +130,7 @@ return rowData; } }, - {field: 'categoryId', width: 180, title: '类目ID', align:'center', + {field: 'categoryId', width: 180, title: '商品类目', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -148,16 +139,7 @@ return rowData; } }, - {field: 'goodsSort', width: 180, title: '排序', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, - {field: 'goodsTotal', width: 180, title: '商品总数,最大9999标识不限制', align:'center', + {field: 'goodsTotal', width: 180, title: '商品总数', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -172,6 +154,12 @@ if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { return '-'; } + if(1 == rowData) { + rowData = '上架'; + } + if(2 == rowData) { + rowData = '下架'; + } return rowData; } }, @@ -199,44 +187,16 @@ if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { return '-'; } + if(1 == rowData) { + rowData = '线上支付'; + } + if(2 == rowData) { + rowData = '到店支付'; + } return rowData; } }, - {field: 'goodsPhotos', width: 180, title: '商品图片,最多9张', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - var downloadFile = ''; - var datas = rowData.split(','); - for(var i = 0, item = datas[i]; item = datas[i++];) { - if(downloadFile.length > 0) { - downloadFile += ' | '; - } - downloadFile += '点击下载' - } - return downloadFile; - } - }, - {field: 'goodsVideo', width: 180, title: '商品视频,最多1个', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - var downloadFile = ''; - var datas = rowData.split(','); - for(var i = 0, item = datas[i]; item = datas[i++];) { - if(downloadFile.length > 0) { - downloadFile += ' | '; - } - downloadFile += '点击下载' - } - return downloadFile; - } - }, - {field: 'goodStar', width: 180, title: '商品星级,最高5星', align:'center', + {field: 'goodStar', width: 180, title: '商品星级', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -245,7 +205,7 @@ return rowData; } }, - {field: 'userEvaluate', width: 180, title: '用户评价,分数,满分10分,通过用户的评价自动计算', align:'center', + {field: 'userEvaluate', width: 180, title: '用户评价', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -263,7 +223,7 @@ return rowData; } }, - {field: 'creator', width: 180, title: '创建人', align:'center', + {field: 'goodsSort', width: 180, title: '排序', align:'center', templet: function(row) { var rowData = row[this.field]; if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { @@ -271,34 +231,7 @@ } return rowData; } - }, - {field: 'gmtModified', width: 180, title: '修改时间', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, - {field: 'modifier', width: 180, title: '修改人', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, - {field: 'isDelete', width: 180, title: '是否删除0:是,1:否', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, + } ] ], page: true, @@ -405,7 +338,7 @@ area: ['100%', '100%'], shadeClose: true, anim: 2, - content: top.restAjax.path('route/shopgoods/update.html?shopGoodsId={shopGoodsId}', [checkDatas[0].shopGoodsId]), + content: top.restAjax.path('route/shopgoods/update.html?goodsId={goodsId}', [checkDatas[0].goodsId]), end: function() { reloadTable(); } @@ -420,7 +353,7 @@ if(i > 1) { ids += '_'; } - ids += item['shopGoodsId']; + ids += item['goodsId']; } removeData(ids); } diff --git a/src/main/resources/static/route/shopGoods/save.html b/src/main/resources/static/route/shopgoods/save.html similarity index 81% rename from src/main/resources/static/route/shopGoods/save.html rename to src/main/resources/static/route/shopgoods/save.html index c355834..293e83d 100644 --- a/src/main/resources/static/route/shopGoods/save.html +++ b/src/main/resources/static/route/shopgoods/save.html @@ -1,7 +1,7 @@ - + @@ -22,12 +22,6 @@
-
- -
- -
-
@@ -37,7 +31,7 @@
- +
@@ -71,33 +65,16 @@
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- +
-
- -
- +
+ +
+ +
@@ -112,14 +89,15 @@
-
- -
- +
+ +
+ +
- +
@@ -149,7 +127,7 @@
- +
@@ -177,45 +155,9 @@
- +
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- +
diff --git a/src/main/resources/static/route/shopGoods/update.html b/src/main/resources/static/route/shopgoods/update.html similarity index 82% rename from src/main/resources/static/route/shopGoods/update.html rename to src/main/resources/static/route/shopgoods/update.html index 68e3d14..b150671 100644 --- a/src/main/resources/static/route/shopGoods/update.html +++ b/src/main/resources/static/route/shopgoods/update.html @@ -1,7 +1,7 @@ - + @@ -22,12 +22,6 @@
-
- -
- -
-
@@ -37,7 +31,7 @@
- +
@@ -71,33 +65,16 @@
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- +
-
- -
- +
+ +
+ +
@@ -112,14 +89,15 @@
-
- -
- +
+ +
+ +
- +
@@ -149,7 +127,7 @@
- +
@@ -177,45 +155,15 @@
- +
- +
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- +
@@ -244,7 +192,7 @@ var form = layui.form; var laytpl = layui.laytpl; var laydate = layui.laydate; - var shopGoodsId = top.restAjax.params(window.location.href).shopGoodsId; + var goodsId = top.restAjax.params(window.location.href).goodsId; var wangEditor = window.wangEditor; var wangEditorObj = {}; @@ -477,7 +425,7 @@ // 初始化内容 function initData() { var loadLayerIndex; - top.restAjax.get(top.restAjax.path('api/shopgoods/get/{shopGoodsId}', [shopGoodsId]), {}, null, function(code, data) { + top.restAjax.get(top.restAjax.path('api/shopgoods/get/{goodsId}', [goodsId]), {}, null, function(code, data) { var dataFormData = {}; for(var i in data) { dataFormData[i] = data[i] +''; @@ -504,7 +452,7 @@ top.dialog.confirm(top.dataMessage.commit, function(index) { top.dialog.close(index); var loadLayerIndex; - top.restAjax.put(top.restAjax.path('api/shopgoods/update/{shopGoodsId}', [shopGoodsId]), formData.field, null, function(code, data) { + top.restAjax.put(top.restAjax.path('api/shopgoods/update/{goodsId}', [goodsId]), formData.field, null, function(code, data) { var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, { time: 0, btn: [top.dataMessage.button.yes, top.dataMessage.button.no],