商品评论
parent
a83789a1ae
commit
89c4c773d5
|
@ -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.MallProductReviewInfoService;
|
||||
import com.nuyu.product.domain.MallProductInfo;
|
||||
import com.nuyu.product.domain.MallProductReviewInfo;
|
||||
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("/evaluate")
|
||||
public class MallProductReviewInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private MallProductReviewInfoService mallProductReviewInfoService;
|
||||
|
||||
/**
|
||||
* 查询商品评价列表
|
||||
*/
|
||||
@RequiresPermissions("product:evaluate:list")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(MallProductReviewInfo mallProductReviewInfo){
|
||||
PageInfo<MallProductReviewInfo> info=mallProductReviewInfoService.list(mallProductReviewInfo);
|
||||
return AjaxResult.success(info);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品评价列表
|
||||
*/
|
||||
@RequiresPermissions("product:evaluate:export")
|
||||
@Log(title = "商品评价", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MallProductReviewInfo mallProductReviewInfo)
|
||||
{
|
||||
List<MallProductReviewInfo> list = mallProductReviewInfoService.selectMallProductReviewInfoList(mallProductReviewInfo);
|
||||
ExcelUtil<MallProductReviewInfo> util = new ExcelUtil<MallProductReviewInfo>(MallProductReviewInfo.class);
|
||||
util.exportExcel(response, list, "商品评价数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品评价详细信息
|
||||
*/
|
||||
@RequiresPermissions("product:evaluate:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(mallProductReviewInfoService.selectMallProductReviewInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品评价
|
||||
*/
|
||||
@RequiresPermissions("product:evaluate:add")
|
||||
@Log(title = "商品评价", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody MallProductReviewInfo mallProductReviewInfo)
|
||||
{
|
||||
return toAjax(mallProductReviewInfoService.insertMallProductReviewInfo(mallProductReviewInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品评价
|
||||
*/
|
||||
@RequiresPermissions("product:evaluate:edit")
|
||||
@Log(title = "商品评价", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody MallProductReviewInfo mallProductReviewInfo)
|
||||
{
|
||||
return toAjax(mallProductReviewInfoService.updateMallProductReviewInfo(mallProductReviewInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品评价
|
||||
*/
|
||||
@RequiresPermissions("product:evaluate:remove")
|
||||
@Log(title = "商品评价", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(mallProductReviewInfoService.deleteMallProductReviewInfoByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package com.muyu.product.mapper;
|
||||
|
||||
import com.nuyu.product.domain.MallProductReviewInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 商品评价Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-08
|
||||
*/
|
||||
@Mapper
|
||||
public interface MallProductReviewInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询商品评价
|
||||
*
|
||||
* @param id 商品评价主键
|
||||
* @return 商品评价
|
||||
*/
|
||||
public MallProductReviewInfo selectMallProductReviewInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品评价列表
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 商品评价集合
|
||||
*/
|
||||
public List<MallProductReviewInfo> selectMallProductReviewInfoList(MallProductReviewInfo mallProductReviewInfo);
|
||||
|
||||
/**
|
||||
* 新增商品评价
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo);
|
||||
|
||||
/**
|
||||
* 修改商品评价
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo);
|
||||
|
||||
/**
|
||||
* 删除商品评价
|
||||
*
|
||||
* @param id 商品评价主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductReviewInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除商品评价
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductReviewInfoByIds(Long[] ids);
|
||||
|
||||
|
||||
List<MallProductReviewInfo> list(MallProductReviewInfo mallProductReviewInfo);
|
||||
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
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.MallProductReviewInfoMapper;
|
||||
import com.muyu.product.service.MallProductReviewInfoService;
|
||||
import com.nuyu.product.domain.MallProductInfo;
|
||||
import com.nuyu.product.domain.MallProductReviewInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* 商品评价Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-08
|
||||
*/
|
||||
@Service
|
||||
public class MallProductReviewInfoServiceImpl implements MallProductReviewInfoService
|
||||
{
|
||||
@Autowired
|
||||
private MallProductReviewInfoMapper mallProductReviewInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询商品评价
|
||||
*
|
||||
* @param id 商品评价主键
|
||||
* @return 商品评价
|
||||
*/
|
||||
@Override
|
||||
public MallProductReviewInfo selectMallProductReviewInfoById(Long id)
|
||||
{
|
||||
return mallProductReviewInfoMapper.selectMallProductReviewInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品评价列表
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 商品评价
|
||||
*/
|
||||
@Override
|
||||
public List<MallProductReviewInfo> selectMallProductReviewInfoList(MallProductReviewInfo mallProductReviewInfo)
|
||||
{
|
||||
return mallProductReviewInfoMapper.selectMallProductReviewInfoList(mallProductReviewInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品评价
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo)
|
||||
{
|
||||
mallProductReviewInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return mallProductReviewInfoMapper.insertMallProductReviewInfo(mallProductReviewInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品评价
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo)
|
||||
{
|
||||
mallProductReviewInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return mallProductReviewInfoMapper.updateMallProductReviewInfo(mallProductReviewInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品评价
|
||||
*
|
||||
* @param ids 需要删除的商品评价主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductReviewInfoByIds(Long[] ids)
|
||||
{
|
||||
return mallProductReviewInfoMapper.deleteMallProductReviewInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品评价信息
|
||||
*
|
||||
* @param id 商品评价主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductReviewInfoById(Long id)
|
||||
{
|
||||
return mallProductReviewInfoMapper.deleteMallProductReviewInfoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<MallProductReviewInfo> list(MallProductReviewInfo mallProductReviewInfo) {
|
||||
PageHelper.startPage(mallProductReviewInfo.getPageNum(),mallProductReviewInfo.getPageSize());
|
||||
List<MallProductReviewInfo> products = mallProductReviewInfoMapper.list(mallProductReviewInfo);
|
||||
PageInfo<MallProductReviewInfo> pageInfo = new PageInfo<>(products);
|
||||
return pageInfo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.muyu.product.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.nuyu.product.domain.MallProductInfo;
|
||||
import com.nuyu.product.domain.MallProductReviewInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 商品评价Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-08
|
||||
*/
|
||||
public interface MallProductReviewInfoService
|
||||
{
|
||||
/**
|
||||
* 查询商品评价
|
||||
*
|
||||
* @param id 商品评价主键
|
||||
* @return 商品评价
|
||||
*/
|
||||
public MallProductReviewInfo selectMallProductReviewInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品评价列表
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 商品评价集合
|
||||
*/
|
||||
public List<MallProductReviewInfo> selectMallProductReviewInfoList(MallProductReviewInfo mallProductReviewInfo);
|
||||
|
||||
/**
|
||||
* 新增商品评价
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo);
|
||||
|
||||
/**
|
||||
* 修改商品评价
|
||||
*
|
||||
* @param mallProductReviewInfo 商品评价
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductReviewInfo(MallProductReviewInfo mallProductReviewInfo);
|
||||
|
||||
/**
|
||||
* 批量删除商品评价
|
||||
*
|
||||
* @param ids 需要删除的商品评价主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductReviewInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除商品评价信息
|
||||
*
|
||||
* @param id 商品评价主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductReviewInfoById(Long id);
|
||||
|
||||
/*
|
||||
* 分页查询
|
||||
* */
|
||||
PageInfo<MallProductReviewInfo> list(MallProductReviewInfo mallProductReviewInfo);
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
<?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.MallProductReviewInfoMapper">
|
||||
|
||||
<resultMap type="com.nuyu.product.domain.MallProductReviewInfo" id="MallProductReviewInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="productRuleCententId" column="product_rule_centent_id" />
|
||||
<result property="reviewImages" column="review_images" />
|
||||
<result property="content" column="content" />
|
||||
<result property="revision" column="revision" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMallProductReviewInfoVo">
|
||||
select id, product_id, product_rule_centent_id, review_images, content, revision, create_by, create_time, update_by, update_time from mall_product_review_info
|
||||
</sql>
|
||||
|
||||
<select id="selectMallProductReviewInfoList" parameterType="com.nuyu.product.domain.MallProductReviewInfo" resultMap="MallProductReviewInfoResult">
|
||||
<include refid="selectMallProductReviewInfoVo"/>
|
||||
<where>
|
||||
<if test="productId != null "> and product_id = #{productId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMallProductReviewInfoById" parameterType="Long" resultMap="MallProductReviewInfoResult">
|
||||
<include refid="selectMallProductReviewInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.nuyu.product.domain.MallProductReviewInfo">
|
||||
<include refid="selectMallProductReviewInfoVo"/>
|
||||
<where>
|
||||
<if test="productId != null "> and product_id = #{productId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertMallProductReviewInfo" parameterType="com.nuyu.product.domain.MallProductReviewInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into mall_product_review_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="productId != null">product_id,</if>
|
||||
<if test="productRuleCententId != null">product_rule_centent_id,</if>
|
||||
<if test="reviewImages != null">review_images,</if>
|
||||
<if test="content != null and content != ''">content,</if>
|
||||
<if test="revision != null">revision,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="productId != null">#{productId},</if>
|
||||
<if test="productRuleCententId != null">#{productRuleCententId},</if>
|
||||
<if test="reviewImages != null">#{reviewImages},</if>
|
||||
<if test="content != null and content != ''">#{content},</if>
|
||||
<if test="revision != null">#{revision},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateMallProductReviewInfo" parameterType="com.nuyu.product.domain.MallProductReviewInfo">
|
||||
update mall_product_review_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="productId != null">product_id = #{productId},</if>
|
||||
<if test="productRuleCententId != null">product_rule_centent_id = #{productRuleCententId},</if>
|
||||
<if test="reviewImages != null">review_images = #{reviewImages},</if>
|
||||
<if test="content != null and content != ''">content = #{content},</if>
|
||||
<if test="revision != null">revision = #{revision},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMallProductReviewInfoById" parameterType="Long">
|
||||
delete from mall_product_review_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMallProductReviewInfoByIds" parameterType="String">
|
||||
delete from mall_product_review_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue