ResourcesContentMapper.xml 2.21 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.yoho.ufo.dal.ResourcesContentMapper">
    <resultMap id="BaseResultMap" type="com.yoho.ufo.model.resource.ResourcesContent" >
        <id column="id" property="id" jdbcType="INTEGER" />
        <result column="platform_id" property="platformId" jdbcType="INTEGER" />
        <result column="sort_id" property="sortId" jdbcType="INTEGER" />
        <result column="resources_id" property="resourcesId" jdbcType="INTEGER" />
        <result column="name" property="name" jdbcType="VARCHAR" />
        <result column="order_by" property="orderBy" jdbcType="INTEGER" />
        <result column="create_time" property="createTime" jdbcType="INTEGER" />
        <result column="status" property="status" jdbcType="TINYINT" />
    </resultMap>
    <sql id="Base_Column_List">
        id, platform_id, sort_id, resources_id, name, order_by, status,create_time
    </sql>
    <select id="selectByResourceId" resultType="com.yoho.ufo.model.resource.ResourcesContent">
        select <include refid="Base_Column_List" /> from resources_content
        where resources_id=#{id}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
	    delete from resources_content
	    where id = #{id,jdbcType=INTEGER}
	  </delete>
	  <insert id="insert" parameterType="com.yoho.ufo.model.resource.ResourcesContent"  keyProperty="id" useGeneratedKeys="true" >
	    insert into resources_content (id, platform_id, sort_id, 
	      resources_id, name, order_by, 
	      create_time, status)
	    values (#{id,jdbcType=INTEGER}, #{platformId,jdbcType=INTEGER}, #{sortId,jdbcType=INTEGER}, 
	      #{resourcesId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{orderBy,jdbcType=INTEGER}, 
	      #{createTime,jdbcType=INTEGER}, #{status,jdbcType=TINYINT})
	  </insert>

    <delete id="deleteByResourceId">
        delete from resources_content
	    where resources_id = #{resourceId,jdbcType=INTEGER}
    </delete>

    <update id="softDeleteByResourceId">
        UPDATE resources_content set status=0
        where resources_id = #{resourceId,jdbcType=INTEGER}
    </update>
</mapper>