商品评论
parent
89c4c773d5
commit
8e4e9c8527
|
@ -0,0 +1,101 @@
|
|||
package com.nuyu.product.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 商品库存录入记录对象 mall_product_stock_log
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-08
|
||||
*/
|
||||
@Data
|
||||
public class MallProductStockLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
private Integer pageSize=10;
|
||||
|
||||
private Integer pageNum=1;
|
||||
|
||||
/** 商品 */
|
||||
@Excel(name = "商品")
|
||||
private Long productId;
|
||||
|
||||
/** 商品SKU */
|
||||
@Excel(name = "商品SKU")
|
||||
private Long productRuleCententId;
|
||||
|
||||
/** 录入库存数量 */
|
||||
@Excel(name = "录入库存数量")
|
||||
private Long stockNum;
|
||||
|
||||
/** 乐观锁 */
|
||||
@Excel(name = "乐观锁")
|
||||
private Long revision;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setProductId(Long productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
public void setProductRuleCententId(Long productRuleCententId)
|
||||
{
|
||||
this.productRuleCententId = productRuleCententId;
|
||||
}
|
||||
|
||||
public Long getProductRuleCententId()
|
||||
{
|
||||
return productRuleCententId;
|
||||
}
|
||||
public void setStockNum(Long stockNum)
|
||||
{
|
||||
this.stockNum = stockNum;
|
||||
}
|
||||
|
||||
public Long getStockNum()
|
||||
{
|
||||
return stockNum;
|
||||
}
|
||||
public void setRevision(Long revision)
|
||||
{
|
||||
this.revision = revision;
|
||||
}
|
||||
|
||||
public Long getRevision()
|
||||
{
|
||||
return revision;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("productId", getProductId())
|
||||
.append("productRuleCententId", getProductRuleCententId())
|
||||
.append("stockNum", getStockNum())
|
||||
.append("revision", getRevision())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package com.muyu.product.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.muyu.common.core.web.domain.AjaxResult;
|
||||
import com.muyu.product.service.MallProductStockLogService;
|
||||
import com.nuyu.product.domain.MallProductInfo;
|
||||
import com.nuyu.product.domain.MallProductStockLog;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 商品库存录入记录Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/stock")
|
||||
public class MallProductStockLogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private MallProductStockLogService mallProductStockLogService;
|
||||
|
||||
/**
|
||||
* 查询商品库存录入记录列表
|
||||
*/
|
||||
@RequiresPermissions("product:stock:list")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(MallProductStockLog mallProductStockLog){
|
||||
PageInfo<MallProductStockLog> info=mallProductStockLogService.list(mallProductStockLog);
|
||||
return AjaxResult.success(info);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品库存录入记录列表
|
||||
*/
|
||||
@RequiresPermissions("product:stock:export")
|
||||
@Log(title = "商品库存录入记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MallProductStockLog mallProductStockLog)
|
||||
{
|
||||
List<MallProductStockLog> list = mallProductStockLogService.selectMallProductStockLogList(mallProductStockLog);
|
||||
ExcelUtil<MallProductStockLog> util = new ExcelUtil<MallProductStockLog>(MallProductStockLog.class);
|
||||
util.exportExcel(response, list, "商品库存录入记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品库存录入记录详细信息
|
||||
*/
|
||||
@RequiresPermissions("product:stock:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(mallProductStockLogService.selectMallProductStockLogById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品库存录入记录
|
||||
*/
|
||||
@RequiresPermissions("product:stock:add")
|
||||
@Log(title = "商品库存录入记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody MallProductStockLog mallProductStockLog)
|
||||
{
|
||||
return toAjax(mallProductStockLogService.insertMallProductStockLog(mallProductStockLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品库存录入记录
|
||||
*/
|
||||
@RequiresPermissions("product:stock:edit")
|
||||
@Log(title = "商品库存录入记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody MallProductStockLog mallProductStockLog)
|
||||
{
|
||||
return toAjax(mallProductStockLogService.updateMallProductStockLog(mallProductStockLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品库存录入记录
|
||||
*/
|
||||
@RequiresPermissions("product:stock:remove")
|
||||
@Log(title = "商品库存录入记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(mallProductStockLogService.deleteMallProductStockLogByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.muyu.product.mapper;
|
||||
|
||||
import com.nuyu.product.domain.MallProductStockLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 商品库存录入记录Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-08
|
||||
*/
|
||||
@Mapper
|
||||
public interface MallProductStockLogMapper
|
||||
{
|
||||
/**
|
||||
* 查询商品库存录入记录
|
||||
*
|
||||
* @param id 商品库存录入记录主键
|
||||
* @return 商品库存录入记录
|
||||
*/
|
||||
public MallProductStockLog selectMallProductStockLogById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品库存录入记录列表
|
||||
*
|
||||
* @param mallProductStockLog 商品库存录入记录
|
||||
* @return 商品库存录入记录集合
|
||||
*/
|
||||
public List<MallProductStockLog> selectMallProductStockLogList(MallProductStockLog mallProductStockLog);
|
||||
|
||||
/**
|
||||
* 新增商品库存录入记录
|
||||
*
|
||||
* @param mallProductStockLog 商品库存录入记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductStockLog(MallProductStockLog mallProductStockLog);
|
||||
|
||||
/**
|
||||
* 修改商品库存录入记录
|
||||
*
|
||||
* @param mallProductStockLog 商品库存录入记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductStockLog(MallProductStockLog mallProductStockLog);
|
||||
|
||||
/**
|
||||
* 删除商品库存录入记录
|
||||
*
|
||||
* @param id 商品库存录入记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductStockLogById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除商品库存录入记录
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductStockLogByIds(Long[] ids);
|
||||
|
||||
List<MallProductStockLog> list(MallProductStockLog mallProductStockLog);
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
package com.muyu.product.service.Impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.product.mapper.MallProductStockLogMapper;
|
||||
import com.muyu.product.service.MallProductStockLogService;
|
||||
import com.nuyu.product.domain.MallProductInfo;
|
||||
import com.nuyu.product.domain.MallProductStockLog;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* 商品库存录入记录Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-08
|
||||
*/
|
||||
@Service
|
||||
public class MallProductStockLogServiceImpl implements MallProductStockLogService
|
||||
{
|
||||
@Autowired
|
||||
private MallProductStockLogMapper mallProductStockLogMapper;
|
||||
|
||||
/**
|
||||
* 查询商品库存录入记录
|
||||
*
|
||||
* @param id 商品库存录入记录主键
|
||||
* @return 商品库存录入记录
|
||||
*/
|
||||
@Override
|
||||
public MallProductStockLog selectMallProductStockLogById(Long id)
|
||||
{
|
||||
return mallProductStockLogMapper.selectMallProductStockLogById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品库存录入记录列表
|
||||
*
|
||||
* @param mallProductStockLog 商品库存录入记录
|
||||
* @return 商品库存录入记录
|
||||
*/
|
||||
@Override
|
||||
public List<MallProductStockLog> selectMallProductStockLogList(MallProductStockLog mallProductStockLog)
|
||||
{
|
||||
return mallProductStockLogMapper.selectMallProductStockLogList(mallProductStockLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品库存录入记录
|
||||
*
|
||||
* @param mallProductStockLog 商品库存录入记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMallProductStockLog(MallProductStockLog mallProductStockLog)
|
||||
{
|
||||
mallProductStockLog.setCreateTime(DateUtils.getNowDate());
|
||||
return mallProductStockLogMapper.insertMallProductStockLog(mallProductStockLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品库存录入记录
|
||||
*
|
||||
* @param mallProductStockLog 商品库存录入记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMallProductStockLog(MallProductStockLog mallProductStockLog)
|
||||
{
|
||||
return mallProductStockLogMapper.updateMallProductStockLog(mallProductStockLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品库存录入记录
|
||||
*
|
||||
* @param ids 需要删除的商品库存录入记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductStockLogByIds(Long[] ids)
|
||||
{
|
||||
return mallProductStockLogMapper.deleteMallProductStockLogByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品库存录入记录信息
|
||||
*
|
||||
* @param id 商品库存录入记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductStockLogById(Long id)
|
||||
{
|
||||
return mallProductStockLogMapper.deleteMallProductStockLogById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品库存录入记录列表
|
||||
*
|
||||
* @param mallProductStockLog 商品库存录入记录
|
||||
* @return 商品库存录入记录
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<MallProductStockLog> list(MallProductStockLog mallProductStockLog) {
|
||||
PageHelper.startPage(mallProductStockLog.getPageNum(),mallProductStockLog.getPageSize());
|
||||
List<MallProductStockLog> products = mallProductStockLogMapper.list(mallProductStockLog);
|
||||
PageInfo<MallProductStockLog> pageInfo = new PageInfo<>(products);
|
||||
return pageInfo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package com.muyu.product.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.nuyu.product.domain.MallProductStockLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 商品库存录入记录Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-08
|
||||
*/
|
||||
public interface MallProductStockLogService
|
||||
{
|
||||
/**
|
||||
* 查询商品库存录入记录
|
||||
*
|
||||
* @param id 商品库存录入记录主键
|
||||
* @return 商品库存录入记录
|
||||
*/
|
||||
public MallProductStockLog selectMallProductStockLogById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品库存录入记录列表
|
||||
*
|
||||
* @param mallProductStockLog 商品库存录入记录
|
||||
* @return 商品库存录入记录集合
|
||||
*/
|
||||
public List<MallProductStockLog> selectMallProductStockLogList(MallProductStockLog mallProductStockLog);
|
||||
|
||||
/**
|
||||
* 新增商品库存录入记录
|
||||
*
|
||||
* @param mallProductStockLog 商品库存录入记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductStockLog(MallProductStockLog mallProductStockLog);
|
||||
|
||||
/**
|
||||
* 修改商品库存录入记录
|
||||
*
|
||||
* @param mallProductStockLog 商品库存录入记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductStockLog(MallProductStockLog mallProductStockLog);
|
||||
|
||||
/**
|
||||
* 批量删除商品库存录入记录
|
||||
*
|
||||
* @param ids 需要删除的商品库存录入记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductStockLogByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除商品库存录入记录信息
|
||||
*
|
||||
* @param id 商品库存录入记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductStockLogById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param mallProductStockLog
|
||||
* @return
|
||||
*/
|
||||
PageInfo<MallProductStockLog> list(MallProductStockLog mallProductStockLog);
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
<?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.muyu.product.mapper.MallProductStockLogMapper">
|
||||
|
||||
<resultMap type="com.nuyu.product.domain.MallProductStockLog" id="MallProductStockLogResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="productRuleCententId" column="product_rule_centent_id" />
|
||||
<result property="stockNum" column="stock_num" />
|
||||
<result property="revision" column="revision" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMallProductStockLogVo">
|
||||
select id, product_id, product_rule_centent_id, stock_num, revision, create_by, create_time from mall_product_stock_log
|
||||
</sql>
|
||||
|
||||
<select id="selectMallProductStockLogList" parameterType="com.nuyu.product.domain.MallProductStockLog" resultMap="MallProductStockLogResult">
|
||||
<include refid="selectMallProductStockLogVo"/>
|
||||
<where>
|
||||
<if test="stockNum != null "> and stock_num = #{stockNum}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMallProductStockLogById" parameterType="Long" resultMap="MallProductStockLogResult">
|
||||
<include refid="selectMallProductStockLogVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.nuyu.product.domain.MallProductStockLog">
|
||||
<include refid="selectMallProductStockLogVo"/>
|
||||
<where>
|
||||
<if test="stockNum != null "> and stock_num = #{stockNum}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertMallProductStockLog" parameterType="com.nuyu.product.domain.MallProductStockLog" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into mall_product_stock_log
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="productId != null">product_id,</if>
|
||||
<if test="productRuleCententId != null">product_rule_centent_id,</if>
|
||||
<if test="stockNum != null">stock_num,</if>
|
||||
<if test="revision != null">revision,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="productId != null">#{productId},</if>
|
||||
<if test="productRuleCententId != null">#{productRuleCententId},</if>
|
||||
<if test="stockNum != null">#{stockNum},</if>
|
||||
<if test="revision != null">#{revision},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateMallProductStockLog" parameterType="com.nuyu.product.domain.MallProductStockLog">
|
||||
update mall_product_stock_log
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="productId != null">product_id = #{productId},</if>
|
||||
<if test="productRuleCententId != null">product_rule_centent_id = #{productRuleCententId},</if>
|
||||
<if test="stockNum != null">stock_num = #{stockNum},</if>
|
||||
<if test="revision != null">revision = #{revision},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMallProductStockLogById" parameterType="Long">
|
||||
delete from mall_product_stock_log where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMallProductStockLogByIds" parameterType="String">
|
||||
delete from mall_product_stock_log where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue