<?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.panzhihua.service_community.dao.McsEvaluateDAO">
|
|
<resultMap type="com.panzhihua.service_community.entity.McsEvaluate" id="McsEvaluateMap">
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
<result property="couponId" column="coupon_id" jdbcType="INTEGER"/>
|
<result property="gameId" column="game_id" jdbcType="INTEGER"/>
|
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
<result property="star" column="star" jdbcType="INTEGER"/>
|
<result property="content" column="content" jdbcType="VARCHAR"/>
|
<result property="photos" column="photos" jdbcType="VARCHAR"/>
|
<result property="createdAt" column="created_at" jdbcType="TIMESTAMP"/>
|
</resultMap>
|
|
<!-- 批量插入 -->
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
insert into smart_life.mcs_evaluate(coupon_id, star, content, photos, created_at)
|
values
|
<foreach collection="entities" item="entity" separator=",">
|
(#{entity.couponId}, #{entity.star}, #{entity.content}, #{entity.photos}, #{entity.createdAt})
|
</foreach>
|
</insert>
|
<!-- 批量插入或按主键更新 -->
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
insert into smart_life.mcs_evaluate(coupon_id, star, content, photos, created_at)
|
values
|
<foreach collection="entities" item="entity" separator=",">
|
(#{entity.couponId}, #{entity.star}, #{entity.content}, #{entity.photos}, #{entity.createdAt})
|
</foreach>
|
on duplicate key update
|
coupon_id = values(coupon_id) , star = values(star) , content = values(content) , photos = values(photos) ,
|
created_at = values(created_at)
|
</insert>
|
<select id="pageMcsEvaluate"
|
resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsEvaluateVO">
|
SELECT t1.id, t1.star, t1.content, t1.photos, t1.created_at, t3.`name` AS nickName, t3.phone, t3.image_url, t2.`name` AS gameName
|
FROM mcs_evaluate t1
|
LEFT JOIN mcs_game t2 ON t1.game_id = t2.id
|
LEFT JOIN sys_user t3 ON t1.user_id = t3.user_id
|
WHERE 1=1
|
<if test="pageMcsEvaluateDTO.gameId != null">
|
AND t1.game_id = #{pageMcsEvaluateDTO.gameId}
|
</if>
|
<if test="pageMcsEvaluateDTO.isMy != null and pageMcsEvaluateDTO.isMy == 1">
|
AND t1.user_id = #{pageMcsEvaluateDTO.userId}
|
</if>
|
<if test="pageMcsEvaluateDTO.keyword != null and pageMcsEvaluateDTO.keyword != """>
|
AND (
|
t3.`name` LIKE CONCAT(#{pageMcsEvaluateDTO.keyword}, '%')
|
OR t3.phone LIKE CONCAT(#{pageMcsEvaluateDTO.keyword}, '%')
|
)
|
</if>
|
ORDER BY t1.created_at DESC
|
</select>
|
<select id="getMcsEvaluate"
|
resultType="com.panzhihua.common.model.vos.community.microCommercialStreet.McsEvaluateVO">
|
SELECT t1.id, t1.star, t1.content, t1.photos, t1.created_at, t3.`name` AS nickName, t3.phone, t2.`name` AS gameName
|
FROM mcs_evaluate t1
|
LEFT JOIN mcs_game t2 ON t1.game_id = t2.id
|
LEFT JOIN sys_user t3 ON t1.user_id = t3.user_id
|
WHERE t1.id = #{evaluateId}
|
</select>
|
|
</mapper>
|