Commit cc3cd66a by XiaHou

权星相关接口

parent 9517d9ca
......@@ -33,7 +33,7 @@ public class PmsProductController {
private PmsProductService productService;
@ApiOperation("权星创建商品")
@ApiOperation("权星后台_创建商品")
@RequestMapping(value = "/addProduct", method = RequestMethod.POST)
@ResponseBody
public CommonResult addProduct(@RequestBody PmsProductRequestParam pmsProductRequestParam){
......@@ -45,26 +45,27 @@ public class PmsProductController {
}
@ApiOperation("根据商品id获取商品编辑信息")
@RequestMapping(value = "/updateInfo/{id}", method = RequestMethod.GET)
@ApiOperation("权星后台_获取商品信息根据商品id")
@RequestMapping(value = "/getProductInfo", method = RequestMethod.GET)
@ResponseBody
//@PreAuthorize("hasAuthority('pms:product:read')")
public CommonResult<PmsProductResult> getUpdateInfo(@PathVariable Long id) {
PmsProductResult productResult = productService.getUpdateInfo(id);
return CommonResult.success(productResult);
public CommonResult getUpdateInfo( @ApiParam("商品Id") @RequestParam(value="id") Long id) {
PmsProductRequestParam pmsProductRequestParam = productService.getProductById(id);
return CommonResult.success(pmsProductRequestParam);
}
@ApiOperation("更新商品")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ApiOperation("权星后台_修改商品后保存操作 如果sku有变动则需传入pmsProductSkuValueList以及pmsSkuStockList 没有变动则不需传")
@RequestMapping(value = "/update", method = RequestMethod.POST)
@ResponseBody
//@PreAuthorize("hasAuthority('pms:product:update')")
public CommonResult update(@PathVariable Long id, @RequestBody PmsProductParam productParam, BindingResult bindingResult) {
int count = productService.update(id, productParam);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
public CommonResult update(@RequestBody PmsProductRequestParam pmsProductRequestParam) {
ResultMsg res = productService.updateProduct(pmsProductRequestParam);
if(res.isFlag()){
return CommonResult.success(null,res.getMsg());
}
return CommonResult.failed(res.getMsg());
}
@ApiOperation("查询商品")
......
......@@ -19,7 +19,7 @@ public class PmsSupplierAuditController {
@Autowired
private IPmsSupplierAuditService pmsSupplierAuditService;
@ApiOperation("权星申请供应商")
@ApiOperation("权星后台_审核申请供应商")
@ResponseBody
@RequestMapping(value = "/auditSupplier", method = RequestMethod.POST)
public CommonResult auditSupplier(@ApiParam("审核id") @RequestParam("id") Long id ,
......@@ -31,11 +31,20 @@ public class PmsSupplierAuditController {
return CommonResult.failed(res.getMsg());
}
@ApiOperation("权星申请供应商分页数据")
@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));
}
@ApiOperation("权星后台_通过审核Id得到 相关数据")
@ResponseBody
@RequestMapping(value = "/getSupplierAuditById", method = RequestMethod.GET)
public CommonResult getSupplierAuditById(@ApiParam("审核id") @RequestParam("id") Long id){
return CommonResult.success(this.pmsSupplierAuditService.getSupplierAuditById(id));
}
}
......@@ -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 PmsProductSkuValue implements Serializable {
......@@ -18,13 +19,18 @@ public class PmsProductSkuValue implements Serializable {
@ApiModelProperty(value = "规格值")
private String value;
@ApiModelProperty(value = "规格值id")
private Long attributeGroupId;
@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 = "更新者")
......@@ -67,6 +73,14 @@ public class PmsProductSkuValue implements Serializable {
this.value = value;
}
public Long getAttributeGroupId() {
return attributeGroupId;
}
public void setAttributeGroupId(Long attributeGroupId) {
this.attributeGroupId = attributeGroupId;
}
public Date getCreateDate() {
return createDate;
}
......@@ -117,6 +131,7 @@ public class PmsProductSkuValue implements Serializable {
sb.append(", productId=").append(productId);
sb.append(", productAttributeId=").append(productAttributeId);
sb.append(", value=").append(value);
sb.append(", attributeGroupId=").append(attributeGroupId);
sb.append(", createDate=").append(createDate);
sb.append(", createBy=").append(createBy);
sb.append(", updateDate=").append(updateDate);
......
......@@ -355,6 +355,66 @@ public class PmsProductSkuValueExample {
return (Criteria) this;
}
public Criteria andAttributeGroupIdIsNull() {
addCriterion("attribute_group_id is null");
return (Criteria) this;
}
public Criteria andAttributeGroupIdIsNotNull() {
addCriterion("attribute_group_id is not null");
return (Criteria) this;
}
public Criteria andAttributeGroupIdEqualTo(Long value) {
addCriterion("attribute_group_id =", value, "attributeGroupId");
return (Criteria) this;
}
public Criteria andAttributeGroupIdNotEqualTo(Long value) {
addCriterion("attribute_group_id <>", value, "attributeGroupId");
return (Criteria) this;
}
public Criteria andAttributeGroupIdGreaterThan(Long value) {
addCriterion("attribute_group_id >", value, "attributeGroupId");
return (Criteria) this;
}
public Criteria andAttributeGroupIdGreaterThanOrEqualTo(Long value) {
addCriterion("attribute_group_id >=", value, "attributeGroupId");
return (Criteria) this;
}
public Criteria andAttributeGroupIdLessThan(Long value) {
addCriterion("attribute_group_id <", value, "attributeGroupId");
return (Criteria) this;
}
public Criteria andAttributeGroupIdLessThanOrEqualTo(Long value) {
addCriterion("attribute_group_id <=", value, "attributeGroupId");
return (Criteria) this;
}
public Criteria andAttributeGroupIdIn(List<Long> values) {
addCriterion("attribute_group_id in", values, "attributeGroupId");
return (Criteria) this;
}
public Criteria andAttributeGroupIdNotIn(List<Long> values) {
addCriterion("attribute_group_id not in", values, "attributeGroupId");
return (Criteria) this;
}
public Criteria andAttributeGroupIdBetween(Long value1, Long value2) {
addCriterion("attribute_group_id between", value1, value2, "attributeGroupId");
return (Criteria) this;
}
public Criteria andAttributeGroupIdNotBetween(Long value1, Long value2) {
addCriterion("attribute_group_id not between", value1, value2, "attributeGroupId");
return (Criteria) this;
}
public Criteria andCreateDateIsNull() {
addCriterion("create_date is null");
return (Criteria) this;
......
......@@ -6,6 +6,7 @@
<result column="product_id" jdbcType="BIGINT" property="productId" />
<result column="product_attribute_id" jdbcType="BIGINT" property="productAttributeId" />
<result column="value" jdbcType="VARCHAR" property="value" />
<result column="attribute_group_id" jdbcType="BIGINT" property="attributeGroupId" />
<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,8 +72,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, product_id, product_attribute_id, value, create_date, create_by, update_date,
update_by, delete_status
id, product_id, product_attribute_id, value, attribute_group_id, create_date, create_by,
update_date, update_by, delete_status
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.PmsProductSkuValueExample" resultMap="BaseResultMap">
select
......@@ -109,11 +110,13 @@
SELECT LAST_INSERT_ID()
</selectKey>
insert into pms_product_sku_value (product_id, product_attribute_id, value,
create_date, create_by, update_date,
update_by, delete_status)
attribute_group_id, create_date, create_by,
update_date, update_by, delete_status
)
values (#{productId,jdbcType=BIGINT}, #{productAttributeId,jdbcType=BIGINT}, #{value,jdbcType=VARCHAR},
#{createDate,jdbcType=TIMESTAMP}, #{createBy,jdbcType=BIGINT}, #{updateDate,jdbcType=TIMESTAMP},
#{updateBy,jdbcType=BIGINT}, #{deleteStatus,jdbcType=INTEGER})
#{attributeGroupId,jdbcType=BIGINT}, #{createDate,jdbcType=TIMESTAMP}, #{createBy,jdbcType=BIGINT},
#{updateDate,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT}, #{deleteStatus,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.PmsProductSkuValue">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
......@@ -130,6 +133,9 @@
<if test="value != null">
value,
</if>
<if test="attributeGroupId != null">
attribute_group_id,
</if>
<if test="createDate != null">
create_date,
</if>
......@@ -156,6 +162,9 @@
<if test="value != null">
#{value,jdbcType=VARCHAR},
</if>
<if test="attributeGroupId != null">
#{attributeGroupId,jdbcType=BIGINT},
</if>
<if test="createDate != null">
#{createDate,jdbcType=TIMESTAMP},
</if>
......@@ -194,6 +203,9 @@
<if test="record.value != null">
value = #{record.value,jdbcType=VARCHAR},
</if>
<if test="record.attributeGroupId != null">
attribute_group_id = #{record.attributeGroupId,jdbcType=BIGINT},
</if>
<if test="record.createDate != null">
create_date = #{record.createDate,jdbcType=TIMESTAMP},
</if>
......@@ -220,6 +232,7 @@
product_id = #{record.productId,jdbcType=BIGINT},
product_attribute_id = #{record.productAttributeId,jdbcType=BIGINT},
value = #{record.value,jdbcType=VARCHAR},
attribute_group_id = #{record.attributeGroupId,jdbcType=BIGINT},
create_date = #{record.createDate,jdbcType=TIMESTAMP},
create_by = #{record.createBy,jdbcType=BIGINT},
update_date = #{record.updateDate,jdbcType=TIMESTAMP},
......@@ -241,6 +254,9 @@
<if test="value != null">
value = #{value,jdbcType=VARCHAR},
</if>
<if test="attributeGroupId != null">
attribute_group_id = #{attributeGroupId,jdbcType=BIGINT},
</if>
<if test="createDate != null">
create_date = #{createDate,jdbcType=TIMESTAMP},
</if>
......@@ -264,6 +280,7 @@
set product_id = #{productId,jdbcType=BIGINT},
product_attribute_id = #{productAttributeId,jdbcType=BIGINT},
value = #{value,jdbcType=VARCHAR},
attribute_group_id = #{attributeGroupId,jdbcType=BIGINT},
create_date = #{createDate,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=BIGINT},
update_date = #{updateDate,jdbcType=TIMESTAMP},
......
......@@ -26,4 +26,18 @@ public interface PmsSkuStockDao {
* @return
*/
Long getProductTotalStock(@Param("productId") Long productId);
/**
* 根据id查询 skuList数据
* @param productId
* @return
*/
List<PmsSkuStock> selectListByProductId(Long productId);
/**
* 根据商品id 改变删除状态
* @param pmsSkuStock
* @return
*/
int updateDeleteStatusByProductId(PmsSkuStock pmsSkuStock);
}
package com.macro.mall.dao;
package com.macro.mall.dao.quanxing;
import com.macro.mall.model.PmsProductSkuValue;
import org.apache.ibatis.annotations.Param;
......@@ -13,4 +13,18 @@ import java.util.List;
public interface PmsProductSkuValueDao {
@Transactional
int insertList(@Param("list") List<PmsProductSkuValue> productSkuValueList);
/**
* 根据商品id 返回商品规格值List
* @param productId
* @return
*/
List<PmsProductSkuValue> selectListByProductId(Long productId);
/**
* 根据商品id 修改删除状态
* @param pmsProductSkuValue
* @return
*/
int updateDeleteStatusByProductId(PmsProductSkuValue pmsProductSkuValue);
}
......@@ -23,7 +23,7 @@ import java.util.List;
public interface PmsProductService {
/**
* 商家商品列表
* 商家商品列表getUpdateInfo
* @param mchtProductQueryParam
* @return
*/
......@@ -81,15 +81,14 @@ public interface PmsProductService {
List<Long> getLikeId(String url);
/**
* 根据商品编号获取更新信息
* 根据商品编号获取商品相关信息
*/
PmsProductResult getUpdateInfo(Long id);
PmsProductRequestParam getProductById(Long id);
/**
* 更新商品
*/
@Transactional
int update(Long id, PmsProductParam productParam);
ResultMsg updateProduct(PmsProductRequestParam pmsProductRequestParam);
/**
* 分页查询商品
......
......@@ -34,4 +34,11 @@ public interface IPmsSupplierAuditService {
* @return
*/
List<PmsSupplierAuditDto> getPageList(Integer page,Integer size,Integer status);
/**
* 根据id获取一条审核记录
* @param id
* @return
*/
PmsSupplierAuditDto getSupplierAuditById(Long id);
}
......@@ -165,11 +165,12 @@ public class PmsSupplierAuditServiceImpl implements IPmsSupplierAuditService {
public List<PmsSupplierAuditDto> getPageList(Integer page, Integer size, Integer status){
PageHelper.startPage(page, size);
PmsSupplierAuditExample example = new PmsSupplierAuditExample();
PmsSupplierAuditExample.Criteria criteria = example.createCriteria();
if(status !=null){ //如果存在查询状态 则传入
example.createCriteria().andStatusEqualTo(status);
criteria.andStatusEqualTo(status);
}
//过滤已删除的数据
example.createCriteria().andDeleteStatusEqualTo(0);//删除标识0 未删除 1已删除
criteria.andDeleteStatusEqualTo(0);//删除标识0 未删除 1已删除
List<PmsSupplierAudit> dataList = this.pmsSupplierAuditMapper.selectByExample(example);
List<PmsSupplierAuditDto> psadList = new ArrayList<>();
dataList.forEach(pmsSupplierAudit->{
......@@ -183,4 +184,17 @@ public class PmsSupplierAuditServiceImpl implements IPmsSupplierAuditService {
return psadList;
}
/**
* 根据id获取一条审核记录
* @param id
* @return
*/
@Override
public PmsSupplierAuditDto getSupplierAuditById(Long id){
PmsSupplierAuditDto pmsSupplierAuditDto = new PmsSupplierAuditDto();
PmsSupplierAudit psa = this.pmsSupplierAuditMapper.selectByPrimaryKey(id);
BeanUtils.copyProperties(psa,pmsSupplierAuditDto);
pmsSupplierAuditDto.setPmsSupplierAuditProductList(this.pmsSupplierAuditProductDao.selectListByAuditId(id));
return pmsSupplierAuditDto;
}
}
<?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.product.PmsSkuStockDao">
<resultMap id="BaseResultMap" type="com.macro.mall.model.PmsSkuStock" extends="com.macro.mall.mapper.PmsSkuStockMapper.BaseResultMap">
</resultMap>
<insert id="insertList">
INSERT INTO pms_sku_stock (product_id, sku_code, price, stock, low_stock, sp1, sp2, sp3, pic, sale,promotion_price,sku_sn,item_ids,lp2,lp3,lp4) VALUES
<foreach collection="list" item="item" index="index" separator=",">
......@@ -52,4 +55,21 @@
and product_id =#{productId}
</where>
</select>
<select id="selectListByProductId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select * from pms_sku_stock
where product_id=#{productId}
and delete_status = 0
</select>
<update id="updateDeleteStatusByProductId" parameterType="com.macro.mall.model.PmsSkuStock">
update pms_sku_stock
<set>
<if test="deleteStatus != null">
delete_status = #{deleteStatus},
</if>
</set>
where product_id = #{productId}
</update>
</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.PmsProductSkuValueDao">
<mapper namespace="com.macro.mall.dao.quanxing.PmsProductSkuValueDao">
<resultMap id="BaseResultMap" type="com.macro.mall.model.PmsProductSkuValue" extends="com.macro.mall.mapper.PmsProductSkuValueMapper.BaseResultMap">
</resultMap>
<insert id="insertList">
insert into pms_product_sku_value (product_id,product_attribute_id,value,create_date,delete_status) values
<foreach collection="list" item="item" index="index" separator=",">
......@@ -10,4 +14,21 @@
now(),0)
</foreach>
</insert>
<select id="selectListByProductId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select * from pms_product_sku_value
where product_id=#{productId}
and delete_status = 0
</select>
<update id="updateDeleteStatusByProductId" parameterType="com.macro.mall.model.PmsProductSkuValue">
update pms_product_sku_value
<set>
<if test="deleteStatus != null">
delete_status = #{deleteStatus},
</if>
</set>
where product_id = #{productId}
</update>
</mapper>
\ No newline at end of file
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