init
This commit is contained in:
79
src/main/resources/mapper/TrainingResourceMapper.xml
Normal file
79
src/main/resources/mapper/TrainingResourceMapper.xml
Normal file
@@ -0,0 +1,79 @@
|
||||
<?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.backend.webbackend.mapper.TrainingResourceMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.backend.webbackend.domain.TrainingResource">
|
||||
<id property="id" column="id" />
|
||||
<result property="resourceName" column="resource_name" />
|
||||
<result property="resourceType" column="resource_type" />
|
||||
<result property="filePath" column="file_path" />
|
||||
<result property="courseId" column="course_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,resource_name,resource_type,file_path,course_id
|
||||
</sql>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from training_resource
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from training_resource
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.backend.webbackend.domain.TrainingResource" useGeneratedKeys="true">
|
||||
insert into training_resource
|
||||
( id,resource_name,resource_type,file_path,course_id)
|
||||
values (#{id},#{resourceName},#{resourceType},#{filePath},#{courseId})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.backend.webbackend.domain.TrainingResource" useGeneratedKeys="true">
|
||||
insert into training_resource
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="resourceName != null">resource_name,</if>
|
||||
<if test="resourceType != null">resource_type,</if>
|
||||
<if test="filePath != null">file_path,</if>
|
||||
<if test="courseId != null">course_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="resourceName != null">#{resourceName},</if>
|
||||
<if test="resourceType != null">#{resourceType},</if>
|
||||
<if test="filePath != null">#{filePath},</if>
|
||||
<if test="courseId != null">#{courseId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.backend.webbackend.domain.TrainingResource">
|
||||
update training_resource
|
||||
<set>
|
||||
<if test="resourceName != null">
|
||||
resource_name = #{resourceName},
|
||||
</if>
|
||||
<if test="resourceType != null">
|
||||
resource_type = #{resourceType},
|
||||
</if>
|
||||
<if test="filePath != null">
|
||||
file_path = #{filePath},
|
||||
</if>
|
||||
<if test="courseId != null">
|
||||
course_id = #{courseId},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.backend.webbackend.domain.TrainingResource">
|
||||
update training_resource
|
||||
set
|
||||
resource_name = #{resourceName},
|
||||
resource_type = #{resourceType},
|
||||
file_path = #{filePath},
|
||||
course_id = #{courseId}
|
||||
where id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user