订单菜谱评价
This commit is contained in:
parent
85768439b0
commit
5df68400a8
|
|
@ -6,6 +6,8 @@ import lombok.Data;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import com.bonus.common.core.web.domain.BaseEntity;
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单评价菜品对象 cook_evalua_detail
|
* 订单评价菜品对象 cook_evalua_detail
|
||||||
*
|
*
|
||||||
|
|
@ -47,5 +49,9 @@ public class CookEvaluaDetail extends BaseEntity {
|
||||||
@ApiModelProperty(value = "描述")
|
@ApiModelProperty(value = "描述")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@ApiModelProperty("评价者昵称")
|
||||||
|
private String evaluaNickName;
|
||||||
|
|
||||||
|
@ApiModelProperty("评价图片")
|
||||||
|
private List<String> pictureList;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,9 @@ public class CookEvaluaOrder extends BaseEntity {
|
||||||
/** 菜品评价id */
|
/** 菜品评价id */
|
||||||
private Long evaluaId;
|
private Long evaluaId;
|
||||||
|
|
||||||
|
/** 评价者id */
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
/** 订单编号 */
|
/** 订单编号 */
|
||||||
@Excel(name = "订单编号")
|
@Excel(name = "订单编号")
|
||||||
@ApiModelProperty(value = "订单编号")
|
@ApiModelProperty(value = "订单编号")
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,9 @@ public class CookEvaluaOrderDTO extends BaseEntity {
|
||||||
/** 菜品评价id */
|
/** 菜品评价id */
|
||||||
private Long evaluaId;
|
private Long evaluaId;
|
||||||
|
|
||||||
|
/** 评价者id */
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
/** 订单编号 */
|
/** 订单编号 */
|
||||||
@Excel(name = "订单编号")
|
@Excel(name = "订单编号")
|
||||||
@ApiModelProperty(value = "订单编号")
|
@ApiModelProperty(value = "订单编号")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
package com.bonus.canteen.core.cook.service.impl;
|
package com.bonus.canteen.core.cook.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.bonus.canteen.core.cook.domain.CookEvaluaPicture;
|
||||||
|
import com.bonus.canteen.core.cook.mapper.CookEvaluaPictureMapper;
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -19,6 +23,8 @@ import com.bonus.canteen.core.cook.service.ICookEvaluaDetailService;
|
||||||
public class CookEvaluaDetailServiceImpl implements ICookEvaluaDetailService {
|
public class CookEvaluaDetailServiceImpl implements ICookEvaluaDetailService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private CookEvaluaDetailMapper cookEvaluaDetailMapper;
|
private CookEvaluaDetailMapper cookEvaluaDetailMapper;
|
||||||
|
@Autowired
|
||||||
|
private CookEvaluaPictureMapper cookEvaluaPictureMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询订单评价菜品
|
* 查询订单评价菜品
|
||||||
|
|
@ -39,7 +45,15 @@ public class CookEvaluaDetailServiceImpl implements ICookEvaluaDetailService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<CookEvaluaDetail> selectCookEvaluaDetailList(CookEvaluaDetail cookEvaluaDetail) {
|
public List<CookEvaluaDetail> selectCookEvaluaDetailList(CookEvaluaDetail cookEvaluaDetail) {
|
||||||
return cookEvaluaDetailMapper.selectCookEvaluaDetailList(cookEvaluaDetail);
|
List<CookEvaluaDetail> list = cookEvaluaDetailMapper.selectCookEvaluaDetailList(cookEvaluaDetail);
|
||||||
|
for (CookEvaluaDetail detail : list) {
|
||||||
|
CookEvaluaPicture menuEvaluaPicture = new CookEvaluaPicture();
|
||||||
|
menuEvaluaPicture.setEvaluaId(detail.getEvaluaId());
|
||||||
|
List<CookEvaluaPicture> menuEvaluaPictures = cookEvaluaPictureMapper.selectCookEvaluaPictureList(menuEvaluaPicture);
|
||||||
|
List<String> pictures = menuEvaluaPictures.stream().map(CookEvaluaPicture::getImgUrl).collect(Collectors.toList());
|
||||||
|
detail.setPictureList(pictures);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,9 @@ public class CookEvaluaOrderServiceImpl implements ICookEvaluaOrderService {
|
||||||
}
|
}
|
||||||
cookEvaluaOrderDTO.setCreateTime(DateUtils.getNowDate());
|
cookEvaluaOrderDTO.setCreateTime(DateUtils.getNowDate());
|
||||||
cookEvaluaOrderDTO.setCreateBy(SecurityUtils.getUsername());
|
cookEvaluaOrderDTO.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
if (Objects.isNull(cookEvaluaOrderDTO.getUserId())) {
|
||||||
|
cookEvaluaOrderDTO.setUserId(SecurityUtils.getUserId());
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
int count = cookEvaluaOrderMapper.insertCookEvaluaOrder(cookEvaluaOrderDTO);
|
int count = cookEvaluaOrderMapper.insertCookEvaluaOrder(cookEvaluaOrderDTO);
|
||||||
long evaluaId = cookEvaluaOrderDTO.getEvaluaId();
|
long evaluaId = cookEvaluaOrderDTO.getEvaluaId();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
package com.bonus.canteen.core.cook.vo;
|
||||||
|
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单评价菜品对象 cook_evalua_detail
|
||||||
|
*
|
||||||
|
* @author xsheng
|
||||||
|
* @date 2025-05-25
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
public class CookEvaluaDetailVO extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 详情id */
|
||||||
|
private Long evaluaDetailId;
|
||||||
|
|
||||||
|
/** 评价id */
|
||||||
|
@Excel(name = "评价id")
|
||||||
|
@ApiModelProperty(value = "评价id")
|
||||||
|
private Long evaluaId;
|
||||||
|
|
||||||
|
/** 餐品类型(1-菜品,2-套餐,3-商品) */
|
||||||
|
@Excel(name = "餐品类型(1-菜品,2-套餐,3-商品)")
|
||||||
|
@ApiModelProperty(value = "餐品类型(1-菜品,2-套餐,3-商品)")
|
||||||
|
private Long mealType;
|
||||||
|
|
||||||
|
/** 餐品id */
|
||||||
|
@Excel(name = "餐品id")
|
||||||
|
@ApiModelProperty(value = "餐品id")
|
||||||
|
private Long mealId;
|
||||||
|
|
||||||
|
/** 星级 */
|
||||||
|
@Excel(name = "星级")
|
||||||
|
@ApiModelProperty(value = "星级")
|
||||||
|
private Long starLevel;
|
||||||
|
|
||||||
|
/** 描述 */
|
||||||
|
@Excel(name = "描述")
|
||||||
|
@ApiModelProperty(value = "描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@ApiModelProperty("评价者昵称")
|
||||||
|
private String evaluaNickName;
|
||||||
|
|
||||||
|
@ApiModelProperty("评价图片")
|
||||||
|
private List<String> pictureList;
|
||||||
|
}
|
||||||
|
|
@ -28,6 +28,11 @@ public class CookEvaluaOrderVo extends BaseEntity {
|
||||||
@ApiModelProperty(value = "评价id")
|
@ApiModelProperty(value = "评价id")
|
||||||
private Long evaluaId;
|
private Long evaluaId;
|
||||||
|
|
||||||
|
/** 用户id */
|
||||||
|
@Excel(name = "用户id")
|
||||||
|
@ApiModelProperty(value = "用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
/** 订单编号 */
|
/** 订单编号 */
|
||||||
@Excel(name = "订单编号")
|
@Excel(name = "订单编号")
|
||||||
@ApiModelProperty(value = "订单编号")
|
@ApiModelProperty(value = "订单编号")
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="mealId" column="meal_id" />
|
<result property="mealId" column="meal_id" />
|
||||||
<result property="starLevel" column="star_level" />
|
<result property="starLevel" column="star_level" />
|
||||||
<result property="description" column="description" />
|
<result property="description" column="description" />
|
||||||
|
<result property="evaluaNickName" column="nick_name" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
|
|
@ -17,23 +18,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectCookEvaluaDetailVo">
|
<sql id="selectCookEvaluaDetailVo">
|
||||||
select evalua_detail_id, evalua_id, meal_type, meal_id, star_level, description, create_by, create_time, update_by, update_time from cook_evalua_detail
|
select ced.evalua_detail_id, ced.evalua_id, ced.meal_type, ced.meal_id, ced.star_level,
|
||||||
|
ced.description, ced.create_by, ced.create_time, ced.update_by, ced.update_time,
|
||||||
|
su.nick_name
|
||||||
|
from cook_evalua_detail ced
|
||||||
|
left join cook_evalua_order ceo on ceo.evalua_id = ced.evalua_id
|
||||||
|
left join sys_user su on su.user_id = ceo.user_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectCookEvaluaDetailList" parameterType="com.bonus.canteen.core.cook.domain.CookEvaluaDetail" resultMap="CookEvaluaDetailResult">
|
<select id="selectCookEvaluaDetailList" parameterType="com.bonus.canteen.core.cook.domain.CookEvaluaDetail" resultMap="CookEvaluaDetailResult">
|
||||||
<include refid="selectCookEvaluaDetailVo"/>
|
<include refid="selectCookEvaluaDetailVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="evaluaId != null "> and evalua_id = #{evaluaId}</if>
|
<if test="evaluaId != null "> and ced.evalua_id = #{evaluaId}</if>
|
||||||
<if test="mealType != null "> and meal_type = #{mealType}</if>
|
<if test="mealType != null "> and ced.meal_type = #{mealType}</if>
|
||||||
<if test="mealId != null "> and meal_id = #{mealId}</if>
|
<if test="mealId != null "> and ced.meal_id = #{mealId}</if>
|
||||||
<if test="starLevel != null "> and star_level = #{starLevel}</if>
|
<if test="starLevel != null "> and ced.star_level = #{starLevel}</if>
|
||||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
<if test="description != null and description != ''"> and ced.description = #{description}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectCookEvaluaDetailByEvaluaDetailId" parameterType="Long" resultMap="CookEvaluaDetailResult">
|
<select id="selectCookEvaluaDetailByEvaluaDetailId" parameterType="Long" resultMap="CookEvaluaDetailResult">
|
||||||
<include refid="selectCookEvaluaDetailVo"/>
|
<include refid="selectCookEvaluaDetailVo"/>
|
||||||
where evalua_detail_id = #{evaluaDetailId}
|
where ced.evalua_detail_id = #{evaluaDetailId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertCookEvaluaDetail" parameterType="com.bonus.canteen.core.cook.domain.CookEvaluaDetail" useGeneratedKeys="true" keyProperty="evaluaDetailId">
|
<insert id="insertCookEvaluaDetail" parameterType="com.bonus.canteen.core.cook.domain.CookEvaluaDetail" useGeneratedKeys="true" keyProperty="evaluaDetailId">
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<mapper namespace="com.bonus.canteen.core.cook.mapper.CookEvaluaOrderMapper">
|
<mapper namespace="com.bonus.canteen.core.cook.mapper.CookEvaluaOrderMapper">
|
||||||
<resultMap type="com.bonus.canteen.core.cook.domain.CookEvaluaOrder" id="CookEvaluaOrderResult">
|
<resultMap type="com.bonus.canteen.core.cook.domain.CookEvaluaOrder" id="CookEvaluaOrderResult">
|
||||||
<result property="evaluaId" column="evalua_id" />
|
<result property="evaluaId" column="evalua_id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
<result property="orderId" column="order_id" />
|
<result property="orderId" column="order_id" />
|
||||||
<result property="starLevel" column="star_level" />
|
<result property="starLevel" column="star_level" />
|
||||||
<result property="description" column="description" />
|
<result property="description" column="description" />
|
||||||
|
|
@ -20,14 +21,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectCookEvaluaOrderVo">
|
<sql id="selectCookEvaluaOrderVo">
|
||||||
select evalua_id, order_id, star_level, description, reply, reply_time, stall_id,
|
select evalua_id, user_id, order_id, star_level, description, reply, reply_time, stall_id,
|
||||||
show_flag, order_evalua_type, create_by, create_time, update_by, update_time
|
show_flag, order_evalua_type, create_by, create_time, update_by, update_time
|
||||||
from cook_evalua_order
|
from cook_evalua_order
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectCookEvaluaOrderList" parameterType="com.bonus.canteen.core.cook.domain.CookEvaluaOrder" resultMap="CookEvaluaOrderResult">
|
<select id="selectCookEvaluaOrderList" parameterType="com.bonus.canteen.core.cook.domain.CookEvaluaOrder" resultMap="CookEvaluaOrderResult">
|
||||||
<include refid="selectCookEvaluaOrderVo"/>
|
<include refid="selectCookEvaluaOrderVo"/>
|
||||||
<where>
|
<where>
|
||||||
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
<if test="orderId != null "> and order_id = #{orderId}</if>
|
<if test="orderId != null "> and order_id = #{orderId}</if>
|
||||||
<if test="starLevel != null "> and star_level = #{starLevel}</if>
|
<if test="starLevel != null "> and star_level = #{starLevel}</if>
|
||||||
<if test="description != null and description != ''"> and description = #{description}</if>
|
<if test="description != null and description != ''"> and description = #{description}</if>
|
||||||
|
|
@ -52,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<insert id="insertCookEvaluaOrder" parameterType="com.bonus.canteen.core.cook.domain.CookEvaluaOrder" useGeneratedKeys="true" keyProperty="evaluaId">
|
<insert id="insertCookEvaluaOrder" parameterType="com.bonus.canteen.core.cook.domain.CookEvaluaOrder" useGeneratedKeys="true" keyProperty="evaluaId">
|
||||||
insert into cook_evalua_order
|
insert into cook_evalua_order
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
<if test="orderId != null">order_id,</if>
|
<if test="orderId != null">order_id,</if>
|
||||||
<if test="starLevel != null">star_level,</if>
|
<if test="starLevel != null">star_level,</if>
|
||||||
<if test="description != null and description != ''">description,</if>
|
<if test="description != null and description != ''">description,</if>
|
||||||
|
|
@ -66,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
<if test="orderId != null">#{orderId},</if>
|
<if test="orderId != null">#{orderId},</if>
|
||||||
<if test="starLevel != null">#{starLevel},</if>
|
<if test="starLevel != null">#{starLevel},</if>
|
||||||
<if test="description != null and description != ''">#{description},</if>
|
<if test="description != null and description != ''">#{description},</if>
|
||||||
|
|
@ -84,6 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<update id="updateCookEvaluaOrder" parameterType="com.bonus.canteen.core.cook.domain.CookEvaluaOrder">
|
<update id="updateCookEvaluaOrder" parameterType="com.bonus.canteen.core.cook.domain.CookEvaluaOrder">
|
||||||
update cook_evalua_order
|
update cook_evalua_order
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
<if test="orderId != null">order_id = #{orderId},</if>
|
<if test="orderId != null">order_id = #{orderId},</if>
|
||||||
<if test="starLevel != null">star_level = #{starLevel},</if>
|
<if test="starLevel != null">star_level = #{starLevel},</if>
|
||||||
<if test="description != null and description != ''">description = #{description},</if>
|
<if test="description != null and description != ''">description = #{description},</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue