店铺服务(商品)内容功能提交。
This commit is contained in:
parent
71fdcc10b9
commit
d778f41a2b
@ -0,0 +1,111 @@
|
||||
package cn.com.tenlion.controller.apis.shopgoods;
|
||||
|
||||
import cn.com.tenlion.pojo.dtos.shopgoods.ShopGoodsDTO;
|
||||
import cn.com.tenlion.pojo.vos.shopgoods.ShopGoodsVO;
|
||||
import cn.com.tenlion.service.shopgoods.IShopGoodsService;
|
||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultData;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: ShopGoodsController
|
||||
* @Description:
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-03-19 16:55:10
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/shopgoods")
|
||||
public class ShopGoodsController extends DefaultBaseController {
|
||||
|
||||
@Autowired
|
||||
private IShopGoodsService shopGoodsService;
|
||||
|
||||
@ApiOperation(value = "新增", notes = "新增接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("save")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult save(@RequestBody ShopGoodsVO shopGoodsVO) {
|
||||
shopGoodsService.save(shopGoodsVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除", notes = "删除接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@DeleteMapping("remove/{ids}")
|
||||
public SuccessResult remove(@PathVariable("ids") String ids) {
|
||||
shopGoodsService.remove(Arrays.asList(ids.split("\\_")));
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改", notes = "修改接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "shopGoodsId", value = "ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("update/{shopGoodsId}")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult update(@PathVariable("shopGoodsId") String shopGoodsId, @RequestBody ShopGoodsVO shopGoodsVO) {
|
||||
shopGoodsService.update(shopGoodsId, shopGoodsVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "详情", notes = "详情接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "shopGoodsId", value = "ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("get/{shopGoodsId}")
|
||||
public ShopGoodsDTO get(@PathVariable("shopGoodsId") String shopGoodsId) {
|
||||
return shopGoodsService.get(shopGoodsId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "列表", notes = "列表接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list")
|
||||
public List<ShopGoodsDTO> list() {
|
||||
Map<String, Object> params = requestParams();
|
||||
return shopGoodsService.list(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页列表", notes = "分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
||||
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpage")
|
||||
public SuccessResultList<List<ShopGoodsDTO>> listPage(ListPage page) {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return shopGoodsService.listPage(page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "统计", notes = "统计接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("count")
|
||||
SuccessResultData<Integer> count() {
|
||||
Map<String, Object> params = requestParams();
|
||||
return new SuccessResultData<>(shopGoodsService.count(params));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
package cn.com.tenlion.controller.app.apis.shopgoods;
|
||||
|
||||
import cn.com.tenlion.pojo.dtos.shopgoods.ShopGoodsDTO;
|
||||
import cn.com.tenlion.pojo.vos.shopgoods.ShopGoodsVO;
|
||||
import cn.com.tenlion.service.shopgoods.IShopGoodsService;
|
||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResult;
|
||||
import ink.wgink.pojo.result.SuccessResultData;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: ShopGoodsAppController
|
||||
* @Description:
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-03-19 16:55:10
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.APP_PREFIX + "/shopgoods")
|
||||
public class ShopGoodsAppController extends DefaultBaseController {
|
||||
|
||||
@Autowired
|
||||
private IShopGoodsService shopGoodsService;
|
||||
|
||||
@ApiOperation(value = "新增", notes = "新增接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PostMapping("save")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult save(@RequestHeader("token") String token, @RequestBody ShopGoodsVO shopGoodsVO) {
|
||||
shopGoodsService.save(token, shopGoodsVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除(id列表)", notes = "删除(id列表)接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
@ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@DeleteMapping("remove/{ids}")
|
||||
public SuccessResult remove(@RequestHeader("token") String token, @PathVariable("ids") String ids) {
|
||||
shopGoodsService.remove(token, Arrays.asList(ids.split("\\_")));
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改", notes = "修改接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
@ApiImplicitParam(name = "shopGoodsId", value = "ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("updateshopgoods/{shopGoodsId}")
|
||||
@CheckRequestBodyAnnotation
|
||||
public SuccessResult updateShopGoods(@RequestHeader("token") String token, @PathVariable("shopGoodsId") String shopGoodsId, @RequestBody ShopGoodsVO shopGoodsVO) {
|
||||
shopGoodsService.update(token, shopGoodsId, shopGoodsVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "详情(通过ID)", notes = "详情(通过ID)接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
@ApiImplicitParam(name = "shopGoodsId", value = "ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("get/{shopGoodsId}")
|
||||
public ShopGoodsDTO get(@RequestHeader("token") String token, @PathVariable("shopGoodsId") String shopGoodsId) {
|
||||
return shopGoodsService.get(shopGoodsId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "列表", notes = "列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list")
|
||||
public List<ShopGoodsDTO> list(@RequestHeader("token") String token) {
|
||||
Map<String, Object> params = requestParams();
|
||||
return shopGoodsService.list(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页列表", notes = "分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
||||
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpageshopgoods")
|
||||
public SuccessResultList<List<ShopGoodsDTO>> listPage(@RequestHeader("token") String token, ListPage page) {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return shopGoodsService.listPage(page);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "统计", notes = "统计接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("count")
|
||||
SuccessResultData<Integer> count() {
|
||||
Map<String, Object> params = requestParams();
|
||||
return new SuccessResultData<>(shopGoodsService.count(params));
|
||||
}
|
||||
|
||||
}
|
120
src/main/java/cn/com/tenlion/dao/shopgoods/IShopGoodsDao.java
Normal file
120
src/main/java/cn/com/tenlion/dao/shopgoods/IShopGoodsDao.java
Normal file
@ -0,0 +1,120 @@
|
||||
package cn.com.tenlion.dao.shopgoods;
|
||||
|
||||
import cn.com.tenlion.pojo.bos.shopgoods.ShopGoodsBO;
|
||||
import cn.com.tenlion.pojo.dtos.shopgoods.ShopGoodsDTO;
|
||||
import cn.com.tenlion.pojo.pos.shopgoods.ShopGoodsPO;
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: IShopGoodsDao
|
||||
* @Description:
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-03-19 16:55:10
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@Repository
|
||||
public interface IShopGoodsDao {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param params
|
||||
* @throws SaveException
|
||||
*/
|
||||
void save(Map<String, Object> params) throws SaveException;
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param params
|
||||
* @throws RemoveException
|
||||
*/
|
||||
void remove(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 删除(物理)
|
||||
*
|
||||
* @param params
|
||||
* @throws RemoveException
|
||||
*/
|
||||
void delete(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param params
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void update(Map<String, Object> params) throws UpdateException;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
ShopGoodsDTO get(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
ShopGoodsBO getBO(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
ShopGoodsPO getPO(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<ShopGoodsDTO> list(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<ShopGoodsBO> listBO(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<ShopGoodsPO> listPO(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 统计
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
Integer count(Map<String, Object> params) throws SearchException;
|
||||
|
||||
}
|
204
src/main/java/cn/com/tenlion/pojo/bos/shopgoods/ShopGoodsBO.java
Normal file
204
src/main/java/cn/com/tenlion/pojo/bos/shopgoods/ShopGoodsBO.java
Normal file
@ -0,0 +1,204 @@
|
||||
package cn.com.tenlion.pojo.bos.shopgoods;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: ShopGoodsBO
|
||||
* @Description:
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-03-19 16:55:10
|
||||
* @Version: 3.0
|
||||
**/
|
||||
public class ShopGoodsBO {
|
||||
|
||||
private String goodsId;
|
||||
private String goodsName;
|
||||
private String goodsSummary;
|
||||
private String goodsIcon;
|
||||
private String shopId;
|
||||
private String categoryId;
|
||||
private Double goodsSort;
|
||||
private Integer goodsTotal;
|
||||
private Integer goodsStatus;
|
||||
private Double goodsUnitPrice;
|
||||
private String goodsUnit;
|
||||
private Integer paymentType;
|
||||
private String goodsPhotos;
|
||||
private String goodsVideo;
|
||||
private Double goodStar;
|
||||
private Double userEvaluate;
|
||||
private String gmtCreate;
|
||||
private String creator;
|
||||
private String gmtModified;
|
||||
private String modifier;
|
||||
private Integer isDelete;
|
||||
|
||||
public String getGoodsId() {
|
||||
return goodsId == null ? "" : goodsId.trim();
|
||||
}
|
||||
|
||||
public void setGoodsId(String goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public String getGoodsName() {
|
||||
return goodsName == null ? "" : goodsName.trim();
|
||||
}
|
||||
|
||||
public void setGoodsName(String goodsName) {
|
||||
this.goodsName = goodsName;
|
||||
}
|
||||
|
||||
public String getGoodsSummary() {
|
||||
return goodsSummary == null ? "" : goodsSummary.trim();
|
||||
}
|
||||
|
||||
public void setGoodsSummary(String goodsSummary) {
|
||||
this.goodsSummary = goodsSummary;
|
||||
}
|
||||
|
||||
public String getGoodsIcon() {
|
||||
return goodsIcon == null ? "" : goodsIcon.trim();
|
||||
}
|
||||
|
||||
public void setGoodsIcon(String goodsIcon) {
|
||||
this.goodsIcon = goodsIcon;
|
||||
}
|
||||
|
||||
public String getShopId() {
|
||||
return shopId == null ? "" : shopId.trim();
|
||||
}
|
||||
|
||||
public void setShopId(String shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
public String getCategoryId() {
|
||||
return categoryId == null ? "" : categoryId.trim();
|
||||
}
|
||||
|
||||
public void setCategoryId(String categoryId) {
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
public Double getGoodsSort() {
|
||||
return goodsSort == null ? 0D : goodsSort;
|
||||
}
|
||||
|
||||
public void setGoodsSort(Double goodsSort) {
|
||||
this.goodsSort = goodsSort;
|
||||
}
|
||||
|
||||
public Integer getGoodsTotal() {
|
||||
return goodsTotal == null ? 0 : goodsTotal;
|
||||
}
|
||||
|
||||
public void setGoodsTotal(Integer goodsTotal) {
|
||||
this.goodsTotal = goodsTotal;
|
||||
}
|
||||
|
||||
public Integer getGoodsStatus() {
|
||||
return goodsStatus == null ? 0 : goodsStatus;
|
||||
}
|
||||
|
||||
public void setGoodsStatus(Integer goodsStatus) {
|
||||
this.goodsStatus = goodsStatus;
|
||||
}
|
||||
|
||||
public Double getGoodsUnitPrice() {
|
||||
return goodsUnitPrice == null ? 0D : goodsUnitPrice;
|
||||
}
|
||||
|
||||
public void setGoodsUnitPrice(Double goodsUnitPrice) {
|
||||
this.goodsUnitPrice = goodsUnitPrice;
|
||||
}
|
||||
|
||||
public String getGoodsUnit() {
|
||||
return goodsUnit == null ? "" : goodsUnit.trim();
|
||||
}
|
||||
|
||||
public void setGoodsUnit(String goodsUnit) {
|
||||
this.goodsUnit = goodsUnit;
|
||||
}
|
||||
|
||||
public Integer getPaymentType() {
|
||||
return paymentType == null ? 0 : paymentType;
|
||||
}
|
||||
|
||||
public void setPaymentType(Integer paymentType) {
|
||||
this.paymentType = paymentType;
|
||||
}
|
||||
|
||||
public String getGoodsPhotos() {
|
||||
return goodsPhotos == null ? "" : goodsPhotos.trim();
|
||||
}
|
||||
|
||||
public void setGoodsPhotos(String goodsPhotos) {
|
||||
this.goodsPhotos = goodsPhotos;
|
||||
}
|
||||
|
||||
public String getGoodsVideo() {
|
||||
return goodsVideo == null ? "" : goodsVideo.trim();
|
||||
}
|
||||
|
||||
public void setGoodsVideo(String goodsVideo) {
|
||||
this.goodsVideo = goodsVideo;
|
||||
}
|
||||
|
||||
public Double getGoodStar() {
|
||||
return goodStar == null ? 0D : goodStar;
|
||||
}
|
||||
|
||||
public void setGoodStar(Double goodStar) {
|
||||
this.goodStar = goodStar;
|
||||
}
|
||||
|
||||
public Double getUserEvaluate() {
|
||||
return userEvaluate == null ? 0D : userEvaluate;
|
||||
}
|
||||
|
||||
public void setUserEvaluate(Double userEvaluate) {
|
||||
this.userEvaluate = userEvaluate;
|
||||
}
|
||||
|
||||
public String getGmtCreate() {
|
||||
return gmtCreate == null ? "" : gmtCreate.trim();
|
||||
}
|
||||
|
||||
public void setGmtCreate(String gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator == null ? "" : creator.trim();
|
||||
}
|
||||
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public String getGmtModified() {
|
||||
return gmtModified == null ? "" : gmtModified.trim();
|
||||
}
|
||||
|
||||
public void setGmtModified(String gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
public String getModifier() {
|
||||
return modifier == null ? "" : modifier.trim();
|
||||
}
|
||||
|
||||
public void setModifier(String modifier) {
|
||||
this.modifier = modifier;
|
||||
}
|
||||
|
||||
public Integer getIsDelete() {
|
||||
return isDelete == null ? 0 : isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,229 @@
|
||||
package cn.com.tenlion.pojo.dtos.shopgoods;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: ShopGoodsDTO
|
||||
* @Description:
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-03-19 16:55:10
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class ShopGoodsDTO {
|
||||
|
||||
@ApiModelProperty(name = "goodsId", value = "商品ID")
|
||||
private String goodsId;
|
||||
@ApiModelProperty(name = "goodsName", value = "商品名称")
|
||||
private String goodsName;
|
||||
@ApiModelProperty(name = "goodsSummary", value = "商品说明")
|
||||
private String goodsSummary;
|
||||
@ApiModelProperty(name = "goodsIcon", value = "商品LOGO")
|
||||
private String goodsIcon;
|
||||
@ApiModelProperty(name = "shopId", value = "店铺ID")
|
||||
private String shopId;
|
||||
@ApiModelProperty(name = "categoryId", value = "类目ID")
|
||||
private String categoryId;
|
||||
@ApiModelProperty(name = "goodsSort", value = "排序")
|
||||
private Double goodsSort;
|
||||
@ApiModelProperty(name = "goodsTotal", value = "商品总数,最大9999标识不限制")
|
||||
private Integer goodsTotal;
|
||||
@ApiModelProperty(name = "goodsStatus", value = "商品状态1:上架,2:下架")
|
||||
private Integer goodsStatus;
|
||||
@ApiModelProperty(name = "goodsUnitPrice", value = "商品单价")
|
||||
private Double goodsUnitPrice;
|
||||
@ApiModelProperty(name = "goodsUnit", value = "商品单位")
|
||||
private String goodsUnit;
|
||||
@ApiModelProperty(name = "paymentType", value = "支付类型1:线上支付,2:到店支付")
|
||||
private Integer paymentType;
|
||||
@ApiModelProperty(name = "goodsPhotos", value = "商品图片,最多9张")
|
||||
private String goodsPhotos;
|
||||
@ApiModelProperty(name = "goodsVideo", value = "商品视频,最多1个")
|
||||
private String goodsVideo;
|
||||
@ApiModelProperty(name = "goodStar", value = "商品星级,最高5星")
|
||||
private Double goodStar;
|
||||
@ApiModelProperty(name = "userEvaluate", value = "用户评价,分数,满分10分,通过用户的评价自动计算")
|
||||
private Double userEvaluate;
|
||||
@ApiModelProperty(name = "gmtCreate", value = "创建时间")
|
||||
private String gmtCreate;
|
||||
@ApiModelProperty(name = "creator", value = "创建人")
|
||||
private String creator;
|
||||
@ApiModelProperty(name = "gmtModified", value = "修改时间")
|
||||
private String gmtModified;
|
||||
@ApiModelProperty(name = "modifier", value = "修改人")
|
||||
private String modifier;
|
||||
@ApiModelProperty(name = "isDelete", value = "是否删除0:是,1:否")
|
||||
private Integer isDelete;
|
||||
|
||||
public String getGoodsId() {
|
||||
return goodsId == null ? "" : goodsId.trim();
|
||||
}
|
||||
|
||||
public void setGoodsId(String goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public String getGoodsName() {
|
||||
return goodsName == null ? "" : goodsName.trim();
|
||||
}
|
||||
|
||||
public void setGoodsName(String goodsName) {
|
||||
this.goodsName = goodsName;
|
||||
}
|
||||
|
||||
public String getGoodsSummary() {
|
||||
return goodsSummary == null ? "" : goodsSummary.trim();
|
||||
}
|
||||
|
||||
public void setGoodsSummary(String goodsSummary) {
|
||||
this.goodsSummary = goodsSummary;
|
||||
}
|
||||
|
||||
public String getGoodsIcon() {
|
||||
return goodsIcon == null ? "" : goodsIcon.trim();
|
||||
}
|
||||
|
||||
public void setGoodsIcon(String goodsIcon) {
|
||||
this.goodsIcon = goodsIcon;
|
||||
}
|
||||
|
||||
public String getShopId() {
|
||||
return shopId == null ? "" : shopId.trim();
|
||||
}
|
||||
|
||||
public void setShopId(String shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
public String getCategoryId() {
|
||||
return categoryId == null ? "" : categoryId.trim();
|
||||
}
|
||||
|
||||
public void setCategoryId(String categoryId) {
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
public Double getGoodsSort() {
|
||||
return goodsSort == null ? 0D : goodsSort;
|
||||
}
|
||||
|
||||
public void setGoodsSort(Double goodsSort) {
|
||||
this.goodsSort = goodsSort;
|
||||
}
|
||||
|
||||
public Integer getGoodsTotal() {
|
||||
return goodsTotal == null ? 0 : goodsTotal;
|
||||
}
|
||||
|
||||
public void setGoodsTotal(Integer goodsTotal) {
|
||||
this.goodsTotal = goodsTotal;
|
||||
}
|
||||
|
||||
public Integer getGoodsStatus() {
|
||||
return goodsStatus == null ? 0 : goodsStatus;
|
||||
}
|
||||
|
||||
public void setGoodsStatus(Integer goodsStatus) {
|
||||
this.goodsStatus = goodsStatus;
|
||||
}
|
||||
|
||||
public Double getGoodsUnitPrice() {
|
||||
return goodsUnitPrice == null ? 0D : goodsUnitPrice;
|
||||
}
|
||||
|
||||
public void setGoodsUnitPrice(Double goodsUnitPrice) {
|
||||
this.goodsUnitPrice = goodsUnitPrice;
|
||||
}
|
||||
|
||||
public String getGoodsUnit() {
|
||||
return goodsUnit == null ? "" : goodsUnit.trim();
|
||||
}
|
||||
|
||||
public void setGoodsUnit(String goodsUnit) {
|
||||
this.goodsUnit = goodsUnit;
|
||||
}
|
||||
|
||||
public Integer getPaymentType() {
|
||||
return paymentType == null ? 0 : paymentType;
|
||||
}
|
||||
|
||||
public void setPaymentType(Integer paymentType) {
|
||||
this.paymentType = paymentType;
|
||||
}
|
||||
|
||||
public String getGoodsPhotos() {
|
||||
return goodsPhotos == null ? "" : goodsPhotos.trim();
|
||||
}
|
||||
|
||||
public void setGoodsPhotos(String goodsPhotos) {
|
||||
this.goodsPhotos = goodsPhotos;
|
||||
}
|
||||
|
||||
public String getGoodsVideo() {
|
||||
return goodsVideo == null ? "" : goodsVideo.trim();
|
||||
}
|
||||
|
||||
public void setGoodsVideo(String goodsVideo) {
|
||||
this.goodsVideo = goodsVideo;
|
||||
}
|
||||
|
||||
public Double getGoodStar() {
|
||||
return goodStar == null ? 0D : goodStar;
|
||||
}
|
||||
|
||||
public void setGoodStar(Double goodStar) {
|
||||
this.goodStar = goodStar;
|
||||
}
|
||||
|
||||
public Double getUserEvaluate() {
|
||||
return userEvaluate == null ? 0D : userEvaluate;
|
||||
}
|
||||
|
||||
public void setUserEvaluate(Double userEvaluate) {
|
||||
this.userEvaluate = userEvaluate;
|
||||
}
|
||||
|
||||
public String getGmtCreate() {
|
||||
return gmtCreate == null ? "" : gmtCreate.trim();
|
||||
}
|
||||
|
||||
public void setGmtCreate(String gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator == null ? "" : creator.trim();
|
||||
}
|
||||
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public String getGmtModified() {
|
||||
return gmtModified == null ? "" : gmtModified.trim();
|
||||
}
|
||||
|
||||
public void setGmtModified(String gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
public String getModifier() {
|
||||
return modifier == null ? "" : modifier.trim();
|
||||
}
|
||||
|
||||
public void setModifier(String modifier) {
|
||||
this.modifier = modifier;
|
||||
}
|
||||
|
||||
public Integer getIsDelete() {
|
||||
return isDelete == null ? 0 : isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
|
||||
}
|
204
src/main/java/cn/com/tenlion/pojo/pos/shopgoods/ShopGoodsPO.java
Normal file
204
src/main/java/cn/com/tenlion/pojo/pos/shopgoods/ShopGoodsPO.java
Normal file
@ -0,0 +1,204 @@
|
||||
package cn.com.tenlion.pojo.pos.shopgoods;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: ShopGoodsPO
|
||||
* @Description:
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-03-19 16:55:10
|
||||
* @Version: 3.0
|
||||
**/
|
||||
public class ShopGoodsPO {
|
||||
|
||||
private String goodsId;
|
||||
private String goodsName;
|
||||
private String goodsSummary;
|
||||
private String goodsIcon;
|
||||
private String shopId;
|
||||
private String categoryId;
|
||||
private Double goodsSort;
|
||||
private Integer goodsTotal;
|
||||
private Integer goodsStatus;
|
||||
private Double goodsUnitPrice;
|
||||
private String goodsUnit;
|
||||
private Integer paymentType;
|
||||
private String goodsPhotos;
|
||||
private String goodsVideo;
|
||||
private Double goodStar;
|
||||
private Double userEvaluate;
|
||||
private String gmtCreate;
|
||||
private String creator;
|
||||
private String gmtModified;
|
||||
private String modifier;
|
||||
private Integer isDelete;
|
||||
|
||||
public String getGoodsId() {
|
||||
return goodsId == null ? "" : goodsId.trim();
|
||||
}
|
||||
|
||||
public void setGoodsId(String goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public String getGoodsName() {
|
||||
return goodsName == null ? "" : goodsName.trim();
|
||||
}
|
||||
|
||||
public void setGoodsName(String goodsName) {
|
||||
this.goodsName = goodsName;
|
||||
}
|
||||
|
||||
public String getGoodsSummary() {
|
||||
return goodsSummary == null ? "" : goodsSummary.trim();
|
||||
}
|
||||
|
||||
public void setGoodsSummary(String goodsSummary) {
|
||||
this.goodsSummary = goodsSummary;
|
||||
}
|
||||
|
||||
public String getGoodsIcon() {
|
||||
return goodsIcon == null ? "" : goodsIcon.trim();
|
||||
}
|
||||
|
||||
public void setGoodsIcon(String goodsIcon) {
|
||||
this.goodsIcon = goodsIcon;
|
||||
}
|
||||
|
||||
public String getShopId() {
|
||||
return shopId == null ? "" : shopId.trim();
|
||||
}
|
||||
|
||||
public void setShopId(String shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
public String getCategoryId() {
|
||||
return categoryId == null ? "" : categoryId.trim();
|
||||
}
|
||||
|
||||
public void setCategoryId(String categoryId) {
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
public Double getGoodsSort() {
|
||||
return goodsSort == null ? 0D : goodsSort;
|
||||
}
|
||||
|
||||
public void setGoodsSort(Double goodsSort) {
|
||||
this.goodsSort = goodsSort;
|
||||
}
|
||||
|
||||
public Integer getGoodsTotal() {
|
||||
return goodsTotal == null ? 0 : goodsTotal;
|
||||
}
|
||||
|
||||
public void setGoodsTotal(Integer goodsTotal) {
|
||||
this.goodsTotal = goodsTotal;
|
||||
}
|
||||
|
||||
public Integer getGoodsStatus() {
|
||||
return goodsStatus == null ? 0 : goodsStatus;
|
||||
}
|
||||
|
||||
public void setGoodsStatus(Integer goodsStatus) {
|
||||
this.goodsStatus = goodsStatus;
|
||||
}
|
||||
|
||||
public Double getGoodsUnitPrice() {
|
||||
return goodsUnitPrice == null ? 0D : goodsUnitPrice;
|
||||
}
|
||||
|
||||
public void setGoodsUnitPrice(Double goodsUnitPrice) {
|
||||
this.goodsUnitPrice = goodsUnitPrice;
|
||||
}
|
||||
|
||||
public String getGoodsUnit() {
|
||||
return goodsUnit == null ? "" : goodsUnit.trim();
|
||||
}
|
||||
|
||||
public void setGoodsUnit(String goodsUnit) {
|
||||
this.goodsUnit = goodsUnit;
|
||||
}
|
||||
|
||||
public Integer getPaymentType() {
|
||||
return paymentType == null ? 0 : paymentType;
|
||||
}
|
||||
|
||||
public void setPaymentType(Integer paymentType) {
|
||||
this.paymentType = paymentType;
|
||||
}
|
||||
|
||||
public String getGoodsPhotos() {
|
||||
return goodsPhotos == null ? "" : goodsPhotos.trim();
|
||||
}
|
||||
|
||||
public void setGoodsPhotos(String goodsPhotos) {
|
||||
this.goodsPhotos = goodsPhotos;
|
||||
}
|
||||
|
||||
public String getGoodsVideo() {
|
||||
return goodsVideo == null ? "" : goodsVideo.trim();
|
||||
}
|
||||
|
||||
public void setGoodsVideo(String goodsVideo) {
|
||||
this.goodsVideo = goodsVideo;
|
||||
}
|
||||
|
||||
public Double getGoodStar() {
|
||||
return goodStar == null ? 0D : goodStar;
|
||||
}
|
||||
|
||||
public void setGoodStar(Double goodStar) {
|
||||
this.goodStar = goodStar;
|
||||
}
|
||||
|
||||
public Double getUserEvaluate() {
|
||||
return userEvaluate == null ? 0D : userEvaluate;
|
||||
}
|
||||
|
||||
public void setUserEvaluate(Double userEvaluate) {
|
||||
this.userEvaluate = userEvaluate;
|
||||
}
|
||||
|
||||
public String getGmtCreate() {
|
||||
return gmtCreate == null ? "" : gmtCreate.trim();
|
||||
}
|
||||
|
||||
public void setGmtCreate(String gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator == null ? "" : creator.trim();
|
||||
}
|
||||
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public String getGmtModified() {
|
||||
return gmtModified == null ? "" : gmtModified.trim();
|
||||
}
|
||||
|
||||
public void setGmtModified(String gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
public String getModifier() {
|
||||
return modifier == null ? "" : modifier.trim();
|
||||
}
|
||||
|
||||
public void setModifier(String modifier) {
|
||||
this.modifier = modifier;
|
||||
}
|
||||
|
||||
public Integer getIsDelete() {
|
||||
return isDelete == null ? 0 : isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
|
||||
}
|
241
src/main/java/cn/com/tenlion/pojo/vos/shopgoods/ShopGoodsVO.java
Normal file
241
src/main/java/cn/com/tenlion/pojo/vos/shopgoods/ShopGoodsVO.java
Normal file
@ -0,0 +1,241 @@
|
||||
package cn.com.tenlion.pojo.vos.shopgoods;
|
||||
|
||||
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||
import ink.wgink.annotation.CheckNumberAnnotation;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: ShopGoodsVO
|
||||
* @Description:
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-03-19 16:55:10
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class ShopGoodsVO {
|
||||
|
||||
@ApiModelProperty(name = "goodsId", value = "商品ID")
|
||||
private String goodsId;
|
||||
@ApiModelProperty(name = "goodsName", value = "商品名称")
|
||||
private String goodsName;
|
||||
@ApiModelProperty(name = "goodsSummary", value = "商品说明")
|
||||
private String goodsSummary;
|
||||
@ApiModelProperty(name = "goodsIcon", value = "商品LOGO")
|
||||
private String goodsIcon;
|
||||
@ApiModelProperty(name = "shopId", value = "店铺ID")
|
||||
private String shopId;
|
||||
@ApiModelProperty(name = "categoryId", value = "类目ID")
|
||||
private String categoryId;
|
||||
@ApiModelProperty(name = "goodsSort", value = "排序")
|
||||
@CheckNumberAnnotation(name = "排序")
|
||||
private Double goodsSort;
|
||||
@ApiModelProperty(name = "goodsTotal", value = "商品总数,最大9999标识不限制")
|
||||
@CheckNumberAnnotation(name = "商品总数,最大9999标识不限制")
|
||||
private Integer goodsTotal;
|
||||
@ApiModelProperty(name = "goodsStatus", value = "商品状态1:上架,2:下架")
|
||||
@CheckNumberAnnotation(name = "商品状态1:上架,2:下架")
|
||||
private Integer goodsStatus;
|
||||
@ApiModelProperty(name = "goodsUnitPrice", value = "商品单价")
|
||||
@CheckNumberAnnotation(name = "商品单价")
|
||||
private Double goodsUnitPrice;
|
||||
@ApiModelProperty(name = "goodsUnit", value = "商品单位")
|
||||
private String goodsUnit;
|
||||
@ApiModelProperty(name = "paymentType", value = "支付类型1:线上支付,2:到店支付")
|
||||
@CheckNumberAnnotation(name = "支付类型1:线上支付,2:到店支付")
|
||||
private Integer paymentType;
|
||||
@ApiModelProperty(name = "goodsPhotos", value = "商品图片,最多9张")
|
||||
private String goodsPhotos;
|
||||
@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() {
|
||||
return goodsId == null ? "" : goodsId.trim();
|
||||
}
|
||||
|
||||
public void setGoodsId(String goodsId) {
|
||||
this.goodsId = goodsId;
|
||||
}
|
||||
|
||||
public String getGoodsName() {
|
||||
return goodsName == null ? "" : goodsName.trim();
|
||||
}
|
||||
|
||||
public void setGoodsName(String goodsName) {
|
||||
this.goodsName = goodsName;
|
||||
}
|
||||
|
||||
public String getGoodsSummary() {
|
||||
return goodsSummary == null ? "" : goodsSummary.trim();
|
||||
}
|
||||
|
||||
public void setGoodsSummary(String goodsSummary) {
|
||||
this.goodsSummary = goodsSummary;
|
||||
}
|
||||
|
||||
public String getGoodsIcon() {
|
||||
return goodsIcon == null ? "" : goodsIcon.trim();
|
||||
}
|
||||
|
||||
public void setGoodsIcon(String goodsIcon) {
|
||||
this.goodsIcon = goodsIcon;
|
||||
}
|
||||
|
||||
public String getShopId() {
|
||||
return shopId == null ? "" : shopId.trim();
|
||||
}
|
||||
|
||||
public void setShopId(String shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
public String getCategoryId() {
|
||||
return categoryId == null ? "" : categoryId.trim();
|
||||
}
|
||||
|
||||
public void setCategoryId(String categoryId) {
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
public Double getGoodsSort() {
|
||||
return goodsSort == null ? 0D : goodsSort;
|
||||
}
|
||||
|
||||
public void setGoodsSort(Double goodsSort) {
|
||||
this.goodsSort = goodsSort;
|
||||
}
|
||||
|
||||
public Integer getGoodsTotal() {
|
||||
return goodsTotal == null ? 0 : goodsTotal;
|
||||
}
|
||||
|
||||
public void setGoodsTotal(Integer goodsTotal) {
|
||||
this.goodsTotal = goodsTotal;
|
||||
}
|
||||
|
||||
public Integer getGoodsStatus() {
|
||||
return goodsStatus == null ? 0 : goodsStatus;
|
||||
}
|
||||
|
||||
public void setGoodsStatus(Integer goodsStatus) {
|
||||
this.goodsStatus = goodsStatus;
|
||||
}
|
||||
|
||||
public Double getGoodsUnitPrice() {
|
||||
return goodsUnitPrice == null ? 0D : goodsUnitPrice;
|
||||
}
|
||||
|
||||
public void setGoodsUnitPrice(Double goodsUnitPrice) {
|
||||
this.goodsUnitPrice = goodsUnitPrice;
|
||||
}
|
||||
|
||||
public String getGoodsUnit() {
|
||||
return goodsUnit == null ? "" : goodsUnit.trim();
|
||||
}
|
||||
|
||||
public void setGoodsUnit(String goodsUnit) {
|
||||
this.goodsUnit = goodsUnit;
|
||||
}
|
||||
|
||||
public Integer getPaymentType() {
|
||||
return paymentType == null ? 0 : paymentType;
|
||||
}
|
||||
|
||||
public void setPaymentType(Integer paymentType) {
|
||||
this.paymentType = paymentType;
|
||||
}
|
||||
|
||||
public String getGoodsPhotos() {
|
||||
return goodsPhotos == null ? "" : goodsPhotos.trim();
|
||||
}
|
||||
|
||||
public void setGoodsPhotos(String goodsPhotos) {
|
||||
this.goodsPhotos = goodsPhotos;
|
||||
}
|
||||
|
||||
public String getGoodsVideo() {
|
||||
return goodsVideo == null ? "" : goodsVideo.trim();
|
||||
}
|
||||
|
||||
public void setGoodsVideo(String goodsVideo) {
|
||||
this.goodsVideo = goodsVideo;
|
||||
}
|
||||
|
||||
public Double getGoodStar() {
|
||||
return goodStar == null ? 0D : goodStar;
|
||||
}
|
||||
|
||||
public void setGoodStar(Double goodStar) {
|
||||
this.goodStar = goodStar;
|
||||
}
|
||||
|
||||
public Double getUserEvaluate() {
|
||||
return userEvaluate == null ? 0D : userEvaluate;
|
||||
}
|
||||
|
||||
public void setUserEvaluate(Double userEvaluate) {
|
||||
this.userEvaluate = userEvaluate;
|
||||
}
|
||||
|
||||
public String getGmtCreate() {
|
||||
return gmtCreate == null ? "" : gmtCreate.trim();
|
||||
}
|
||||
|
||||
public void setGmtCreate(String gmtCreate) {
|
||||
this.gmtCreate = gmtCreate;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator == null ? "" : creator.trim();
|
||||
}
|
||||
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public String getGmtModified() {
|
||||
return gmtModified == null ? "" : gmtModified.trim();
|
||||
}
|
||||
|
||||
public void setGmtModified(String gmtModified) {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
public String getModifier() {
|
||||
return modifier == null ? "" : modifier.trim();
|
||||
}
|
||||
|
||||
public void setModifier(String modifier) {
|
||||
this.modifier = modifier;
|
||||
}
|
||||
|
||||
public Integer getIsDelete() {
|
||||
return isDelete == null ? 0 : isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,188 @@
|
||||
package cn.com.tenlion.service.shopgoods;
|
||||
|
||||
import cn.com.tenlion.pojo.bos.shopgoods.ShopGoodsBO;
|
||||
import cn.com.tenlion.pojo.dtos.shopgoods.ShopGoodsDTO;
|
||||
import cn.com.tenlion.pojo.pos.shopgoods.ShopGoodsPO;
|
||||
import cn.com.tenlion.pojo.vos.shopgoods.ShopGoodsVO;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: IShopGoodsService
|
||||
* @Description:
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-03-19 16:55:10
|
||||
* @Version: 3.0
|
||||
**/
|
||||
public interface IShopGoodsService {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param shopGoodsVO
|
||||
* @return
|
||||
*/
|
||||
void save(ShopGoodsVO shopGoodsVO);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param token
|
||||
* @param shopGoodsVO
|
||||
* @return
|
||||
*/
|
||||
void save(String token, ShopGoodsVO shopGoodsVO);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param shopGoodsVO
|
||||
* @return shopGoodsId
|
||||
*/
|
||||
String saveReturnId(ShopGoodsVO shopGoodsVO);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param token
|
||||
* @param shopGoodsVO
|
||||
* @return shopGoodsId
|
||||
*/
|
||||
String saveReturnId(String token, ShopGoodsVO shopGoodsVO);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param ids id列表
|
||||
* @return
|
||||
*/
|
||||
void remove(List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param token
|
||||
* @param ids id列表
|
||||
* @return
|
||||
*/
|
||||
void remove(String token, List<String> ids);
|
||||
|
||||
/**
|
||||
* 删除(物理删除)
|
||||
*
|
||||
* @param ids id列表
|
||||
*/
|
||||
void delete(List<String> ids);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param shopGoodsId
|
||||
* @param shopGoodsVO
|
||||
* @return
|
||||
*/
|
||||
void update(String shopGoodsId, ShopGoodsVO shopGoodsVO);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param token
|
||||
* @param shopGoodsId
|
||||
* @param shopGoodsVO
|
||||
* @return
|
||||
*/
|
||||
void update(String token, String shopGoodsId, ShopGoodsVO shopGoodsVO);
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param params 参数Map
|
||||
* @return
|
||||
*/
|
||||
ShopGoodsDTO get(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param shopGoodsId
|
||||
* @return
|
||||
*/
|
||||
ShopGoodsDTO get(String shopGoodsId);
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param params 参数Map
|
||||
* @return
|
||||
*/
|
||||
ShopGoodsBO getBO(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param shopGoodsId
|
||||
* @return
|
||||
*/
|
||||
ShopGoodsBO getBO(String shopGoodsId);
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param params 参数Map
|
||||
* @return
|
||||
*/
|
||||
ShopGoodsPO getPO(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param shopGoodsId
|
||||
* @return
|
||||
*/
|
||||
ShopGoodsPO getPO(String shopGoodsId);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<ShopGoodsDTO> list(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<ShopGoodsBO> listBO(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<ShopGoodsPO> listPO(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 分页列表
|
||||
*
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<ShopGoodsDTO>> listPage(ListPage page);
|
||||
|
||||
/**
|
||||
* 统计
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Integer count(Map<String, Object> params);
|
||||
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
package cn.com.tenlion.service.shopgoods.impl;
|
||||
|
||||
import cn.com.tenlion.dao.shopgoods.IShopGoodsDao;
|
||||
import cn.com.tenlion.pojo.bos.shopgoods.ShopGoodsBO;
|
||||
import cn.com.tenlion.pojo.dtos.shopgoods.ShopGoodsDTO;
|
||||
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.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.util.map.HashMapUtil;
|
||||
import ink.wgink.util.UUIDUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @ClassName: ShopGoodsServiceImpl
|
||||
* @Description:
|
||||
* @Author: CodeFactory
|
||||
* @Date: 2021-03-19 16:55:10
|
||||
* @Version: 3.0
|
||||
**/
|
||||
@Service
|
||||
public class ShopGoodsServiceImpl extends DefaultBaseService implements IShopGoodsService {
|
||||
|
||||
@Autowired
|
||||
private IShopGoodsDao shopGoodsDao;
|
||||
|
||||
@Override
|
||||
public void save(ShopGoodsVO shopGoodsVO) {
|
||||
saveReturnId(shopGoodsVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(String token, ShopGoodsVO shopGoodsVO) {
|
||||
saveReturnId(token, shopGoodsVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String saveReturnId(ShopGoodsVO shopGoodsVO) {
|
||||
return saveReturnId(null, shopGoodsVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String saveReturnId(String token, ShopGoodsVO shopGoodsVO) {
|
||||
String shopGoodsId = UUIDUtil.getUUID();
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(shopGoodsVO);
|
||||
params.put("shopGoodsId", shopGoodsId);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
setSaveInfo(params);
|
||||
} else {
|
||||
setAppSaveInfo(token, params);
|
||||
}
|
||||
shopGoodsDao.save(params);
|
||||
return shopGoodsId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(List<String> ids) {
|
||||
remove(null, ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(String token, List<String> ids) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("shopGoodsIds", ids);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
setUpdateInfo(params);
|
||||
} else {
|
||||
setAppUpdateInfo(token, params);
|
||||
}
|
||||
shopGoodsDao.remove(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(List<String> ids) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("shopGoodsIds", ids);
|
||||
shopGoodsDao.delete(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String shopGoodsId, ShopGoodsVO shopGoodsVO) {
|
||||
update(null, shopGoodsId, shopGoodsVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String token, String shopGoodsId, ShopGoodsVO shopGoodsVO) {
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(shopGoodsVO);
|
||||
params.put("shopGoodsId", shopGoodsId);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
setUpdateInfo(params);
|
||||
} else {
|
||||
setAppUpdateInfo(token, params);
|
||||
}
|
||||
shopGoodsDao.update(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopGoodsDTO get(Map<String, Object> params) {
|
||||
return shopGoodsDao.get(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopGoodsDTO get(String shopGoodsId) {
|
||||
Map<String, Object> params = super.getHashMap(2);
|
||||
params.put("shopGoodsId", shopGoodsId);
|
||||
return get(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopGoodsBO getBO(Map<String, Object> params) {
|
||||
return shopGoodsDao.getBO(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopGoodsBO getBO(String shopGoodsId) {
|
||||
Map<String, Object> params = super.getHashMap(2);
|
||||
params.put("shopGoodsId", shopGoodsId);
|
||||
return getBO(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopGoodsPO getPO(Map<String, Object> params) {
|
||||
return shopGoodsDao.getPO(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopGoodsPO getPO(String shopGoodsId) {
|
||||
Map<String, Object> params = super.getHashMap(2);
|
||||
params.put("shopGoodsId", shopGoodsId);
|
||||
return getPO(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShopGoodsDTO> list(Map<String, Object> params) {
|
||||
return shopGoodsDao.list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShopGoodsBO> listBO(Map<String, Object> params) {
|
||||
return shopGoodsDao.listBO(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShopGoodsPO> listPO(Map<String, Object> params) {
|
||||
return shopGoodsDao.listPO(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<ShopGoodsDTO>> listPage(ListPage page) {
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<ShopGoodsDTO> shopGoodsDTOs = list(page.getParams());
|
||||
PageInfo<ShopGoodsDTO> pageInfo = new PageInfo<>(shopGoodsDTOs);
|
||||
return new SuccessResultList<>(shopGoodsDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer count(Map<String, Object> params) {
|
||||
Integer count = shopGoodsDao.count(params);
|
||||
return count == null ? 0 : count;
|
||||
}
|
||||
|
||||
}
|
455
src/main/resources/mybatis/mapper/shopGoods/shopGoods-mapper.xml
Normal file
455
src/main/resources/mybatis/mapper/shopGoods/shopGoods-mapper.xml
Normal file
@ -0,0 +1,455 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.com.tenlion.dao.shopgoods.IShopGoodsDao">
|
||||
|
||||
<resultMap id="shopGoodsDTO" type="cn.com.tenlion.pojo.dtos.shopgoods.ShopGoodsDTO">
|
||||
<result column="goods_id" property="goodsId"/>
|
||||
<result column="goods_name" property="goodsName"/>
|
||||
<result column="goods_summary" property="goodsSummary"/>
|
||||
<result column="goods_icon" property="goodsIcon"/>
|
||||
<result column="shop_id" property="shopId"/>
|
||||
<result column="category_id" property="categoryId"/>
|
||||
<result column="goods_sort" property="goodsSort"/>
|
||||
<result column="goods_total" property="goodsTotal"/>
|
||||
<result column="goods_status" property="goodsStatus"/>
|
||||
<result column="goods_unit_price" property="goodsUnitPrice"/>
|
||||
<result column="goods_unit" property="goodsUnit"/>
|
||||
<result column="payment_type" property="paymentType"/>
|
||||
<result column="goods_photos" property="goodsPhotos"/>
|
||||
<result column="goods_video" property="goodsVideo"/>
|
||||
<result column="good_star" property="goodStar"/>
|
||||
<result column="user_evaluate" property="userEvaluate"/>
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="gmt_modified" property="gmtModified"/>
|
||||
<result column="modifier" property="modifier"/>
|
||||
<result column="is_delete" property="isDelete"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="shopGoodsBO" type="cn.com.tenlion.pojo.bos.shopgoods.ShopGoodsBO">
|
||||
<result column="goods_id" property="goodsId"/>
|
||||
<result column="goods_name" property="goodsName"/>
|
||||
<result column="goods_summary" property="goodsSummary"/>
|
||||
<result column="goods_icon" property="goodsIcon"/>
|
||||
<result column="shop_id" property="shopId"/>
|
||||
<result column="category_id" property="categoryId"/>
|
||||
<result column="goods_sort" property="goodsSort"/>
|
||||
<result column="goods_total" property="goodsTotal"/>
|
||||
<result column="goods_status" property="goodsStatus"/>
|
||||
<result column="goods_unit_price" property="goodsUnitPrice"/>
|
||||
<result column="goods_unit" property="goodsUnit"/>
|
||||
<result column="payment_type" property="paymentType"/>
|
||||
<result column="goods_photos" property="goodsPhotos"/>
|
||||
<result column="goods_video" property="goodsVideo"/>
|
||||
<result column="good_star" property="goodStar"/>
|
||||
<result column="user_evaluate" property="userEvaluate"/>
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="gmt_modified" property="gmtModified"/>
|
||||
<result column="modifier" property="modifier"/>
|
||||
<result column="is_delete" property="isDelete"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="shopGoodsPO" type="ink.wgink.pojo.pos.shopgoods.ShopGoodsPO">
|
||||
<result column="goods_id" property="goodsId"/>
|
||||
<result column="goods_name" property="goodsName"/>
|
||||
<result column="goods_summary" property="goodsSummary"/>
|
||||
<result column="goods_icon" property="goodsIcon"/>
|
||||
<result column="shop_id" property="shopId"/>
|
||||
<result column="category_id" property="categoryId"/>
|
||||
<result column="goods_sort" property="goodsSort"/>
|
||||
<result column="goods_total" property="goodsTotal"/>
|
||||
<result column="goods_status" property="goodsStatus"/>
|
||||
<result column="goods_unit_price" property="goodsUnitPrice"/>
|
||||
<result column="goods_unit" property="goodsUnit"/>
|
||||
<result column="payment_type" property="paymentType"/>
|
||||
<result column="goods_photos" property="goodsPhotos"/>
|
||||
<result column="goods_video" property="goodsVideo"/>
|
||||
<result column="good_star" property="goodStar"/>
|
||||
<result column="user_evaluate" property="userEvaluate"/>
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="gmt_modified" property="gmtModified"/>
|
||||
<result column="modifier" property="modifier"/>
|
||||
<result column="is_delete" property="isDelete"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 新增 -->
|
||||
<insert id="save" parameterType="map">
|
||||
INSERT INTO svc_shop_goods(
|
||||
goods_id,
|
||||
goods_name,
|
||||
goods_summary,
|
||||
goods_icon,
|
||||
shop_id,
|
||||
category_id,
|
||||
goods_sort,
|
||||
goods_total,
|
||||
goods_status,
|
||||
goods_unit_price,
|
||||
goods_unit,
|
||||
payment_type,
|
||||
goods_photos,
|
||||
goods_video,
|
||||
good_star,
|
||||
user_evaluate,
|
||||
gmt_create,
|
||||
creator,
|
||||
gmt_modified,
|
||||
modifier,
|
||||
is_delete
|
||||
) VALUES(
|
||||
#{goodsId},
|
||||
#{goodsName},
|
||||
#{goodsSummary},
|
||||
#{goodsIcon},
|
||||
#{shopId},
|
||||
#{categoryId},
|
||||
#{goodsSort},
|
||||
#{goodsTotal},
|
||||
#{goodsStatus},
|
||||
#{goodsUnitPrice},
|
||||
#{goodsUnit},
|
||||
#{paymentType},
|
||||
#{goodsPhotos},
|
||||
#{goodsVideo},
|
||||
#{goodStar},
|
||||
#{userEvaluate},
|
||||
#{gmtCreate},
|
||||
#{creator},
|
||||
#{gmtModified},
|
||||
#{modifier},
|
||||
#{isDelete}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 删除 -->
|
||||
<update id="remove" parameterType="map">
|
||||
UPDATE
|
||||
svc_shop_goods
|
||||
SET
|
||||
gmt_modified = #{gmtModified},
|
||||
modifier = #{modifier},
|
||||
is_delete = 1
|
||||
WHERE
|
||||
<!-- 添加条件 -->
|
||||
</update>
|
||||
|
||||
<!-- 删除(物理) -->
|
||||
<update id="delete" parameterType="map">
|
||||
DELETE FROM
|
||||
svc_shop_goods
|
||||
WHERE
|
||||
<!-- 添加条件 -->
|
||||
</update>
|
||||
|
||||
<!-- 修改 -->
|
||||
<update id="update" parameterType="map">
|
||||
UPDATE
|
||||
svc_shop_goods
|
||||
SET
|
||||
<if test="goodsId != null and goodsId != ''">
|
||||
goods_id = #{goodsId},
|
||||
</if>
|
||||
<if test="goodsName != null and goodsName != ''">
|
||||
goods_name = #{goodsName},
|
||||
</if>
|
||||
<if test="goodsSummary != null and goodsSummary != ''">
|
||||
goods_summary = #{goodsSummary},
|
||||
</if>
|
||||
<if test="goodsIcon != null and goodsIcon != ''">
|
||||
goods_icon = #{goodsIcon},
|
||||
</if>
|
||||
<if test="shopId != null and shopId != ''">
|
||||
shop_id = #{shopId},
|
||||
</if>
|
||||
<if test="categoryId != null and categoryId != ''">
|
||||
category_id = #{categoryId},
|
||||
</if>
|
||||
<if test="goodsSort != null">
|
||||
goods_sort = #{goodsSort},
|
||||
</if>
|
||||
<if test="goodsTotal != null">
|
||||
goods_total = #{goodsTotal},
|
||||
</if>
|
||||
<if test="goodsStatus != null">
|
||||
goods_status = #{goodsStatus},
|
||||
</if>
|
||||
<if test="goodsUnitPrice != null">
|
||||
goods_unit_price = #{goodsUnitPrice},
|
||||
</if>
|
||||
<if test="goodsUnit != null and goodsUnit != ''">
|
||||
goods_unit = #{goodsUnit},
|
||||
</if>
|
||||
<if test="paymentType != null">
|
||||
payment_type = #{paymentType},
|
||||
</if>
|
||||
<if test="goodsPhotos != null and goodsPhotos != ''">
|
||||
goods_photos = #{goodsPhotos},
|
||||
</if>
|
||||
<if test="goodsVideo != null and goodsVideo != ''">
|
||||
goods_video = #{goodsVideo},
|
||||
</if>
|
||||
<if test="goodStar != null">
|
||||
good_star = #{goodStar},
|
||||
</if>
|
||||
<if test="userEvaluate != null">
|
||||
user_evaluate = #{userEvaluate},
|
||||
</if>
|
||||
<if test="gmtCreate != null and gmtCreate != ''">
|
||||
gmt_create = #{gmtCreate},
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
creator = #{creator},
|
||||
</if>
|
||||
<if test="gmtModified != null and gmtModified != ''">
|
||||
gmt_modified = #{gmtModified},
|
||||
</if>
|
||||
<if test="modifier != null and modifier != ''">
|
||||
modifier = #{modifier},
|
||||
</if>
|
||||
<if test="isDelete != null">
|
||||
is_delete = #{isDelete}
|
||||
</if>
|
||||
WHERE
|
||||
<!-- 添加条件 -->
|
||||
</update>
|
||||
|
||||
<!-- 详情 -->
|
||||
<select id="get" parameterType="map" resultMap="shopGoodsDTO">
|
||||
SELECT
|
||||
t1.goods_id,
|
||||
t1.goods_name,
|
||||
t1.goods_summary,
|
||||
t1.goods_icon,
|
||||
t1.shop_id,
|
||||
t1.category_id,
|
||||
t1.goods_sort,
|
||||
t1.goods_total,
|
||||
t1.goods_status,
|
||||
t1.goods_unit_price,
|
||||
t1.goods_unit,
|
||||
t1.payment_type,
|
||||
t1.goods_photos,
|
||||
t1.goods_video,
|
||||
t1.good_star,
|
||||
t1.user_evaluate,
|
||||
t1.gmt_create,
|
||||
t1.creator,
|
||||
t1.gmt_modified,
|
||||
t1.modifier,
|
||||
t1.is_delete,
|
||||
1
|
||||
FROM
|
||||
svc_shop_goods t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<!-- 添加条件 -->
|
||||
</select>
|
||||
|
||||
<!-- 详情 -->
|
||||
<select id="getBO" parameterType="map" resultMap="shopGoodsBO">
|
||||
SELECT
|
||||
t1.goods_id,
|
||||
t1.goods_name,
|
||||
t1.goods_summary,
|
||||
t1.goods_icon,
|
||||
t1.shop_id,
|
||||
t1.category_id,
|
||||
t1.goods_sort,
|
||||
t1.goods_total,
|
||||
t1.goods_status,
|
||||
t1.goods_unit_price,
|
||||
t1.goods_unit,
|
||||
t1.payment_type,
|
||||
t1.goods_photos,
|
||||
t1.goods_video,
|
||||
t1.good_star,
|
||||
t1.user_evaluate,
|
||||
t1.gmt_create,
|
||||
t1.creator,
|
||||
t1.gmt_modified,
|
||||
t1.modifier,
|
||||
t1.is_delete
|
||||
FROM
|
||||
svc_shop_goods t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<!-- 添加条件 -->
|
||||
</select>
|
||||
|
||||
<!-- 详情 -->
|
||||
<select id="getPO" parameterType="map" resultMap="shopGoodsPO">
|
||||
SELECT
|
||||
t1.goods_id,
|
||||
t1.goods_name,
|
||||
t1.goods_summary,
|
||||
t1.goods_icon,
|
||||
t1.shop_id,
|
||||
t1.category_id,
|
||||
t1.goods_sort,
|
||||
t1.goods_total,
|
||||
t1.goods_status,
|
||||
t1.goods_unit_price,
|
||||
t1.goods_unit,
|
||||
t1.payment_type,
|
||||
t1.goods_photos,
|
||||
t1.goods_video,
|
||||
t1.good_star,
|
||||
t1.user_evaluate,
|
||||
t1.gmt_create,
|
||||
t1.creator,
|
||||
t1.gmt_modified,
|
||||
t1.modifier,
|
||||
t1.is_delete
|
||||
FROM
|
||||
svc_shop_goods t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<!-- 添加条件 -->
|
||||
</select>
|
||||
|
||||
<!-- 列表 -->
|
||||
<select id="list" parameterType="map" resultMap="shopGoodsDTO">
|
||||
SELECT
|
||||
t1.goods_id,
|
||||
t1.goods_name,
|
||||
t1.goods_summary,
|
||||
t1.goods_icon,
|
||||
t1.shop_id,
|
||||
t1.category_id,
|
||||
t1.goods_sort,
|
||||
t1.goods_total,
|
||||
t1.goods_status,
|
||||
t1.goods_unit_price,
|
||||
t1.goods_unit,
|
||||
t1.payment_type,
|
||||
t1.goods_photos,
|
||||
t1.goods_video,
|
||||
t1.good_star,
|
||||
t1.user_evaluate,
|
||||
t1.gmt_create,
|
||||
t1.creator,
|
||||
t1.gmt_modified,
|
||||
t1.modifier,
|
||||
t1.is_delete,
|
||||
1
|
||||
FROM
|
||||
svc_shop_goods t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
<!-- 这里添加其他条件 -->
|
||||
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 列表 -->
|
||||
<select id="listBO" parameterType="map" resultMap="shopGoodsBO">
|
||||
SELECT
|
||||
t1.goods_id,
|
||||
t1.goods_name,
|
||||
t1.goods_summary,
|
||||
t1.goods_icon,
|
||||
t1.shop_id,
|
||||
t1.category_id,
|
||||
t1.goods_sort,
|
||||
t1.goods_total,
|
||||
t1.goods_status,
|
||||
t1.goods_unit_price,
|
||||
t1.goods_unit,
|
||||
t1.payment_type,
|
||||
t1.goods_photos,
|
||||
t1.goods_video,
|
||||
t1.good_star,
|
||||
t1.user_evaluate,
|
||||
t1.gmt_create,
|
||||
t1.creator,
|
||||
t1.gmt_modified,
|
||||
t1.modifier,
|
||||
t1.is_delete
|
||||
FROM
|
||||
svc_shop_goods t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
<!-- 这里添加其他条件 -->
|
||||
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 列表 -->
|
||||
<select id="listPO" parameterType="map" resultMap="shopGoodsPO">
|
||||
SELECT
|
||||
t1.goods_id,
|
||||
t1.goods_name,
|
||||
t1.goods_summary,
|
||||
t1.goods_icon,
|
||||
t1.shop_id,
|
||||
t1.category_id,
|
||||
t1.goods_sort,
|
||||
t1.goods_total,
|
||||
t1.goods_status,
|
||||
t1.goods_unit_price,
|
||||
t1.goods_unit,
|
||||
t1.payment_type,
|
||||
t1.goods_photos,
|
||||
t1.goods_video,
|
||||
t1.good_star,
|
||||
t1.user_evaluate,
|
||||
t1.gmt_create,
|
||||
t1.creator,
|
||||
t1.gmt_modified,
|
||||
t1.modifier,
|
||||
t1.is_delete
|
||||
FROM
|
||||
svc_shop_goods t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND (
|
||||
<!-- 这里添加其他条件 -->
|
||||
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 统计 -->
|
||||
<select id="count" parameterType="map" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
svc_shop_goods t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
432
src/main/resources/static/route/shopGoods/list.html
Normal file
432
src/main/resources/static/route/shopGoods/list.html
Normal file
@ -0,0 +1,432 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字">
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="startTime" class="layui-input search-item" placeholder="开始时间" readonly>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
|
||||
</div>
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
</button>
|
||||
</div>
|
||||
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||
<!-- 表头按钮组 -->
|
||||
<script type="text/html" id="headerToolBar">
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
|
||||
<i class="fa fa-lg fa-plus"></i> 新增
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
|
||||
<i class="fa fa-lg fa-edit"></i> 编辑
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
|
||||
<i class="fa fa-lg fa-trash"></i> 删除
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
index: 'lib/index'
|
||||
}).use(['index', 'table', 'laydate', 'common'], function() {
|
||||
var $ = layui.$;
|
||||
var $win = $(window);
|
||||
var table = layui.table;
|
||||
var admin = layui.admin;
|
||||
var laydate = layui.laydate;
|
||||
var common = layui.common;
|
||||
var resizeTimeout = null;
|
||||
var tableUrl = 'api/shopgoods/listpage';
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
width: admin.screen() > 1 ? '100%' : '',
|
||||
height: $win.height() - 90,
|
||||
limit: 20,
|
||||
limits: [20, 40, 60, 80, 100, 200],
|
||||
toolbar: '#headerToolBar',
|
||||
request: {
|
||||
pageName: 'page',
|
||||
limitName: 'rows'
|
||||
},
|
||||
cols: [
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{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];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'goodsSummary', width: 180, title: '商品说明', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'goodsIcon', width: 180, title: '商品LOGO', 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 += '<a href="route/file/download/false/'+ item +'" target="_blank">点击下载</a>'
|
||||
}
|
||||
return downloadFile;
|
||||
}
|
||||
},
|
||||
{field: 'shopId', 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: 'categoryId', 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: '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',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'goodsStatus', width: 180, title: '商品状态1:上架,2:下架', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'goodsUnitPrice', width: 180, title: '商品单价', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'goodsUnit', width: 180, title: '商品单位', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'paymentType', width: 180, title: '支付类型1:线上支付,2:到店支付', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
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 += '<a href="route/file/download/false/'+ item +'" target="_blank">点击下载</a>'
|
||||
}
|
||||
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 += '<a href="route/file/download/false/'+ item +'" target="_blank">点击下载</a>'
|
||||
}
|
||||
return downloadFile;
|
||||
}
|
||||
},
|
||||
{field: 'goodStar', width: 180, title: '商品星级,最高5星', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'userEvaluate', width: 180, title: '用户评价,分数,满分10分,通过用户的评价自动计算', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'gmtCreate', width: 180, title: '创建时间', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'creator', width: 180, title: '创建人', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
return '-';
|
||||
}
|
||||
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,
|
||||
parseData: function(data) {
|
||||
return {
|
||||
'code': 0,
|
||||
'msg': '',
|
||||
'count': data.total,
|
||||
'data': data.rows
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
// 重载表格
|
||||
function reloadTable(currentPage) {
|
||||
table.reload('dataTable', {
|
||||
url: top.restAjax.path(tableUrl, []),
|
||||
where: {
|
||||
keywords: $('#keywords').val(),
|
||||
startTime: $('#startTime').val(),
|
||||
endTime: $('#endTime').val()
|
||||
},
|
||||
page: {
|
||||
curr: currentPage
|
||||
},
|
||||
height: $win.height() - 90,
|
||||
});
|
||||
}
|
||||
// 初始化日期
|
||||
function initDate() {
|
||||
// 日期选择
|
||||
laydate.render({
|
||||
elem: '#startTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#endTime',
|
||||
format: 'yyyy-MM-dd'
|
||||
});
|
||||
}
|
||||
// 删除
|
||||
function removeData(ids) {
|
||||
top.dialog.msg(top.dataMessage.delete, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function (index) {
|
||||
top.dialog.close(index);
|
||||
var layIndex;
|
||||
top.restAjax.delete(top.restAjax.path('api/shopgoods/remove/{ids}', [ids]), {}, null, function (code, data) {
|
||||
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
|
||||
reloadTable();
|
||||
}, function (code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function () {
|
||||
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function () {
|
||||
top.dialog.close(layIndex);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
initTable();
|
||||
initDate();
|
||||
// 事件 - 页面变化
|
||||
$win.on('resize', function() {
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(function() {
|
||||
reloadTable();
|
||||
}, 500);
|
||||
});
|
||||
// 事件 - 搜索
|
||||
$(document).on('click', '#search', function() {
|
||||
reloadTable(1);
|
||||
});
|
||||
// 事件 - 增删改
|
||||
table.on('toolbar(dataTable)', function(obj) {
|
||||
var layEvent = obj.event;
|
||||
var checkStatus = table.checkStatus('dataTable');
|
||||
var checkDatas = checkStatus.data;
|
||||
if(layEvent === 'saveEvent') {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/shopgoods/save.html', []),
|
||||
end: function() {
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
} else if(layEvent === 'updateEvent') {
|
||||
if(checkDatas.length === 0) {
|
||||
top.dialog.msg(top.dataMessage.table.selectEdit);
|
||||
} else if(checkDatas.length > 1) {
|
||||
top.dialog.msg(top.dataMessage.table.selectOneEdit);
|
||||
} else {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['100%', '100%'],
|
||||
shadeClose: true,
|
||||
anim: 2,
|
||||
content: top.restAjax.path('route/shopgoods/update.html?shopGoodsId={shopGoodsId}', [checkDatas[0].shopGoodsId]),
|
||||
end: function() {
|
||||
reloadTable();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if(layEvent === 'removeEvent') {
|
||||
if(checkDatas.length === 0) {
|
||||
top.dialog.msg(top.dataMessage.table.selectDelete);
|
||||
} else {
|
||||
var ids = '';
|
||||
for(var i = 0, item; item = checkDatas[i++];) {
|
||||
if(i > 1) {
|
||||
ids += '_';
|
||||
}
|
||||
ids += item['shopGoodsId'];
|
||||
}
|
||||
removeData(ids);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
524
src/main/resources/static/route/shopGoods/save.html
Normal file
524
src/main/resources/static/route/shopGoods/save.html
Normal file
@ -0,0 +1,524 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
|
||||
<a href="javascript:void(0);"><cite>新增内容</cite></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品ID</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="goodsId" name="goodsId" class="layui-input" value="" placeholder="请输入商品ID" maxlength="36">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="goodsName" name="goodsName" class="layui-input" value="" placeholder="请输入商品名称" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品说明</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="goodsSummary" name="goodsSummary" class="layui-input" value="" placeholder="请输入商品说明" maxlength="500">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">商品LOGO</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="goodsIcon" name="goodsIcon">
|
||||
<div class="layui-btn-container" id="goodsIconFileBox" style="border: 1px solid #e6e6e6;"></div>
|
||||
<script id="goodsIconFileDownload" type="text/html">
|
||||
{{# var fileName = 'goodsIcon'; }}
|
||||
{{# if(d[fileName].length > 0) { }}
|
||||
{{# var files = d[fileName];}}
|
||||
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
|
||||
<div class="upload-image-box">
|
||||
<span class="upload-image-span">
|
||||
<img src="route/file/download/false/{{item.fileId}}" align="加载失败">
|
||||
</span>
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="goodsIconRemoveFile">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# } }}
|
||||
{{# if(d[fileName].length < 9) { }}
|
||||
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
|
||||
<a href="javascript:void(0);" lay-form-button data-explain="商品LOGO" data-name="goodsIcon" lay-filter="goodsIconUploadFile">
|
||||
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">店铺ID</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="shopId" name="shopId" class="layui-input" value="" placeholder="请输入店铺ID" maxlength="36">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">类目ID</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="categoryId" name="categoryId" class="layui-input" value="" placeholder="请输入类目ID" maxlength="36">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" step="0.01" id="goodsSort" name="goodsSort" class="layui-input" value="" placeholder="请输入排序" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品总数,最大9999标识不限制</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="goodsTotal" name="goodsTotal" class="layui-input" value="" placeholder="请输入商品总数,最大9999标识不限制" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品状态1:上架,2:下架</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="goodsStatus" name="goodsStatus" class="layui-input" value="" placeholder="请输入商品状态1:上架,2:下架" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品单价</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" step="0.01" id="goodsUnitPrice" name="goodsUnitPrice" class="layui-input" value="" placeholder="请输入商品单价" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品单位</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="goodsUnit" name="goodsUnit" class="layui-input" value="" placeholder="请输入商品单位" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">支付类型1:线上支付,2:到店支付</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="paymentType" name="paymentType" class="layui-input" value="" placeholder="请输入支付类型1:线上支付,2:到店支付" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">商品图片,最多9张</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="goodsPhotos" name="goodsPhotos">
|
||||
<div class="layui-btn-container" id="goodsPhotosFileBox" style="border: 1px solid #e6e6e6;"></div>
|
||||
<script id="goodsPhotosFileDownload" type="text/html">
|
||||
{{# var fileName = 'goodsPhotos'; }}
|
||||
{{# if(d[fileName].length > 0) { }}
|
||||
{{# var files = d[fileName];}}
|
||||
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
|
||||
<div class="upload-image-box">
|
||||
<span class="upload-image-span">
|
||||
<img src="route/file/download/false/{{item.fileId}}" align="加载失败">
|
||||
</span>
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="goodsPhotosRemoveFile">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# } }}
|
||||
{{# if(d[fileName].length < 9) { }}
|
||||
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
|
||||
<a href="javascript:void(0);" lay-form-button data-explain="商品图片,最多9张" data-name="goodsPhotos" lay-filter="goodsPhotosUploadFile">
|
||||
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">商品视频,最多1个</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="goodsVideo" name="goodsVideo">
|
||||
<div class="layui-btn-container" id="goodsVideoFileBox" style="border: 1px solid #e6e6e6;"></div>
|
||||
<script id="goodsVideoFileDownload" type="text/html">
|
||||
{{# var fileName = 'goodsVideo' }}
|
||||
{{# if(d[fileName] != '') { }}
|
||||
{{# var files = d[fileName];}}
|
||||
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
|
||||
<div class="upload-video-box">
|
||||
<div id="{{fileName}}{{i}}" style="width:300px; height:200px;"></div>
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-video" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="goodsVideoRemoveFile">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# } }}
|
||||
{{# if(d[fileName].length < 1) { }}
|
||||
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
|
||||
<a href="javascript:void(0);" lay-form-button data-explain="商品视频,最多1个" data-name="goodsVideo" lay-filter="goodsVideoUploadFile">
|
||||
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品星级,最高5星</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" step="0.01" id="goodStar" name="goodStar" class="layui-input" value="" placeholder="请输入商品星级,最高5星" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户评价,分数,满分10分,通过用户的评价自动计算</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" step="0.01" id="userEvaluate" name="userEvaluate" class="layui-input" value="" placeholder="请输入用户评价,分数,满分10分,通过用户的评价自动计算" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">创建时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="gmtCreate" name="gmtCreate" class="layui-input" value="" placeholder="请选择创建时间" readonly style="cursor: pointer;" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">创建人</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="creator" name="creator" class="layui-input" value="" placeholder="请输入创建人" maxlength="36">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">修改时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="gmtModified" name="gmtModified" class="layui-input" value="" placeholder="请选择修改时间" readonly style="cursor: pointer;" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">修改人</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="modifier" name="modifier" class="layui-input" value="" placeholder="请输入修改人" maxlength="36">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否删除0:是,1:否</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="isDelete" name="isDelete" class="layui-input" value="" placeholder="请输入是否删除0:是,1:否" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
|
||||
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var wangEditor = window.wangEditor;
|
||||
var wangEditorObj = {};
|
||||
var viewerObj = {};
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
function refreshDownloadTemplet(fileName, file) {
|
||||
var dataRander = {};
|
||||
dataRander[fileName] = file;
|
||||
|
||||
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
|
||||
document.getElementById(fileName +'FileBox').innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化文件列表
|
||||
function initFileList(fileName, ids, callback) {
|
||||
var dataForm = {};
|
||||
dataForm[fileName] = ids;
|
||||
form.val('dataForm', dataForm);
|
||||
|
||||
if(!ids) {
|
||||
refreshDownloadTemplet(fileName, []);
|
||||
if(callback) {
|
||||
callback(fileName, []);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
top.restAjax.get(top.restAjax.path('api/file/list', []), {
|
||||
ids: ids
|
||||
}, null, function(code, data) {
|
||||
refreshDownloadTemplet(fileName, data);
|
||||
if(callback) {
|
||||
callback(fileName, data);
|
||||
}
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化视频
|
||||
function initVideo(fileName, data) {
|
||||
for(var i = 0, item; item = data[i++];) {
|
||||
var player = new ckplayer({
|
||||
container: '#'+ fileName + i,
|
||||
variable: 'player',
|
||||
flashplayer: false,
|
||||
video: {
|
||||
file: 'route/file/download/true/'+ item.fileId,
|
||||
type: 'video/mp4'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化商品LOGO图片上传
|
||||
function initGoodsIconUploadFile() {
|
||||
var files = $('#goodsIcon').val();
|
||||
initFileList('goodsIcon', files, function(fileName) {
|
||||
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
|
||||
viewerObj[fileName] = viewer;
|
||||
});
|
||||
|
||||
form.on('button(goodsIconUploadFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var explain = this.dataset.explain;
|
||||
top.dialog.file({
|
||||
type: 'image',
|
||||
title: '上传'+ explain,
|
||||
width: '400px',
|
||||
height: '420px',
|
||||
maxFileCount: '1',
|
||||
onClose: function() {
|
||||
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||||
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||||
var files = $('#'+ name).val();
|
||||
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||||
if(files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += file.data;
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.on('button(goodsIconRemoveFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var id = this.dataset.id;
|
||||
var files = $('#'+ name).val().replace(id, '');
|
||||
files = files.replace(/\,+/g, ',');
|
||||
if(files.charAt(0) == ',') {
|
||||
files = files.substring(1);
|
||||
}
|
||||
if(files.charAt(files.length - 1) == ',') {
|
||||
files = files.substring(0, files.length - 1);
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化商品图片,最多9张图片上传
|
||||
function initGoodsPhotosUploadFile() {
|
||||
var files = $('#goodsPhotos').val();
|
||||
initFileList('goodsPhotos', files, function(fileName) {
|
||||
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
|
||||
viewerObj[fileName] = viewer;
|
||||
});
|
||||
|
||||
form.on('button(goodsPhotosUploadFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var explain = this.dataset.explain;
|
||||
top.dialog.file({
|
||||
type: 'image',
|
||||
title: '上传'+ explain,
|
||||
width: '400px',
|
||||
height: '420px',
|
||||
maxFileCount: '1',
|
||||
onClose: function() {
|
||||
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||||
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||||
var files = $('#'+ name).val();
|
||||
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||||
if(files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += file.data;
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.on('button(goodsPhotosRemoveFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var id = this.dataset.id;
|
||||
var files = $('#'+ name).val().replace(id, '');
|
||||
files = files.replace(/\,+/g, ',');
|
||||
if(files.charAt(0) == ',') {
|
||||
files = files.substring(1);
|
||||
}
|
||||
if(files.charAt(files.length - 1) == ',') {
|
||||
files = files.substring(0, files.length - 1);
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化商品视频,最多1个视频上传
|
||||
function initGoodsVideoUploadFile() {
|
||||
var files = $('#goodsVideo').val();
|
||||
initFileList('goodsVideo', files, initVideo);
|
||||
|
||||
form.on('button(goodsVideoUploadFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var explain = this.dataset.explain;
|
||||
top.dialog.file({
|
||||
type: 'video',
|
||||
title: '上传'+ explain,
|
||||
width: '400px',
|
||||
height: '420px',
|
||||
maxFileCount: '1',
|
||||
onClose: function() {
|
||||
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||||
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||||
var files = $('#'+ name).val();
|
||||
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||||
if(files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += file.data;
|
||||
}
|
||||
initFileList(name, files, initVideo);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.on('button(goodsVideoRemoveFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var id = this.dataset.id;
|
||||
var files = $('#'+ name).val().replace(id, '');
|
||||
files = files.replace(/\,+/g, ',');
|
||||
if(files.charAt(0) == ',') {
|
||||
files = files.substring(1);
|
||||
}
|
||||
if(files.charAt(files.length - 1) == ',') {
|
||||
files = files.substring(0, files.length - 1);
|
||||
}
|
||||
initFileList(name, files, initVideo);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化创建时间时间戳
|
||||
function initGmtCreateDateTime() {
|
||||
laydate.render({
|
||||
elem: '#gmtCreate',
|
||||
type: 'datetime',
|
||||
value: new Date(),
|
||||
trigger: 'click'
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化修改时间时间戳
|
||||
function initGmtModifiedDateTime() {
|
||||
laydate.render({
|
||||
elem: '#gmtModified',
|
||||
type: 'datetime',
|
||||
value: new Date(),
|
||||
trigger: 'click'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 初始化内容
|
||||
function initData() {
|
||||
initGoodsIconUploadFile();
|
||||
initGoodsPhotosUploadFile();
|
||||
initGoodsVideoUploadFile();
|
||||
initGmtCreateDateTime();
|
||||
initGmtModifiedDateTime();
|
||||
}
|
||||
initData();
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
top.restAjax.post(top.restAjax.path('api/shopgoods/save', []), formData.field, null, function(code, data) {
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function(index) {
|
||||
top.dialog.close(index);
|
||||
window.location.reload();
|
||||
},
|
||||
btn2: function() {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
// 校验
|
||||
form.verify({
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
541
src/main/resources/static/route/shopGoods/update.html
Normal file
541
src/main/resources/static/route/shopGoods/update.html
Normal file
@ -0,0 +1,541 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<base href="/usercenter/">
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
|
||||
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
|
||||
<a href="javascript:void(0);"><cite>编辑内容</cite></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="layui-card-body" style="padding: 15px;">
|
||||
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品ID</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="goodsId" name="goodsId" class="layui-input" value="" placeholder="请输入商品ID" maxlength="36">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="goodsName" name="goodsName" class="layui-input" value="" placeholder="请输入商品名称" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品说明</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="goodsSummary" name="goodsSummary" class="layui-input" value="" placeholder="请输入商品说明" maxlength="500">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">商品LOGO</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="goodsIcon" name="goodsIcon">
|
||||
<div class="layui-btn-container" id="goodsIconFileBox" style="border: 1px solid #e6e6e6;"></div>
|
||||
<script id="goodsIconFileDownload" type="text/html">
|
||||
{{# var fileName = 'goodsIcon'; }}
|
||||
{{# if(d[fileName].length > 0) { }}
|
||||
{{# var files = d[fileName];}}
|
||||
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
|
||||
<div class="upload-image-box">
|
||||
<span class="upload-image-span">
|
||||
<img src="route/file/download/false/{{item.fileId}}" align="加载失败">
|
||||
</span>
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="goodsIconRemoveFile">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# } }}
|
||||
{{# if(d[fileName].length < 9) { }}
|
||||
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
|
||||
<a href="javascript:void(0);" lay-form-button data-explain="商品LOGO" data-name="goodsIcon" lay-filter="goodsIconUploadFile">
|
||||
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">店铺ID</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="shopId" name="shopId" class="layui-input" value="" placeholder="请输入店铺ID" maxlength="36">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">类目ID</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="categoryId" name="categoryId" class="layui-input" value="" placeholder="请输入类目ID" maxlength="36">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" step="0.01" id="goodsSort" name="goodsSort" class="layui-input" value="" placeholder="请输入排序" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品总数,最大9999标识不限制</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="goodsTotal" name="goodsTotal" class="layui-input" value="" placeholder="请输入商品总数,最大9999标识不限制" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品状态1:上架,2:下架</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="goodsStatus" name="goodsStatus" class="layui-input" value="" placeholder="请输入商品状态1:上架,2:下架" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品单价</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" step="0.01" id="goodsUnitPrice" name="goodsUnitPrice" class="layui-input" value="" placeholder="请输入商品单价" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品单位</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="goodsUnit" name="goodsUnit" class="layui-input" value="" placeholder="请输入商品单位" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">支付类型1:线上支付,2:到店支付</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="paymentType" name="paymentType" class="layui-input" value="" placeholder="请输入支付类型1:线上支付,2:到店支付" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">商品图片,最多9张</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="goodsPhotos" name="goodsPhotos">
|
||||
<div class="layui-btn-container" id="goodsPhotosFileBox" style="border: 1px solid #e6e6e6;"></div>
|
||||
<script id="goodsPhotosFileDownload" type="text/html">
|
||||
{{# var fileName = 'goodsPhotos'; }}
|
||||
{{# if(d[fileName].length > 0) { }}
|
||||
{{# var files = d[fileName];}}
|
||||
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
|
||||
<div class="upload-image-box">
|
||||
<span class="upload-image-span">
|
||||
<img src="route/file/download/false/{{item.fileId}}" align="加载失败">
|
||||
</span>
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="goodsPhotosRemoveFile">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# } }}
|
||||
{{# if(d[fileName].length < 9) { }}
|
||||
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
|
||||
<a href="javascript:void(0);" lay-form-button data-explain="商品图片,最多9张" data-name="goodsPhotos" lay-filter="goodsPhotosUploadFile">
|
||||
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">商品视频,最多1个</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" id="goodsVideo" name="goodsVideo">
|
||||
<div class="layui-btn-container" id="goodsVideoFileBox" style="border: 1px solid #e6e6e6;"></div>
|
||||
<script id="goodsVideoFileDownload" type="text/html">
|
||||
{{# var fileName = 'goodsVideo' }}
|
||||
{{# if(d[fileName] != '') { }}
|
||||
{{# var files = d[fileName];}}
|
||||
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
|
||||
<div class="upload-video-box">
|
||||
<div id="{{fileName}}{{i}}" style="width:300px; height:200px;"></div>
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-video" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="goodsVideoRemoveFile">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
{{# } }}
|
||||
{{# if(d[fileName].length < 1) { }}
|
||||
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
|
||||
<a href="javascript:void(0);" lay-form-button data-explain="商品视频,最多1个" data-name="goodsVideo" lay-filter="goodsVideoUploadFile">
|
||||
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商品星级,最高5星</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" step="0.01" id="goodStar" name="goodStar" class="layui-input" value="" placeholder="请输入商品星级,最高5星" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户评价,分数,满分10分,通过用户的评价自动计算</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" step="0.01" id="userEvaluate" name="userEvaluate" class="layui-input" value="" placeholder="请输入用户评价,分数,满分10分,通过用户的评价自动计算" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">创建时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="gmtCreate" name="gmtCreate" class="layui-input" value="" placeholder="请选择创建时间" lay-verify="required" readonly style="cursor: pointer;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">创建人</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="creator" name="creator" class="layui-input" value="" placeholder="请输入创建人" maxlength="36">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">修改时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="gmtModified" name="gmtModified" class="layui-input" value="" placeholder="请选择修改时间" lay-verify="required" readonly style="cursor: pointer;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">修改人</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="modifier" name="modifier" class="layui-input" value="" placeholder="请输入修改人" maxlength="36">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否删除0:是,1:否</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" id="isDelete" name="isDelete" class="layui-input" value="" placeholder="请输入是否删除0:是,1:否" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交编辑</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
|
||||
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
|
||||
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||
}).extend({
|
||||
index: 'lib/index' //主入口模块
|
||||
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||
var $ = layui.$;
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var shopGoodsId = top.restAjax.params(window.location.href).shopGoodsId;
|
||||
|
||||
var wangEditor = window.wangEditor;
|
||||
var wangEditorObj = {};
|
||||
var viewerObj = {};
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
}
|
||||
|
||||
function refreshDownloadTemplet(fileName, file) {
|
||||
var dataRander = {};
|
||||
dataRander[fileName] = file;
|
||||
|
||||
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
|
||||
document.getElementById(fileName +'FileBox').innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化文件列表
|
||||
function initFileList(fileName, ids, callback) {
|
||||
var dataForm = {};
|
||||
dataForm[fileName] = ids;
|
||||
form.val('dataForm', dataForm);
|
||||
|
||||
if(!ids) {
|
||||
refreshDownloadTemplet(fileName, []);
|
||||
if(callback) {
|
||||
callback(fileName, []);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
top.restAjax.get(top.restAjax.path('api/file/list', []), {
|
||||
ids: ids
|
||||
}, null, function(code, data) {
|
||||
refreshDownloadTemplet(fileName, data);
|
||||
if(callback) {
|
||||
callback(fileName, data);
|
||||
}
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化视频
|
||||
function initVideo(fileName, data) {
|
||||
for(var i = 0, item; item = data[i++];) {
|
||||
var player = new ckplayer({
|
||||
container: '#'+ fileName + i,
|
||||
variable: 'player',
|
||||
flashplayer: false,
|
||||
video: {
|
||||
file: 'route/file/download/true/'+ item.fileId,
|
||||
type: 'video/mp4'
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化商品LOGO图片上传
|
||||
function initGoodsIconUploadFile() {
|
||||
var files = $('#goodsIcon').val();
|
||||
initFileList('goodsIcon', files, function(fileName) {
|
||||
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
|
||||
viewerObj[fileName] = viewer;
|
||||
});
|
||||
|
||||
form.on('button(goodsIconUploadFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var explain = this.dataset.explain;
|
||||
top.dialog.file({
|
||||
type: 'image',
|
||||
title: '上传'+ explain,
|
||||
width: '400px',
|
||||
height: '420px',
|
||||
maxFileCount: '1',
|
||||
onClose: function() {
|
||||
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||||
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||||
var files = $('#'+ name).val();
|
||||
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||||
if(files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += file.data;
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.on('button(goodsIconRemoveFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var id = this.dataset.id;
|
||||
var files = $('#'+ name).val().replace(id, '');
|
||||
files = files.replace(/\,+/g, ',');
|
||||
if(files.charAt(0) == ',') {
|
||||
files = files.substring(1);
|
||||
}
|
||||
if(files.charAt(files.length - 1) == ',') {
|
||||
files = files.substring(0, files.length - 1);
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化商品图片,最多9张图片上传
|
||||
function initGoodsPhotosUploadFile() {
|
||||
var files = $('#goodsPhotos').val();
|
||||
initFileList('goodsPhotos', files, function(fileName) {
|
||||
var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false});
|
||||
viewerObj[fileName] = viewer;
|
||||
});
|
||||
|
||||
form.on('button(goodsPhotosUploadFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var explain = this.dataset.explain;
|
||||
top.dialog.file({
|
||||
type: 'image',
|
||||
title: '上传'+ explain,
|
||||
width: '400px',
|
||||
height: '420px',
|
||||
maxFileCount: '1',
|
||||
onClose: function() {
|
||||
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||||
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||||
var files = $('#'+ name).val();
|
||||
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||||
if(files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += file.data;
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.on('button(goodsPhotosRemoveFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var id = this.dataset.id;
|
||||
var files = $('#'+ name).val().replace(id, '');
|
||||
files = files.replace(/\,+/g, ',');
|
||||
if(files.charAt(0) == ',') {
|
||||
files = files.substring(1);
|
||||
}
|
||||
if(files.charAt(files.length - 1) == ',') {
|
||||
files = files.substring(0, files.length - 1);
|
||||
}
|
||||
initFileList(name, files, function(fileName) {
|
||||
viewerObj[fileName].update();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化商品视频,最多1个视频上传
|
||||
function initGoodsVideoUploadFile() {
|
||||
var files = $('#goodsVideo').val();
|
||||
initFileList('goodsVideo', files, initVideo);
|
||||
|
||||
form.on('button(goodsVideoUploadFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var explain = this.dataset.explain;
|
||||
top.dialog.file({
|
||||
type: 'video',
|
||||
title: '上传'+ explain,
|
||||
width: '400px',
|
||||
height: '420px',
|
||||
maxFileCount: '1',
|
||||
onClose: function() {
|
||||
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
|
||||
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
|
||||
var files = $('#'+ name).val();
|
||||
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
|
||||
if(files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += file.data;
|
||||
}
|
||||
initFileList(name, files, initVideo);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
form.on('button(goodsVideoRemoveFile)', function(obj) {
|
||||
var name = this.dataset.name;
|
||||
var id = this.dataset.id;
|
||||
var files = $('#'+ name).val().replace(id, '');
|
||||
files = files.replace(/\,+/g, ',');
|
||||
if(files.charAt(0) == ',') {
|
||||
files = files.substring(1);
|
||||
}
|
||||
if(files.charAt(files.length - 1) == ',') {
|
||||
files = files.substring(0, files.length - 1);
|
||||
}
|
||||
initFileList(name, files, initVideo);
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化创建时间时间戳
|
||||
function initGmtCreateDateTime() {
|
||||
laydate.render({
|
||||
elem: '#gmtCreate',
|
||||
type: 'datetime',
|
||||
value: new Date(),
|
||||
trigger: 'click'
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化修改时间时间戳
|
||||
function initGmtModifiedDateTime() {
|
||||
laydate.render({
|
||||
elem: '#gmtModified',
|
||||
type: 'datetime',
|
||||
value: new Date(),
|
||||
trigger: 'click'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 初始化内容
|
||||
function initData() {
|
||||
var loadLayerIndex;
|
||||
top.restAjax.get(top.restAjax.path('api/shopgoods/get/{shopGoodsId}', [shopGoodsId]), {}, null, function(code, data) {
|
||||
var dataFormData = {};
|
||||
for(var i in data) {
|
||||
dataFormData[i] = data[i] +'';
|
||||
}
|
||||
form.val('dataForm', dataFormData);
|
||||
form.render(null, 'dataForm');
|
||||
initGoodsIconUploadFile();
|
||||
initGoodsPhotosUploadFile();
|
||||
initGoodsVideoUploadFile();
|
||||
initGmtCreateDateTime();
|
||||
initGmtModifiedDateTime();
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
initData();
|
||||
|
||||
// 提交表单
|
||||
form.on('submit(submitForm)', function(formData) {
|
||||
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) {
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function(index) {
|
||||
top.dialog.close(index);
|
||||
window.location.reload();
|
||||
},
|
||||
btn2: function() {
|
||||
closeBox();
|
||||
}
|
||||
});
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.close').on('click', function() {
|
||||
closeBox();
|
||||
});
|
||||
|
||||
// 校验
|
||||
form.verify({
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user