InBoxAttrMapper.xml 1.31 KB
<?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.yohoufo.dal.user.IInBoxAttrDao">
    <resultMap id="BaseResultMap" type="com.yohoufo.dal.user.model.InBoxAttr">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="inbox_id" property="inboxId" jdbcType="INTEGER"/>
        <result column="uid" property="uid" jdbcType="INTEGER"/>
        <result column="json_content" property="jsonContent" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        id, inbox_id, uid, json_content
    </sql>
    <insert id="insert" parameterType="com.yohoufo.dal.user.model.InBoxAttr">
        INSERT INTO inbox_attr (inbox_id, uid, json_content)
        values
        (#{inboxId},#{uid},#{jsonContent})
    </insert>

    <select id="selectInboxAttrList" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM inbox_attr where uid = #{uid} 
        <if test="inboxIdList != null and inboxIdList.size()>0">
            and inbox_id in 
            <foreach item="item" index="index" collection="inboxIdList"
               open="(" separator="," close=")">
              #{item}
            </foreach>
        </if>
    </select>
</mapper>