<?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="cn.wisenergy.mapper.userLikesMapper">
    <resultMap id="zxMap" type="cn.wisenergy.model.app.userLikes">
        <id column="like_id" property="likeId"/>
        <result column="user_like_id" property="userLikeId"/>
        <result column="liked_id" property="likedId"/>
        <result column="liked_status" property="likedStatus"/>
        <result column="liked_type" property="likedType"/>
        <result column="liked_time" property="likedTime"/>
    </resultMap>

    <sql id="table">
        user_likes
    </sql>

    <sql id="cols_all">
        like_id as likeId,
        <include refid="cols_exclude_id"/>
    </sql>

    <sql id="cols_exclude_id">
        user_like_id as userLikeId,
        liked_id as likedId,
        liked_status as likedStaus,
        liked_type as likedType
    </sql>

    <sql id="vals">
        #{userLikeId},#{likedId},#{likedStaus},#{likedType}
    </sql>

    <!--查询点赞记录-->
    <select id="selectlikes" parameterType="cn.wisenergy.model.app.userLikes" resultType="cn.wisenergy.model.app.userLikes" >
    select *  from user_likes WHERE user_like_id=#{userLikeId} and  liked_id=#{likedId}
    </select>

    <!--点赞内容插入-->
    <insert id="addlikes" parameterType="cn.wisenergy.model.app.userLikes">
        insert into user_likes
        (user_like_id,
        liked_id ,
        liked_status,
        liked_type)
        value(
        #{userLikeId},#{likedId},#{likedStaus},#{likedType}
        )
    </insert>
</mapper>