You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

347 lines
13 KiB
XML

<?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.sztzjy.resource_center.mapper.SysResourceMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.resource_center.entity.SysResource">
<id column="resource_id" jdbcType="VARCHAR" property="resourceId" />
<result column="resource_name" jdbcType="VARCHAR" property="resourceName" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="picture_url" jdbcType="VARCHAR" property="pictureUrl" />
<result column="resource_type" jdbcType="VARCHAR" property="resourceType" />
<result column="source" jdbcType="VARCHAR" property="source" />
<result column="ont_tag" jdbcType="VARCHAR" property="ontTag" />
<result column="two_tag" jdbcType="VARCHAR" property="twoTag" />
<result column="three_tag" jdbcType="VARCHAR" property="threeTag" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
resource_id, resource_name, url, picture_url, resource_type, source, ont_tag, two_tag,
three_tag, status, create_time
</sql>
<select id="selectByExample" parameterType="com.sztzjy.resource_center.entity.SysResourceExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sys_resource
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_resource
where resource_id = #{resourceId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from sys_resource
where resource_id = #{resourceId,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.resource_center.entity.SysResourceExample">
delete from sys_resource
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.resource_center.entity.SysResource">
insert into sys_resource (resource_id, resource_name, url,
picture_url, resource_type, source,
ont_tag, two_tag, three_tag,
status, create_time)
values (#{resourceId,jdbcType=VARCHAR}, #{resourceName,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR},
#{pictureUrl,jdbcType=VARCHAR}, #{resourceType,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR},
#{ontTag,jdbcType=VARCHAR}, #{twoTag,jdbcType=VARCHAR}, #{threeTag,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.resource_center.entity.SysResource">
insert into sys_resource
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="resourceId != null">
resource_id,
</if>
<if test="resourceName != null">
resource_name,
</if>
<if test="url != null">
url,
</if>
<if test="pictureUrl != null">
picture_url,
</if>
<if test="resourceType != null">
resource_type,
</if>
<if test="source != null">
source,
</if>
<if test="ontTag != null">
ont_tag,
</if>
<if test="twoTag != null">
two_tag,
</if>
<if test="threeTag != null">
three_tag,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="resourceId != null">
#{resourceId,jdbcType=VARCHAR},
</if>
<if test="resourceName != null">
#{resourceName,jdbcType=VARCHAR},
</if>
<if test="url != null">
#{url,jdbcType=VARCHAR},
</if>
<if test="pictureUrl != null">
#{pictureUrl,jdbcType=VARCHAR},
</if>
<if test="resourceType != null">
#{resourceType,jdbcType=VARCHAR},
</if>
<if test="source != null">
#{source,jdbcType=VARCHAR},
</if>
<if test="ontTag != null">
#{ontTag,jdbcType=VARCHAR},
</if>
<if test="twoTag != null">
#{twoTag,jdbcType=VARCHAR},
</if>
<if test="threeTag != null">
#{threeTag,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.resource_center.entity.SysResourceExample" resultType="java.lang.Long">
select count(*) from sys_resource
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sys_resource
<set>
<if test="record.resourceId != null">
resource_id = #{record.resourceId,jdbcType=VARCHAR},
</if>
<if test="record.resourceName != null">
resource_name = #{record.resourceName,jdbcType=VARCHAR},
</if>
<if test="record.url != null">
url = #{record.url,jdbcType=VARCHAR},
</if>
<if test="record.pictureUrl != null">
picture_url = #{record.pictureUrl,jdbcType=VARCHAR},
</if>
<if test="record.resourceType != null">
resource_type = #{record.resourceType,jdbcType=VARCHAR},
</if>
<if test="record.source != null">
source = #{record.source,jdbcType=VARCHAR},
</if>
<if test="record.ontTag != null">
ont_tag = #{record.ontTag,jdbcType=VARCHAR},
</if>
<if test="record.twoTag != null">
two_tag = #{record.twoTag,jdbcType=VARCHAR},
</if>
<if test="record.threeTag != null">
three_tag = #{record.threeTag,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sys_resource
set resource_id = #{record.resourceId,jdbcType=VARCHAR},
resource_name = #{record.resourceName,jdbcType=VARCHAR},
url = #{record.url,jdbcType=VARCHAR},
picture_url = #{record.pictureUrl,jdbcType=VARCHAR},
resource_type = #{record.resourceType,jdbcType=VARCHAR},
source = #{record.source,jdbcType=VARCHAR},
ont_tag = #{record.ontTag,jdbcType=VARCHAR},
two_tag = #{record.twoTag,jdbcType=VARCHAR},
three_tag = #{record.threeTag,jdbcType=VARCHAR},
status = #{record.status,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.resource_center.entity.SysResource">
update sys_resource
<set>
<if test="resourceName != null">
resource_name = #{resourceName,jdbcType=VARCHAR},
</if>
<if test="url != null">
url = #{url,jdbcType=VARCHAR},
</if>
<if test="pictureUrl != null">
picture_url = #{pictureUrl,jdbcType=VARCHAR},
</if>
<if test="resourceType != null">
resource_type = #{resourceType,jdbcType=VARCHAR},
</if>
<if test="source != null">
source = #{source,jdbcType=VARCHAR},
</if>
<if test="ontTag != null">
ont_tag = #{ontTag,jdbcType=VARCHAR},
</if>
<if test="twoTag != null">
two_tag = #{twoTag,jdbcType=VARCHAR},
</if>
<if test="threeTag != null">
three_tag = #{threeTag,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where resource_id = #{resourceId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.resource_center.entity.SysResource">
update sys_resource
set resource_name = #{resourceName,jdbcType=VARCHAR},
url = #{url,jdbcType=VARCHAR},
picture_url = #{pictureUrl,jdbcType=VARCHAR},
resource_type = #{resourceType,jdbcType=VARCHAR},
source = #{source,jdbcType=VARCHAR},
ont_tag = #{ontTag,jdbcType=VARCHAR},
two_tag = #{twoTag,jdbcType=VARCHAR},
three_tag = #{threeTag,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}
where resource_id = #{resourceId,jdbcType=VARCHAR}
</update>
<!-- <select id="selectResource" parameterType="java.lang.String" resultMap="SelectResourceMap">-->
<!-- SELECT sr.resource_id,sr.resource_name,sr.resource_type,sra.one_name,sra.two_name,sra.three_name-->
<!-- FROM sys_resource sr-->
<!-- JOIN sys_resource_and_course sra ON sr.resource_id = sra.resource_id-->
<!-- <where>-->
<!-- <if test="oneId != null and oneId != ''">-->
<!-- sra.one_id = #{oneId}-->
<!-- </if>-->
<!-- <if test="twoId != null and twoId != ''">-->
<!-- and sra.two_id = #{twoId}-->
<!-- </if>-->
<!-- <if test="threeId != null and threeId != ''">-->
<!-- and sra.three_id = #{threeId}-->
<!-- </if>-->
<!-- <if test="resourceName != null and resourceName != ''">-->
<!-- and sr.resource_name = #{resourceName}-->
<!-- </if>-->
<!-- </where>-->
<!-- order by sr.create_time-->
<!-- </select>-->
<select id="selectResource" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT *
FROM sys_resource
<where>
<if test="oneId != null and oneId != ''">
ont_tag = #{oneId}
</if>
<if test="twoId != null and twoId != ''">
and two_tag = #{twoId}
</if>
<if test="threeId != null and threeId != ''">
and three_tag = #{threeId}
</if>
<if test="resourceName != null and resourceName != ''">
and resource_name = #{resourceName}
</if>
</where>
order by create_time
</select>
</mapper>