Authored by caoyan

Merge branch 'master' of http://git.yoho.cn/ufo/ufo-platform

Showing 27 changed files with 177 additions and 150 deletions
... ... @@ -24,7 +24,7 @@
<dependencies>
<dependency>
<groupId>com.yoho.ufo.model</groupId>
<artifactId>product-service-model</artifactId>
<artifactId>product-ufo-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
... ...
package com.yoho.ufo.dal;
import com.yoho.ufo.model.commoditybasicrole.category.ProductSort;
import com.yohobuy.ufo.model.common.PageModel;
import org.apache.ibatis.annotations.Param;
import java.util.List;
... ... @@ -48,13 +47,12 @@ public interface ProductSortMapper {
ProductSort selectOneById(Integer id);
/**
* 根据条件查询品类分页数据
* 根据条件查询品类数据
*
* @param productSort
* @param pageModel
* @return
*/
List<ProductSort> getProductSortPageList(@Param("productSort") ProductSort productSort, @Param("page") PageModel pageModel);
List<ProductSort> getProductSortList(@Param("productSort") ProductSort productSort);
/**
* 更新品类状态
... ...
... ... @@ -36,11 +36,4 @@ public interface UfoProductDetailsMapper {
List<ProductDetails> getProductDetailsPageList(@Param("productDetails") ProductDetails productDetails, @Param("page") PageModel pageModel);
/**
* 根据主键逻辑删除商品信息
* @param id
* @return
*/
int deleteProductById(Integer id);
}
... ...
... ... @@ -23,14 +23,6 @@ public interface UfoProductPoolDetailMapper {
int deleteProductPoolDetailsByPoolId(Integer poolId);
/**
* 根据条件查询商品池详情数量
*
* @param productPoolDetails
* @return
*/
int selectProductPoolDetailsCount(@Param("productPoolDetails") ProductPoolDetails productPoolDetails);
/**
* 批量插入商品池详情数据
... ... @@ -39,16 +31,6 @@ public interface UfoProductPoolDetailMapper {
*/
int batchInsertProductPoolDetails(List<ProductPoolDetails> productPoolDetails);
/**
* 根据条件查询商品池详情分页数据
*
* @param productPoolDetails
* @param pageModel
* @return
*/
List<ProductPoolDetails> getProductPoolDetailsPageList(@Param("productPoolDetails") ProductPoolDetails productPoolDetails, @Param("page") PageModel pageModel);
/**
* 根据商品池id和商品id物理删除商品池和商品关联表数据
* @param productPoolId
... ...
... ... @@ -56,4 +56,11 @@ public interface UfoSizeMapper {
* @return
*/
List<Size> getSizePageList(@Param("size") Size size, @Param("page") PageModel pageModel);
/**
* 根据品类查询所有的尺码
* @param sortId
* @return
*/
List<Size> selectAllSizeBySortId(@Param("sortId") Integer sortId);
}
... ...
... ... @@ -28,6 +28,7 @@
<update id="updateProductSort">
update product_sort
<set>
level = #{productSort.level},
<if test="productSort.sortName != null and productSort.sortName !=''">
sort_name = #{productSort.sortName},
</if>
... ... @@ -71,16 +72,19 @@
<include refid="queryPage"/>
</select>
<select id="getProductSortPageList" resultMap="productSortMap">
<select id="getProductSortList" resultMap="productSortMap">
select <include refid="queryColumns"/>
from product_sort
<include refid="queryPage"/>
order by update_time desc
limit #{page.startIndex}, #{page.pageSize}
</select>
<update id="updateProductSortStatus" parameterType="com.yoho.ufo.model.commoditybasicrole.category.ProductSort">
update product_sort set status = #{status}, update_time = #{updateTime} where id = #{id}
update product_sort set status = #{status}, update_time = #{updateTime}
where id = #{id}
<if test="parentId == null or parentId == 0">
or parent_id = #{id}
</if>
</update>
<select id="getAllProcutSort" resultMap="productSortMap">
... ...
... ... @@ -26,15 +26,13 @@
<update id="updateProductColor" parameterType="com.yoho.ufo.model.commoditybasicrole.color.ProductColor">
update product_color
<set>
color_value = #{productColor.colorValue},
<if test="productColor.colorName != null and productColor.colorName !=''">
color_name = #{productColor.colorName},
</if>
<if test="productColor.colorCode != null and productColor.colorCode != ''">
color_code = #{productColor.colorCode},
</if>
<if test="productColor.colorValue != null and productColor.colorValue != ''">
color_value = #{productColor.colorValue},
</if>
<if test="productColor.createTime != null">
create_time = #{productColor.createTime},
</if>
... ...
... ... @@ -6,7 +6,7 @@
</resultMap>
<sql id="queryColumns">
product.id, product.product_code, product.product_name, product.product_code, brand.brand_name, product_sort.sort_name, product.del_status
product.id, product.product_code, product.product_name, product.product_code, brand.brand_name, CONCAT(IFNULL(CONCAT(sort2.sort_name,'/'),''),sort1.sort_name) AS sortName, product.del_status
</sql>
<select id="queryProductIdsByProductIds" parameterType="java.util.Set" resultType="integer">
... ... @@ -18,18 +18,18 @@
</select>
<sql id="queryParam">
WHERE product.del_status=0 and pool_detail.pool_id = #{productDetails.poolId}
WHERE pool_detail.pool_id = #{productDetails.poolId}
<if test="productDetails.productCode != null and productDetails.productCode != ''">
and product.product_code like concat('%',#{productDetails.productCode}, '%')
</if>
<if test="productDetails.productName != null and productDetails.productName != ''">
and pool.pool_name like concat('%', #{productDetails.productName}, '%')
and product.product_name like concat('%', #{productDetails.productName}, '%')
</if>
<if test="productDetails.brandName != null and productDetails.brandName != ''">
and brand.brand_name like concat('%', #{productDetails.brandName}, '%')
</if>
<if test="productDetails.sortName != null and productDetails.sortName != ''">
and product_sort.sort_name like concat('%', #{productDetails.sortName}, '%')
and sort1.sort_name like concat('%', #{productDetails.sortName}, '%')
</if>
</sql>
... ... @@ -41,8 +41,10 @@
ON pool_detail.product_id = product.id
LEFT JOIN brand
ON product.brand_id = brand.id
LEFT JOIN product_sort
ON product.series_id = product_sort.id
LEFT JOIN product_sort sort1
ON product.series_id = sort1.id
LEFT JOIN product_sort sort2
ON sort1.parent_id=sort2.id
</sql>
<select id="selectProductDetailsCount" resultType="integer">
... ... @@ -58,7 +60,4 @@
limit #{page.startIndex}, #{page.pageSize}
</select>
<update id="deleteProductById">
update product set del_status = 1, update_time = UNIX_TIMESTAMP(NOW()) where id = #{id}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -9,46 +9,6 @@
product.id, product.product_code, product.product_name, product.product_code, brand.brand_name, product_sort.sort_name
</sql>
<sql id="queryParam">
WHERE product.del_status=0
<if test="productPoolDetails.productCode != null and productPoolDetails.productCode != ''">
and product.product_code like concat('%',#{productPoolDetails.productCode}, '%')
</if>
<if test="productPoolDetails.productName != null and productPoolDetails.productName != ''">
and pool.pool_name like concat('%', #{productPoolDetails.productName}, '%')
</if>
<if test="productPoolDetails.brandName != null and productPoolDetails.brandName != ''">
and brand.brand_name like concat('%', #{productPoolDetails.brandName}, '%')
</if>
<if test="productPoolDetails.sortName != null and productPoolDetails.sortName != ''">
and product_sort.sort_name like concat('%', #{productPoolDetails.sortName}, '%')
</if>
</sql>
<sql id="queryTable">
FROM product_pool pool
LEFT JOIN product_pool_detail pool_detail
ON pool.id = pool_detail.pool_id
LEFT JOIN product
ON pool_detail.product_id = product.id
LEFT JOIN brand
ON product.brand_id = brand.id
LEFT JOIN product_sort
ON product.series_id = product_sort.id
</sql>
<select id="selectProductPoolDetailsCount" resultType="integer">
SELECT COUNT(*)
<include refid="queryTable"/>
<include refid="queryParam"/>
</select>
<select id="getProductPoolDetailsPageList" resultMap="productPoolDetails">
select <include refid="queryColumns"/>
<include refid="queryTable"/>
<include refid="queryParam"/>
limit #{page.startIndex}, #{page.pageSize}
</select>
<insert id="batchInsertProductPoolDetails" parameterType="list">
... ...
... ... @@ -78,4 +78,9 @@
limit #{page.startIndex}, #{page.pageSize}
</select>
<select id="selectAllSizeBySortId" resultMap="sizeMap">
select <include refid="queryColumns"/>
from size where sort_id = #{sortId}
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -5,7 +5,7 @@ import com.yoho.ufo.util.OvalValidationUtils;
import com.yohobuy.ufo.model.common.ApiResponse;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.request.productcolor.ProductColorRequestBo;
import com.yohobuy.ufo.model.request.productcolor.ProductColorResponsetBo;
import com.yohobuy.ufo.model.response.productcolor.ProductColorResponsetBo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ...
... ... @@ -5,8 +5,7 @@ import com.yoho.ufo.exception.CommonException;
import com.yoho.ufo.service.IProductSortService;
import com.yoho.ufo.util.OvalValidationUtils;
import com.yohobuy.ufo.model.common.ApiResponse;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.req.productsort.ProductSortRequestBo;
import com.yohobuy.ufo.model.request.productsort.ProductSortRequestBo;
import com.yohobuy.ufo.model.response.productsort.ProductSortResponseBo;
import com.yohobuy.ufo.model.response.productsort.ProductSortTreeViewResponseBo;
import org.slf4j.Logger;
... ... @@ -58,10 +57,10 @@ public class ProductSortController {
}
@RequestMapping(value = "/getProductSortPageList", method = RequestMethod.POST)
public ApiResponse<PageResponseBO<ProductSortTreeViewResponseBo>> getProductSortPageList(ProductSortRequestBo productSortRequestBo) {
@RequestMapping(value = "/getProductSortList", method = RequestMethod.POST)
public ApiResponse<List<ProductSortTreeViewResponseBo>> getProductSortList(ProductSortRequestBo productSortRequestBo) {
LOGGER.info("getProductSortPageList param = {}", productSortRequestBo);
return new ApiResponse<>(productSortService.getProductSortPageList(productSortRequestBo));
return new ApiResponse<>(productSortService.getProductSortList(productSortRequestBo));
}
@RequestMapping(value = "/updateProductSortStatus", method = RequestMethod.POST)
... ...
... ... @@ -49,4 +49,10 @@ public class SizeController {
LOGGER.info("getSizePageList param = {}", sizeRequestBo);
return new ApiResponse<>(sizeService.getSizePageList(sizeRequestBo));
}
@RequestMapping(value = "/queryAllSize4Goods", method = RequestMethod.GET)
public ApiResponse<Object> queryAllSize4Goods(Integer sortId) {
LOGGER.info("queryAllSize4Goods method in.");
return new ApiResponse<>(sizeService.queryAllSize4Goods(sortId));
}
}
... ...
... ... @@ -26,6 +26,13 @@ public class ProductPoolDetailsController {
@Resource
private IProductPoolDetailsService productPoolDetailsService;
/**
* 商品池详情删除功能,只删除商品池和商品的关联表数据(product_pool_detail)
*
* @param productId
* @param poolId
* @return
*/
@RequestMapping(value = "/deleteProductById", method = RequestMethod.POST)
public ApiResponse<Void> deleteProductById(Integer productId, Integer poolId) {
LOGGER.info("deleteProductById param productId = {}, productPoolId = {}", productId, poolId);
... ...
... ... @@ -2,7 +2,7 @@ package com.yoho.ufo.service;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.request.productcolor.ProductColorRequestBo;
import com.yohobuy.ufo.model.request.productcolor.ProductColorResponsetBo;
import com.yohobuy.ufo.model.response.productcolor.ProductColorResponsetBo;
/**
* 品类接口
... ...
... ... @@ -2,8 +2,7 @@ package com.yoho.ufo.service;
import com.alibaba.fastjson.JSONObject;
import com.yoho.ufo.model.commoditybasicrole.category.ProductSort;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.req.productsort.ProductSortRequestBo;
import com.yohobuy.ufo.model.request.productsort.ProductSortRequestBo;
import com.yohobuy.ufo.model.response.productsort.ProductSortResponseBo;
import com.yohobuy.ufo.model.response.productsort.ProductSortTreeViewResponseBo;
... ... @@ -31,11 +30,11 @@ public interface IProductSortService {
ProductSortResponseBo getProductSortById(Integer id);
/**
* 根据条件获取品类分页信息
* 根据条件获取品类信息
* @param productSortRequestBo
* @return
*/
PageResponseBO<ProductSortTreeViewResponseBo> getProductSortPageList(ProductSortRequestBo productSortRequestBo);
List<ProductSortTreeViewResponseBo> getProductSortList(ProductSortRequestBo productSortRequestBo);
/**
* 更新品类状态
... ...
package com.yoho.ufo.service;
import com.alibaba.fastjson.JSONObject;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.request.productcolor.ProductColorRequestBo;
import com.yohobuy.ufo.model.request.productcolor.ProductColorResponsetBo;
import com.yohobuy.ufo.model.request.size.SizeRequestBo;
import com.yohobuy.ufo.model.request.size.SizeResponseBo;
import java.util.List;
/**
* 品类接口
* @author kun.wang
... ... @@ -34,4 +35,9 @@ public interface ISizeService {
*/
PageResponseBO<SizeResponseBo> getSizePageList(SizeRequestBo sizeRequestBo);
/**
* 查询所有的颜色,下拉框使用
* @return
*/
List<JSONObject> queryAllSize4Goods(Integer sortId);
}
... ...
... ... @@ -8,7 +8,8 @@ import com.yoho.ufo.util.OrikaUtils;
import com.yohobuy.ufo.model.common.PageModel;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.request.productcolor.ProductColorRequestBo;
import com.yohobuy.ufo.model.request.productcolor.ProductColorResponsetBo;
import com.yohobuy.ufo.model.response.productcolor.ProductColorResponsetBo;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -39,6 +40,9 @@ public class ProductColorServiceImpl implements IProductColorService {
return ufoProductColorMapper.insertProductColor(productColor);
} else {
// 更新
if (productColor.getColorValue() == null) {
productColor.setColorValue(StringUtils.EMPTY);
}
productColor.setUpdateTime(DateUtil.currentTimeSeconds());
return ufoProductColorMapper.updateProductColor(productColor);
}
... ...
... ... @@ -13,7 +13,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
... ... @@ -49,11 +48,9 @@ public class ProductPoolDetailsServiceImpl implements IProductPoolDetailsService
return new PageResponseBO<>(count, responseBos, pageModel.getCurrentPage(), pageModel.getPageSize());
}
@Transactional(rollbackFor = Exception.class)
@Override
public int deleteProductById(Integer productId, Integer productPoolId) {
LOGGER.info("deleteProductById productId = {}, productPoolId = {}", productId, productPoolId);
ufoProductPoolDetailMapper.deleteProductPoolDetail(productPoolId, productId);
return ufoProductDetailsMapper.deleteProductById(productId);
return ufoProductPoolDetailMapper.deleteProductPoolDetail(productPoolId, productId);
}
}
... ...
package com.yoho.ufo.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.ufo.dal.ProductSortMapper;
import com.yoho.ufo.exception.CommonException;
import com.yoho.ufo.model.commoditybasicrole.category.ProductSort;
import com.yoho.ufo.service.IProductSortService;
import com.yoho.ufo.util.OrikaUtils;
import com.yohobuy.ufo.model.common.PageModel;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.req.productsort.ProductSortRequestBo;
import com.yohobuy.ufo.model.request.productsort.ProductSortRequestBo;
import com.yohobuy.ufo.model.response.productsort.ProductSortResponseBo;
import com.yohobuy.ufo.model.response.productsort.ProductSortTreeViewResponseBo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -29,6 +29,17 @@ import java.util.List;
@Service
public class ProductSortServiceImpl implements IProductSortService {
/**
* 一级层级
*/
private static final Integer PRODUCT_SORT_LEVEL_1 = 1;
/**
* 顶级id
*/
private static final Integer TOP_PARENT_ID = 0;
private static final Logger LOGGER = LoggerFactory.getLogger(ProductSortServiceImpl.class);
@Autowired
... ... @@ -42,8 +53,8 @@ public class ProductSortServiceImpl implements IProductSortService {
// 新增
if (productSort.getParentId() == null || productSort.getParentId() == 0) {
// 一级层级
productSort.setLevel(1);
productSort.setParentId(0);
productSort.setLevel(PRODUCT_SORT_LEVEL_1);
productSort.setParentId(TOP_PARENT_ID);
}
productSort.setStatus(0);
productSort.setCreateTime(DateUtil.currentTimeSeconds());
... ... @@ -51,10 +62,14 @@ public class ProductSortServiceImpl implements IProductSortService {
return productSortMapper.insertProductSort(productSort);
} else {
// 更新
if (productSort.getLevel() == 1 && (productSort.getParentId() != null)) {
if (PRODUCT_SORT_LEVEL_1.equals(productSort.getLevel()) && (productSort.getParentId() != null)) {
// 一级不允许修改为二级
throw new CommonException(201, "一级品类不能修改为二级品类!");
}
if (productSort.getParentId() == null) {
productSort.setLevel(PRODUCT_SORT_LEVEL_1);
productSort.setParentId(0);
}
productSort.setUpdateTime(DateUtil.currentTimeSeconds());
return productSortMapper.updateProductSort(productSort);
}
... ... @@ -67,38 +82,54 @@ public class ProductSortServiceImpl implements IProductSortService {
}
@Override
public PageResponseBO<ProductSortTreeViewResponseBo> getProductSortPageList(ProductSortRequestBo productSortRequestBo) {
public List<ProductSortTreeViewResponseBo> getProductSortList(ProductSortRequestBo productSortRequestBo) {
LOGGER.info("getProductSortPageList param = {}", productSortRequestBo);
ProductSort productSort = OrikaUtils.map(productSortRequestBo, ProductSort.class);
PageModel pageModel = productSortRequestBo.toPageModel();
int count = productSortMapper.selectProductSortCount(productSort);
if (count == 0) {
LOGGER.warn("getProductSortPageList count is 0. param = {}", productSortRequestBo);
return new PageResponseBO<>();
return Lists.newArrayList();
}
List<ProductSort> productSorts = productSortMapper.getProductSortPageList(productSort, pageModel);
List<ProductSort> productSorts = productSortMapper.getProductSortList(productSort);
List<ProductSortTreeViewResponseBo> responseBos = new ArrayList<>();
ProductSortTreeViewResponseBo productSortTreeViewResponseBo;
processResult(productSorts, responseBos);
return responseBos;
}
private void processResult(List<ProductSort> productSorts, List<ProductSortTreeViewResponseBo> responseBos) {
Iterator<ProductSort> iterator = productSorts.iterator();
// 挑选出一级分类
while (iterator.hasNext()) {
ProductSort productSort1 = iterator.next();
if (productSort1.getLevel() == 1 && productSort1.getParentId() == 0) {
productSortTreeViewResponseBo = OrikaUtils.map(productSort1, ProductSortTreeViewResponseBo.class);
responseBos.add(productSortTreeViewResponseBo);
if (PRODUCT_SORT_LEVEL_1.equals(productSort1.getLevel()) && TOP_PARENT_ID.equals(productSort1.getParentId())) {
responseBos.add(OrikaUtils.map(productSort1, ProductSortTreeViewResponseBo.class));
iterator.remove();
}
}
iterator = productSorts.iterator();
for (ProductSortTreeViewResponseBo treeViewResponseBo : responseBos) {
iterator = productSorts.iterator();
while (iterator.hasNext()) {
ProductSort productSort1 = iterator.next();
// 找出该一级分类下的二级分类
if (treeViewResponseBo.getId().equals(productSort1.getParentId())) {
treeViewResponseBo.getChildren().add(OrikaUtils.map(productSort1, ProductSortTreeViewResponseBo.class));
List<ProductSortTreeViewResponseBo> children = treeViewResponseBo.getChildren();
if (children == null) {
children = new ArrayList<>();
}
ProductSortTreeViewResponseBo treeViewResponseBo1 = OrikaUtils.map(productSort1, ProductSortTreeViewResponseBo.class);
treeViewResponseBo1.setState(StringUtils.EMPTY);
children.add(treeViewResponseBo1);
treeViewResponseBo.setChildren(children);
iterator.remove();
}
}
}
return new PageResponseBO<>(count, responseBos, pageModel.getCurrentPage(), pageModel.getPageSize());
// 处理一下一级分类下没有二级分类的state,把state值改为空字符串
for (ProductSortTreeViewResponseBo treeViewResponseBo : responseBos) {
if (CollectionUtils.isEmpty(treeViewResponseBo.getChildren())) {
treeViewResponseBo.setState(StringUtils.EMPTY);
}
}
}
@Override
... ...
package com.yoho.ufo.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.ufo.dal.UfoSizeMapper;
import com.yoho.ufo.model.brand.BrandSeries;
import com.yoho.ufo.model.commoditybasicrole.size.Size;
import com.yoho.ufo.service.ISizeService;
import com.yoho.ufo.util.OrikaUtils;
... ... @@ -14,6 +16,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
... ... @@ -64,4 +67,22 @@ public class SizeServiceImpl implements ISizeService {
List<SizeResponseBo> responseBos = OrikaUtils.mapToList(sizeList, SizeResponseBo.class);
return new PageResponseBO<>(count, responseBos, pageModel.getCurrentPage(), pageModel.getPageSize());
}
/**
* 查询所有的颜色,下拉框使用
* @return
*/
public List<JSONObject> queryAllSize4Goods(Integer sortId) {
// TODO 可以添加缓存
List<Size> sizes = ufoSizeMapper.selectAllSizeBySortId(sortId);
List<JSONObject> result = new ArrayList<>();
JSONObject jsonObject;
for (Size item : sizes) {
jsonObject = new JSONObject();
jsonObject.put("id", item.getId());
jsonObject.put("text", item.getSizeName());
result.add(jsonObject);
}
return result;
}
}
... ...
... ... @@ -12,6 +12,7 @@
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/common/ok.jsp</url-pattern>
<url-pattern>/common/productId.xlsx</url-pattern>
</servlet-mapping>
... ...
No preview for this file type
... ... @@ -133,12 +133,12 @@
}, {
title: "品牌搜索词",
field: "brandSearch",
width: 170,
width: 200,
align: "center"
}, {
title: "状态",
field: "status",
width: 80,
width: 50,
align: "center",
formatter: function (value, rowData) {
if (value == 1) {
... ... @@ -149,12 +149,12 @@
}, {
title: "创建时间",
field: "createTime",
width: 170,
width: 130,
align: "center"
}, {
title: "操作",
field: "operations",
width: 80,
width: 120,
align: "center",
formatter: function (value, rowData) {
var str = "<a role='edit' dataId='" + rowData.id + "' style='margin-left:10px'>编辑</a>";
... ...
... ... @@ -51,6 +51,7 @@
contentType: "application/json",
dataType: "json",
type: "GET",
async: false,
url: contextPath + '/productSort/getLevel1SortIdAndName',
success: function (data) {
if (data.code != 200 || !data.data || data.data.length == 0) {
... ...
... ... @@ -56,11 +56,11 @@
}
});
$("#productSortTable").myDatagrid({
$("#productSortTable").treegrid({
fit: true,
fitColumns: true,
nowrap: false,
url: contextPath + "/productSort/getProductSortPageList",
url: contextPath + "/productSort/getProductSortList",
method: 'POST',
/*queryParams: {
'sortName':''
... ... @@ -71,6 +71,14 @@
return temp;
},
columns: [[{
title: "",
field: "treeField",
width: 40,
align: "center",
formatter:function () {
return '';
}
}, {
title: "品类ID",
field: "id",
width: 40,
... ... @@ -93,6 +101,11 @@
}
}
}, {
title: "排序",
field: "orderBy",
width: 80,
align: "center"
}, {
title: "状态",
field: "status",
width: 80,
... ... @@ -111,18 +124,19 @@
formatter: function (value, rowData) {
var str = "<a role='edit' dataId='" + rowData.id + "' style='margin-left:10px'>编辑</a>";
if (0 == rowData.status) {
str += "<a role='closeProductName' dataId='" + rowData.id + "' style='margin-left:10px'>关闭</a>";
str += "<a role='closeProductName' dataId='" + rowData.id + "' style='margin-left:10px' parentId = '" + rowData.parentId + "'>关闭</a>";
} else {
str += "<a role='openProductName' dataId='" + rowData.id + "' style='margin-left:10px'>开启</a>";
str += "<a role='openProductName' dataId='" + rowData.id + "' style='margin-left:10px' parentId = '" + rowData.parentId + "'>开启</a>";
}
return str;
}
}]],
cache: false,
pagination: true,
pageSize: 100,
pageList: [100, 200, 300],
//pagination: true,
//pageSize: 100,
//pageList: [100, 200, 300],
idField: "id",
treeField:'treeField',
singleSelect: false,
checkOnSelect: false,
onLoadSuccess: function () {
... ... @@ -138,7 +152,7 @@
$(this).myDatagrid("getPanel").find("a[role='closeProductName']").linkbutton({
iconCls: "icon-more",
onClick: function () {
updateBrandStatus($(this).attr("dataId"), 1);
updateBrandStatus($(this).attr("dataId"), 1, $(this).attr("parentId"));
}
});
... ... @@ -146,7 +160,7 @@
$(this).myDatagrid("getPanel").find("a[role='openProductName']").linkbutton({
iconCls: "icon-more",
onClick: function () {
updateBrandStatus($(this).attr("dataId"), 0);
updateBrandStatus($(this).attr("dataId"), 0, $(this).attr("parentId"));
}
});
}
... ... @@ -211,7 +225,7 @@
data = JSON.parse(data);
if (data.code == 200) {
$(div).dialog("close");
$("#productSortTable").myDatagrid("reload");
$("#productSortTable").treegrid("reload");
$.messager.show({
title: "提示",
msg: title + "成功!",
... ... @@ -235,10 +249,10 @@
});
}
function updateBrandStatus(id, status) {
function updateBrandStatus(id, status, parentId) {
var message = "";
var msg = "";
if (status == 1) {
if (status == 0) {
message = "确认要开启品牌吗?";
msg = "开启品牌成功!";
} else {
... ... @@ -253,10 +267,10 @@
interval: 500,
text: ""
});
$.post(contextPath + "/productSort/updateProductSortStatus",{"id":id, "status":status}, function (data) {
$.post(contextPath + "/productSort/updateProductSortStatus",{"id":id, "status":status, "parentId": parentId}, function (data) {
window.top.$.messager.progress("close");
if (data.code == 200) {
$("#productSortTable").myDatagrid("reload");
$("#productSortTable").treegrid("reload");
window.top.$.messager.show({
title: "提示",
msg: msg,
... ...
... ... @@ -60,11 +60,6 @@
$(function () {
var poolId = parseURL(window.location.href).poolId;
console.log(parseURL(window.location.href).poolId);
/* $('#goodsPoolId').val(window.self.paramObject.poolId);
console.log(window.self.paramObject.poolId);
console.log($('#goodsPoolId').val());*/
$("#productCode").textbox({
prompt: "商品编码"
... ... @@ -158,13 +153,13 @@
interval: 500,
text: ""
});
$.post(contextPath + "/productPoolDetails/deleteProductById", {"id": id, "poolId":poolId}, function (data) {
$.post(contextPath + "/productPoolDetails/deleteProductById", {"productId": id, "poolId":poolId}, function (data) {
$.messager.progress("close");
if (data.code == 200) {
$("#productPoolDetailsTable").datagrid("reload");
$.messager.show({
title: "提示",
msg: "删除区域成功!"
msg: "删除商品详情成功!"
});
} else {
$.messager.alert("失败", data.message, "error");
... ... @@ -183,18 +178,18 @@
var productName = $('#productName').textbox('getValue');
var brandName = $('#brandName').textbox('getValue');
var sortName = $('#sortName').textbox('getValue');
var param = {};
var param = {"poolId": poolId};
if (undefined !== productCode && null !== productCode && "" !== productCode) {
param.id = productCode;
param.productCode = productCode;
}
if (undefined !== productName && null !== productName && "" !== productName) {
param.poolName = productName;
param.productName = productName;
}
if (undefined !== brandName && null !== brandName && "" !== brandName) {
param.id = brandName;
param.brandName = brandName;
}
if (undefined !== sortName && null !== sortName && "" !== sortName) {
param.poolName = sortName;
param.sortName = sortName;
}
return param;
}
... ...