Commit e42ffb16 by XiaHou

权星登录注册

parent c1d1a7f7
......@@ -88,4 +88,13 @@ public class PmsProductAttributeCategoryController {
List<PmsProductAttributeCategoryItem> productAttributeCategoryResultList = productAttributeCategoryService.getListWithAttr();
return CommonResult.success(productAttributeCategoryResultList);
}
@ApiOperation("获取所有商品分类 (默认不传分页参数则不分页查询,不传父级id 则查所有分类)")
@RequestMapping(value = "/getAttributeCategoryList", method = RequestMethod.GET)
@ResponseBody
public CommonResult getAttributeCategoryList(Integer pageSize, Integer pageNum, Long parentId){
return CommonResult.success(this.productAttributeCategoryService.getAttributeCategoryList(pageSize,pageNum,parentId));
}
}
package com.macro.mall.controller;
import com.macro.mall.bo.AttributeGroupVo;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.PmsAttributeGroupResult;
import com.macro.mall.dto.PmsProductAttributeGroupParam;
import com.macro.mall.model.AttributeGroupVo;
import com.macro.mall.model.PmsAttributeGroupResult;
import com.macro.mall.model.PmsProductAttributeGroup;
import com.macro.mall.service.ProductAttributeGroupService;
import io.swagger.annotations.*;
......@@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 创建商品参数分组
......@@ -103,7 +102,7 @@ public class PmsProductAttributeGroupController {
})
@RequestMapping(value = "/list/params", method = RequestMethod.POST)
@ResponseBody
public CommonResult<List<AttributeGroupVo>> paramsList(Long cid,Integer type,Long mchtId) {
public CommonResult<List<AttributeGroupVo>> paramsList(Long cid, Integer type, Long mchtId) {
List<AttributeGroupVo> list = productAttributeGroupService.paramsList(cid,type,mchtId);
return CommonResult.success(list,"");
}
......
......@@ -2,7 +2,7 @@ package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.PmsAttributeTypeReulst;
import com.macro.mall.model.PmsAttributeTypeReulst;
import com.macro.mall.model.PmsProductAttributeType;
import com.macro.mall.service.PmsProductAttributeTypeService;
import io.swagger.annotations.Api;
......@@ -79,4 +79,11 @@ public class PmsProductAttributeTypeController {
PmsProductAttributeType pmsProductAttributeType = pmsProductAttributeTypeService.getUpdateInfo(id);
return CommonResult.success(pmsProductAttributeType);
}
@ApiOperation("根据分类id 获取类型属性以及规格")
@RequestMapping(value = "/getAttributeType", method = RequestMethod.GET)
@ResponseBody
public CommonResult getAttributeType(Long productAttributeTypeId ){
return CommonResult.success(this.pmsProductAttributeTypeService.getAttributeType(productAttributeTypeId));
}
}
......@@ -2,12 +2,14 @@ package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.domain.dto.PmsProductRequestParam;
import com.macro.mall.domain.dto.product.PmsProductQueryParam;
import com.macro.mall.domain.vo.product.PmsProductListResult;
import com.macro.mall.domain.vo.product.PmsProductParam;
import com.macro.mall.domain.vo.product.PmsProductResult;
import com.macro.mall.domain.vo.product.SimpleProductResult;
import com.macro.mall.dto.*;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.service.product.PmsProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -30,6 +32,18 @@ public class PmsProductController {
@Resource
private PmsProductService productService;
@ApiOperation("权星创建商品")
@RequestMapping(value = "/addProduct", method = RequestMethod.POST)
@ResponseBody
public CommonResult addProduct(@RequestBody PmsProductRequestParam pmsProductRequestParam){
ResultMsg res = this.productService.addProduct(pmsProductRequestParam);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
@ApiOperation("创建商品")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
......
......@@ -30,4 +30,12 @@ public class PmsSupplierAuditController {
}
return CommonResult.failed(res.getMsg());
}
@ApiOperation("申请供应商分页数据")
@ResponseBody
@RequestMapping(value = "/getPageList", method = RequestMethod.POST)
public CommonResult getPageList(@ApiParam("页数") @RequestParam("page")Integer page,@ApiParam("每页大小")@RequestParam("size")Integer size,
@ApiParam("(非必传)审核状态 0待审核 1审核通过 2审核不通过")@RequestParam("status") Integer status){
return CommonResult.success(this.pmsSupplierAuditService.getPageList(page,size,status));
}
}
......@@ -2,6 +2,7 @@ package com.macro.mall.service;
import com.macro.mall.dto.PmsProductAttributeCategoryItem;
import com.macro.mall.model.PmsProductAttributeCategory;
import com.macro.mall.model.dto.quanxing.PmsProductAttributeTypeDto;
import java.util.List;
......@@ -28,4 +29,11 @@ public interface PmsProductAttributeCategoryService {
* @return
*/
List<Long> getAtributeCategoryIdList(Long attributeCategoryId);
/**
* 查询所有分类 如果传入参数则根据对应参数查询
* @return
*/
List<PmsProductAttributeCategory> getAttributeCategoryList(Integer pageSize, Integer pageNum, Long parentId);
}
package com.macro.mall.service;
import com.macro.mall.dto.PmsAttributeTypeReulst;
import com.macro.mall.model.PmsAttributeTypeReulst;
import com.macro.mall.model.PmsProductAttributeType;
import com.macro.mall.model.dto.quanxing.PmsProductAttributeTypeDto;
import java.util.List;
......@@ -15,4 +16,11 @@ public interface PmsProductAttributeTypeService {
int update(PmsProductAttributeType pmsProductAttributeType);
PmsProductAttributeType getUpdateInfo(Long id);
/**
* 根据分类Id查询
* @param AttributeCategoryId
* @return
*/
List<PmsProductAttributeTypeDto> getAttributeType(Long AttributeCategoryId);
}
......@@ -6,6 +6,7 @@ import com.macro.mall.dto.PmsProductAttributeCategoryItem;
import com.macro.mall.mapper.PmsProductAttributeCategoryMapper;
import com.macro.mall.model.PmsProductAttributeCategory;
import com.macro.mall.model.PmsProductAttributeCategoryExample;
import com.macro.mall.model.dto.quanxing.PmsProductAttributeTypeDto;
import com.macro.mall.service.PmsProductAttributeCategoryService;
import org.springframework.stereotype.Service;
......@@ -73,6 +74,24 @@ public class PmsProductAttributeCategoryServiceImpl implements PmsProductAttribu
return productAttributeCategoryMapper.selectByExample(example);
}
/**
* 查询所有分类 如果传入参数则根据对应参数查询
* @return
*/
public List<PmsProductAttributeCategory> getAttributeCategoryList(Integer pageSize, Integer pageNum, Long parentId){
PmsProductAttributeCategoryExample example = new PmsProductAttributeCategoryExample();
if( (pageSize !=null && pageNum!=null )||(pageSize ==0 && pageNum!=null ) ){//如果传入分页参数 则调用pageHelper
PageHelper.startPage(pageNum,pageSize);
}
if(parentId != null){
example.createCriteria().andParentIdEqualTo(parentId);
}
example.createCriteria().andDeleteStatusEqualTo(0);//查询未删除的
//根据sort asc升序
example.setOrderByClause("sort asc");
return productAttributeCategoryMapper.selectByExample(example);
}
@Override
public List<PmsProductAttributeCategoryItem> getListWithAttr() {
return productAttributeCategoryDao.getListWithAttr();
......@@ -138,4 +157,5 @@ public class PmsProductAttributeCategoryServiceImpl implements PmsProductAttribu
}
return productAttributeCategoryMapper.selectByExample(pmsProductAttributeCategoryExample);
}
}
package com.macro.mall.service.impl;
import com.github.pagehelper.PageHelper;
import com.macro.mall.dao.PmsProductAttributeTypeDao;
import com.macro.mall.dto.PmsAttributeTypeReulst;
import com.macro.mall.dao.quanxing.product.PmsProductAttributeGroupDao;
import com.macro.mall.dao.quanxing.product.PmsProductAttributeTypeDao;
import com.macro.mall.mapper.PmsProductAttributeCategoryMapper;
import com.macro.mall.mapper.PmsProductAttributeTypeMapper;
import com.macro.mall.model.PmsProductAttributeCategory;
import com.macro.mall.model.PmsProductAttributeCategoryExample;
import com.macro.mall.model.PmsProductAttributeType;
import com.macro.mall.model.PmsProductAttributeTypeExample;
import com.macro.mall.model.*;
import com.macro.mall.model.dto.quanxing.PmsProductAttributeTypeDto;
import com.macro.mall.service.PmsProductAttributeCategoryService;
import com.macro.mall.service.PmsProductAttributeTypeService;
import org.apache.commons.lang.StringUtils;
......@@ -29,6 +27,10 @@ public class PmsProductAttributeTypeServiceImpl implements PmsProductAttributeTy
private PmsProductAttributeTypeDao pmsProductAttributeTypeDao;
@Resource
private PmsProductAttributeCategoryService pmsProductAttributeCategoryService;
@Resource
private PmsProductAttributeGroupDao pmsProductAttributeGroupDao;
@Override
public int create(String names, Long attributeCategoryId) {
List<String> list = Arrays.asList(names.split(","));
......@@ -89,4 +91,18 @@ public class PmsProductAttributeTypeServiceImpl implements PmsProductAttributeTy
public PmsProductAttributeType getUpdateInfo(Long id) {
return pmsProductAttributeTypeMapper.selectByPrimaryKey(id);
}
/**
* 根据分类Id查询
* @param AttributeCategoryId
* @return
*/
public List<PmsProductAttributeTypeDto> getAttributeType(Long AttributeCategoryId){
List<PmsProductAttributeTypeDto> pmsProductAttributeTypeDtoList = this.pmsProductAttributeTypeDao.selectByAttributeCategoryId(AttributeCategoryId);
pmsProductAttributeTypeDtoList.forEach(pmsProductAttributeTypeDto ->{
pmsProductAttributeTypeDto.setPmsProductAttributeGroupList(this.pmsProductAttributeGroupDao.selectByProductAttributeTypeId(pmsProductAttributeTypeDto.getId()));
});
return pmsProductAttributeTypeDtoList;
}
}
package com.macro.mall.bo;
package com.macro.mall.model;
import com.macro.mall.model.PmsProductAttribute;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
......
package com.macro.mall.dto;
package com.macro.mall.model;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......
package com.macro.mall.dto;
package com.macro.mall.model;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......
......@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import org.springframework.format.annotation.DateTimeFormat;
@Entity
public class PmsProductAttributeType implements Serializable {
......@@ -20,13 +21,18 @@ public class PmsProductAttributeType implements Serializable {
@ApiModelProperty(value = "属性数量")
private Integer paramCount;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createDate;
@ApiModelProperty(value = "创建人")
private Long createBy;
@ApiModelProperty(value = "更新时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateDate;
@ApiModelProperty(value = "更新者")
......@@ -69,6 +75,14 @@ public class PmsProductAttributeType implements Serializable {
this.paramCount = paramCount;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Date getCreateDate() {
return createDate;
}
......@@ -119,6 +133,7 @@ public class PmsProductAttributeType implements Serializable {
sb.append(", attributeCategoryId=").append(attributeCategoryId);
sb.append(", name=").append(name);
sb.append(", paramCount=").append(paramCount);
sb.append(", sort=").append(sort);
sb.append(", createDate=").append(createDate);
sb.append(", createBy=").append(createBy);
sb.append(", updateDate=").append(updateDate);
......
......@@ -355,6 +355,66 @@ public class PmsProductAttributeTypeExample {
return (Criteria) this;
}
public Criteria andSortIsNull() {
addCriterion("sort is null");
return (Criteria) this;
}
public Criteria andSortIsNotNull() {
addCriterion("sort is not null");
return (Criteria) this;
}
public Criteria andSortEqualTo(Integer value) {
addCriterion("sort =", value, "sort");
return (Criteria) this;
}
public Criteria andSortNotEqualTo(Integer value) {
addCriterion("sort <>", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThan(Integer value) {
addCriterion("sort >", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThanOrEqualTo(Integer value) {
addCriterion("sort >=", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThan(Integer value) {
addCriterion("sort <", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThanOrEqualTo(Integer value) {
addCriterion("sort <=", value, "sort");
return (Criteria) this;
}
public Criteria andSortIn(List<Integer> values) {
addCriterion("sort in", values, "sort");
return (Criteria) this;
}
public Criteria andSortNotIn(List<Integer> values) {
addCriterion("sort not in", values, "sort");
return (Criteria) this;
}
public Criteria andSortBetween(Integer value1, Integer value2) {
addCriterion("sort between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andSortNotBetween(Integer value1, Integer value2) {
addCriterion("sort not between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andCreateDateIsNull() {
addCriterion("create_date is null");
return (Criteria) this;
......
package com.macro.mall.model.dto.quanxing;
import com.macro.mall.model.PmsProductAttributeGroup;
import com.macro.mall.model.PmsProductAttributeType;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class PmsProductAttributeTypeDto extends PmsProductAttributeType implements Serializable {
@ApiModelProperty(value = "规格集合")
List<PmsProductAttributeGroup> pmsProductAttributeGroupList;
}
......@@ -6,6 +6,7 @@
<result column="attribute_category_id" jdbcType="BIGINT" property="attributeCategoryId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="param_count" jdbcType="INTEGER" property="paramCount" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="create_by" jdbcType="BIGINT" property="createBy" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
......@@ -71,7 +72,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, attribute_category_id, name, param_count, create_date, create_by, update_date,
id, attribute_category_id, name, param_count, sort, create_date, create_by, update_date,
update_by, delete_status
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.PmsProductAttributeTypeExample" resultMap="BaseResultMap">
......@@ -109,11 +110,13 @@
SELECT LAST_INSERT_ID()
</selectKey>
insert into pms_product_attribute_type (attribute_category_id, name, param_count,
create_date, create_by, update_date,
update_by, delete_status)
sort, create_date, create_by,
update_date, update_by, delete_status
)
values (#{attributeCategoryId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{paramCount,jdbcType=INTEGER},
#{createDate,jdbcType=TIMESTAMP}, #{createBy,jdbcType=BIGINT}, #{updateDate,jdbcType=TIMESTAMP},
#{updateBy,jdbcType=BIGINT}, #{deleteStatus,jdbcType=INTEGER})
#{sort,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, #{createBy,jdbcType=BIGINT},
#{updateDate,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT}, #{deleteStatus,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.PmsProductAttributeType">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
......@@ -130,6 +133,9 @@
<if test="paramCount != null">
param_count,
</if>
<if test="sort != null">
sort,
</if>
<if test="createDate != null">
create_date,
</if>
......@@ -156,6 +162,9 @@
<if test="paramCount != null">
#{paramCount,jdbcType=INTEGER},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
<if test="createDate != null">
#{createDate,jdbcType=TIMESTAMP},
</if>
......@@ -194,6 +203,9 @@
<if test="record.paramCount != null">
param_count = #{record.paramCount,jdbcType=INTEGER},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
<if test="record.createDate != null">
create_date = #{record.createDate,jdbcType=TIMESTAMP},
</if>
......@@ -220,6 +232,7 @@
attribute_category_id = #{record.attributeCategoryId,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR},
param_count = #{record.paramCount,jdbcType=INTEGER},
sort = #{record.sort,jdbcType=INTEGER},
create_date = #{record.createDate,jdbcType=TIMESTAMP},
create_by = #{record.createBy,jdbcType=BIGINT},
update_date = #{record.updateDate,jdbcType=TIMESTAMP},
......@@ -241,6 +254,9 @@
<if test="paramCount != null">
param_count = #{paramCount,jdbcType=INTEGER},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
<if test="createDate != null">
create_date = #{createDate,jdbcType=TIMESTAMP},
</if>
......@@ -264,6 +280,7 @@
set attribute_category_id = #{attributeCategoryId,jdbcType=BIGINT},
name = #{name,jdbcType=VARCHAR},
param_count = #{paramCount,jdbcType=INTEGER},
sort = #{sort,jdbcType=INTEGER},
create_date = #{createDate,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=BIGINT},
update_date = #{updateDate,jdbcType=TIMESTAMP},
......
package com.macro.mall.dao;
package com.macro.mall.dao.quanxing.product;
import com.macro.mall.bo.AttributeGroupVo;
import com.macro.mall.dto.PmsAttributeGroupResult;
import com.macro.mall.model.AttributeGroupVo;
import com.macro.mall.model.PmsAttributeGroupResult;
import com.macro.mall.model.PmsProductAttributeGroup;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
......@@ -48,4 +48,11 @@ public interface PmsProductAttributeGroupDao {
"and c.delete_status = 0 " +
"AND (c.id = #{cid} or c.id = 9999) ")
List<PmsProductAttributeGroup> getGroupList(@Param("cid") Long cid);
/**
* 根据属性分类id查询 规格
* @param productAttributeTypeId
* @return
*/
List<PmsProductAttributeGroup> selectByProductAttributeTypeId(Long productAttributeTypeId);
}
package com.macro.mall.dao;
package com.macro.mall.dao.quanxing.product;
import com.macro.mall.dto.PmsAttributeTypeReulst;
import com.macro.mall.model.PmsAttributeTypeReulst;
import com.macro.mall.model.dto.quanxing.PmsProductAttributeTypeDto;
import java.util.List;
import java.util.Map;
public interface PmsProductAttributeTypeDao {
List<PmsProductAttributeTypeDto> selectByAttributeCategoryId(Long attributeCategoryId);
List<PmsAttributeTypeReulst> getList(Map<String, Object> map);
}
package com.macro.mall.domain.dto;
import com.macro.mall.model.PmsProduct;
import com.macro.mall.model.PmsProductSkuValue;
import com.macro.mall.model.PmsSkuStock;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class PmsProductRequestParam implements Serializable {
@ApiModelProperty(value="商品对象")
PmsProduct pmsProduct;
@ApiModelProperty(value="商品规格值集合")
List<PmsProductSkuValue> pmsProductSkuValueList;
@ApiModelProperty(value="商品sku集合")
List<PmsSkuStock> pmsSkuStockList;
}
......@@ -2,6 +2,7 @@ package com.macro.mall.service.product;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.domain.dto.MchtProductQueryParam;
import com.macro.mall.domain.dto.PmsProductRequestParam;
import com.macro.mall.domain.dto.product.PmsProductQueryParam;
import com.macro.mall.domain.dto.product.ProductDetailDto;
import com.macro.mall.domain.dto.product.ShopStallProductDto;
......@@ -12,6 +13,7 @@ import com.macro.mall.domain.vo.product.PmsProductParam;
import com.macro.mall.domain.vo.product.PmsProductResult;
import com.macro.mall.domain.vo.product.SimpleProductResult;
import com.macro.mall.model.PmsProductLabelRelation;
import com.macro.mall.model.common.ResultMsg;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
......@@ -163,4 +165,11 @@ public interface PmsProductService {
* 定时更新商品上架状态
*/
void regularlyUpdatePublishStatus();
/**
* 添加商品
* @param pmsProductRequestParam
* @return
*/
ResultMsg addProduct(PmsProductRequestParam pmsProductRequestParam);
}
......@@ -8,6 +8,7 @@ import com.macro.mall.common.api.StringUtils;
import com.macro.mall.dao.product.*;
import com.macro.mall.domain.dto.MchtProductQueryParam;
import com.macro.mall.domain.dto.PmsProductPicSearchParam;
import com.macro.mall.domain.dto.PmsProductRequestParam;
import com.macro.mall.domain.dto.product.*;
import com.macro.mall.domain.vo.MchtProductResult;
import com.macro.mall.domain.vo.baiduyun.PmsProductPicSearchResult;
......@@ -19,6 +20,7 @@ import com.macro.mall.domain.vo.product.PmsProductResult;
import com.macro.mall.domain.vo.product.SimpleProductResult;
import com.macro.mall.mapper.*;
import com.macro.mall.model.*;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.repository.PmsCommentRepository;
import com.macro.mall.repository.PmsProductLabelRelationRepository;
import com.macro.mall.repository.PmsProductWholesalePriceRepository;
......@@ -115,6 +117,51 @@ public class PmsProductServiceImpl implements PmsProductService {
@Resource
private PmsCommentMapper pmsCommentMapper;
/**
* 权星添加商品
* @param pmsProductRequestParam
* @return
*/
public ResultMsg addProduct(PmsProductRequestParam pmsProductRequestParam){
ResultMsg res = this.checkProduct(pmsProductRequestParam);
if(!res.isFlag()){
return new ResultMsg(false,res.getMsg());
}
//商品规格值不为空 则执行插入操作
if(pmsProductRequestParam.getPmsProductSkuValueList() != null && pmsProductRequestParam.getPmsProductSkuValueList().size() > 0){
pmsProductRequestParam.getPmsProductSkuValueList().forEach(pmsProductSkuValue->{
pmsProductSkuValue.setCreateDate(new Date());
pmsProductSkuValue.setUpdateDate(new Date());
this.pmsProductSkuValueMapper.insertSelective(pmsProductSkuValue);
});
}
//sku值不为空 则执行插入
if(pmsProductRequestParam.getPmsSkuStockList() != null && pmsProductRequestParam.getPmsSkuStockList().size() > 0){
pmsProductRequestParam.getPmsSkuStockList().forEach(pmsSkuStock ->{
pmsSkuStock.setCreateDate(new Date());
pmsSkuStock.setUpdateDate(new Date());
this.pmsSkuStockMapper.insertSelective(pmsSkuStock);
});
}
return new ResultMsg(true,"添加成功");
}
private ResultMsg checkProduct(PmsProductRequestParam pmsProductRequestParam){
if(pmsProductRequestParam.getPmsProduct() == null ){
return new ResultMsg(false,"商品数据为空");
}
if(pmsProductRequestParam.getPmsProduct().getName() == null || "".equals(pmsProductRequestParam.getPmsProduct().getName())){
return new ResultMsg(false,"商品名称为空");
}
if(pmsProductRequestParam.getPmsProduct().getMchtId() == null ){
return new ResultMsg(false,"商家id为空");
}
if(pmsProductRequestParam.getPmsProduct().getProductPic() == null || "".equals(pmsProductRequestParam.getPmsProduct().getProductPic())){
return new ResultMsg(false,"商品主图为空");
}
return new ResultMsg(true,"校验通过");
}
/**
* 商家商品列表
*
......
......@@ -3,6 +3,8 @@ package com.macro.mall.service.quanxing;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.PmsSupplierAuditDto;
import java.util.List;
public interface IPmsSupplierAuditService {
/**
......@@ -23,4 +25,13 @@ public interface IPmsSupplierAuditService {
* @return
*/
String getUsername();
/**
* 分页查询
* @param page
* @param size
* @param status
* @return
*/
List<PmsSupplierAuditDto> getPageList(Integer page,Integer size,Integer status);
}
package com.macro.mall.service.quanxing.impl;
import com.github.pagehelper.PageHelper;
import com.macro.mall.mapper.PmsSupplierAuditMapper;
import com.macro.mall.mapper.PmsSupplierAuditProductMapper;
import com.macro.mall.mapper.UmsMemberMapper;
import com.macro.mall.model.PmsSupplierAudit;
import com.macro.mall.model.PmsSupplierAuditExample;
import com.macro.mall.model.PmsSupplierAuditProductExample;
import com.macro.mall.model.UmsMember;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.PmsSupplierAuditDto;
import com.macro.mall.service.member.UmsMemberService;
import com.macro.mall.service.quanxing.IPmsSupplierAuditService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
......@@ -16,9 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import java.util.UUID;
import java.util.*;
@Service
......@@ -154,4 +156,30 @@ public class PmsSupplierAuditServiceImpl implements IPmsSupplierAuditService {
}
return new ResultMsg(true,"校验通过");
}
@Override
public List<PmsSupplierAuditDto> getPageList(Integer page, Integer size, Integer status){
PageHelper.startPage(page, size);
PmsSupplierAuditExample example = new PmsSupplierAuditExample();
if(status !=null){ //如果存在查询状态 则传入
example.createCriteria().andStatusEqualTo(status);
}
//过滤已删除的数据
example.createCriteria().andDeleteStatusEqualTo(0);//删除标识0 未删除 1已删除
List<PmsSupplierAudit> dataList = this.pmsSupplierAuditMapper.selectByExample(example);
List<PmsSupplierAuditDto> psadList = new ArrayList<>();
PmsSupplierAuditProductExample example2 = new PmsSupplierAuditProductExample();
dataList.forEach(pmsSupplierAudit->{
PmsSupplierAuditDto dto = new PmsSupplierAuditDto();
//讲属性赋值到另一个对象中去
BeanUtils.copyProperties(pmsSupplierAudit,dto);
//查询供应商的审核时候商品
example2.createCriteria().andAuditIdEqualTo(pmsSupplierAudit.getId());
dto.setPmsSupplierAuditProductList(this.pmsSupplierAuditProductMapper.selectByExample(example2));
psadList.add(dto);
});
return psadList;
}
}
<?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="com.macro.mall.dao.PmsProductAttributeGroupDao">
<mapper namespace="com.macro.mall.dao.quanxing.product.PmsProductAttributeGroupDao">
<select id="getList" resultType="com.macro.mall.dto.PmsAttributeGroupResult" parameterType="map">
<resultMap id="BaseResultMap" type="com.macro.mall.model.PmsProductAttributeGroup" extends="com.macro.mall.mapper.PmsProductAttributeGroupMapper.BaseResultMap">
</resultMap>
<select id="getList" resultType="com.macro.mall.model.PmsAttributeGroupResult" parameterType="map">
SELECT
a.id,
a.`name`,
......@@ -28,4 +31,9 @@
order by a.id desc
</select>
<select id="selectByProductAttributeTypeId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select * from pms_product_attribute_group
where product_attribute_type_id = #{productAttributeTypeId}
</select>
</mapper>
\ No newline at end of file
<?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="com.macro.mall.dao.PmsProductAttributeTypeDao">
<mapper namespace="com.macro.mall.dao.quanxing.product.PmsProductAttributeTypeDao">
<resultMap id="BaseResultMap" type="com.macro.mall.model.dto.quanxing.PmsProductAttributeTypeDto" extends="com.macro.mall.mapper.PmsProductAttributeTypeMapper.BaseResultMap">
<select id="getList" resultType="com.macro.mall.dto.PmsAttributeTypeReulst" parameterType="map">
</resultMap>
<select id="selectByAttributeCategoryId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select * from pms_product_attribute_type
where attribute_category_id = #{attributeCategoryId}
and param_count > 0
</select>
<select id="getList" resultType="com.macro.mall.model.PmsAttributeTypeReulst" parameterType="map">
SELECT
a.`name`,
a.id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment