<?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.ruoyi.frequency.mallevaluate.mapper.MallEvaluateMapper">

    <resultMap type="com.ruoyi.frequency.mallevaluate.entity.MallEvaluate" id="MallEvaluateResult">
        <result property="id"    column="id"    />
        <result property="createUser"    column="create_user"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateUser"    column="update_user"    />
        <result property="updateTime"    column="update_time"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="userType"    column="user_type"    />
        <result property="userId"    column="user_id"    />
        <result property="orderId"    column="order_id"    />
        <result property="star"    column="star"    />
        <result property="content"    column="content"    />
        <result property="images"    column="images"    />
    </resultMap>

    <sql id="selectMallEvaluateVo">
        select
            t.id ,
            t.create_user ,
            t.create_time ,
            t.update_user ,
            t.update_time ,
            t.del_flag ,
            t.user_type ,
            t.user_id ,
            t.order_id ,
            t.star ,
            t.content ,
            t.images
        from mall_evaluate AS t
    </sql>

    <select id="selectMallEvaluateList" parameterType="com.ruoyi.frequency.mallevaluate.entity.MallEvaluate" resultMap="MallEvaluateResult">
        <include refid="selectMallEvaluateVo"/>
        <where> AND t.del_flag != 2
            <if test="createUser != null "> and t.create_user = #{createUser}</if>
            <if test="updateUser != null "> and t.update_user = #{updateUser}</if>
            <if test="userType != null "> and t.user_type = #{userType}</if>
            <if test="userId != null "> and t.user_id = #{userId}</if>
            <if test="orderId != null "> and t.order_id = #{orderId}</if>
            <if test="star != null "> and t.star = #{star}</if>
            <if test="content != null  and content != ''"> and t.content = #{content}</if>
            <if test="images != null  and images != ''"> and t.images = #{images}</if>
            <if test="delFlag != null and delFlag != ''"> and t.del_flag = #{delFlag}</if>
        </where>
        order by t.create_time desc
    </select>

    <select id="selectMallEvaluateById" parameterType="Long" resultMap="MallEvaluateResult">
        <include refid="selectMallEvaluateVo"/>
        where t.id = #{id}
    </select>

    <insert id="insertMallEvaluate" parameterType="com.ruoyi.frequency.mallevaluate.entity.MallEvaluate">
        insert into mall_evaluate
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="createUser != null">create_user,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateUser != null">update_user,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="userType != null">user_type,</if>
            <if test="userId != null">user_id,</if>
            <if test="orderId != null">order_id,</if>
            <if test="star != null">star,</if>
            <if test="content != null">content,</if>
            <if test="images != null">images,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="createUser != null">#{createUser},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateUser != null">#{updateUser},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="userType != null">#{userType},</if>
            <if test="userId != null">#{userId},</if>
            <if test="orderId != null">#{orderId},</if>
            <if test="star != null">#{star},</if>
            <if test="content != null">#{content},</if>
            <if test="images != null">#{images},</if>
        </trim>
    </insert>

    <update id="updateMallEvaluate" parameterType="com.ruoyi.frequency.mallevaluate.entity.MallEvaluate">
        update mall_evaluate
        <trim prefix="SET" suffixOverrides=",">
            <if test="createUser != null">create_user = #{createUser},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateUser != null">update_user = #{updateUser},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="userType != null">user_type = #{userType},</if>
            <if test="userId != null">user_id = #{userId},</if>
            <if test="orderId != null">order_id = #{orderId},</if>
            <if test="star != null">star = #{star},</if>
            <if test="content != null">content = #{content},</if>
            <if test="images != null">images = #{images},</if>
        </trim>
        where id = #{id}
    </update>
                                                                                                                        </mapper>
