|
|
|
@ -2,21 +2,21 @@
|
|
|
|
|
<!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="one_tag" jdbcType="VARCHAR" property="oneTag" />
|
|
|
|
|
<result column="one_name" jdbcType="VARCHAR" property="oneName" />
|
|
|
|
|
<result column="two_tag" jdbcType="VARCHAR" property="twoTag" />
|
|
|
|
|
<result column="two_name" jdbcType="VARCHAR" property="twoName" />
|
|
|
|
|
<result column="three_tag" jdbcType="VARCHAR" property="threeTag" />
|
|
|
|
|
<result column="three_name" jdbcType="VARCHAR" property="threeName" />
|
|
|
|
|
<result column="count" jdbcType="INTEGER" property="count" />
|
|
|
|
|
<result column="status" jdbcType="INTEGER" property="status" />
|
|
|
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
|
|
|
<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="one_tag" jdbcType="VARCHAR" property="oneTag"/>
|
|
|
|
|
<result column="one_name" jdbcType="VARCHAR" property="oneName"/>
|
|
|
|
|
<result column="two_tag" jdbcType="VARCHAR" property="twoTag"/>
|
|
|
|
|
<result column="two_name" jdbcType="VARCHAR" property="twoName"/>
|
|
|
|
|
<result column="three_tag" jdbcType="VARCHAR" property="threeTag"/>
|
|
|
|
|
<result column="three_name" jdbcType="VARCHAR" property="threeName"/>
|
|
|
|
|
<result column="count" jdbcType="INTEGER" property="count"/>
|
|
|
|
|
<result column="status" jdbcType="INTEGER" property="status"/>
|
|
|
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
<sql id="Example_Where_Clause">
|
|
|
|
|
<where>
|
|
|
|
@ -36,7 +36,8 @@
|
|
|
|
|
</when>
|
|
|
|
|
<when test="criterion.listValue">
|
|
|
|
|
and ${criterion.condition}
|
|
|
|
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
|
|
|
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
|
|
|
|
separator=",">
|
|
|
|
|
#{listItem}
|
|
|
|
|
</foreach>
|
|
|
|
|
</when>
|
|
|
|
@ -65,7 +66,8 @@
|
|
|
|
|
</when>
|
|
|
|
|
<when test="criterion.listValue">
|
|
|
|
|
and ${criterion.condition}
|
|
|
|
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
|
|
|
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
|
|
|
|
separator=",">
|
|
|
|
|
#{listItem}
|
|
|
|
|
</foreach>
|
|
|
|
|
</when>
|
|
|
|
@ -77,18 +79,20 @@
|
|
|
|
|
</where>
|
|
|
|
|
</sql>
|
|
|
|
|
<sql id="Base_Column_List">
|
|
|
|
|
resource_id, resource_name, url, picture_url, resource_type, source, one_tag, one_name,
|
|
|
|
|
resource_id
|
|
|
|
|
, resource_name, url, picture_url, resource_type, source, one_tag, one_name,
|
|
|
|
|
two_tag, two_name, three_tag, three_name, count, status, create_time
|
|
|
|
|
</sql>
|
|
|
|
|
<select id="selectByExample" parameterType="com.sztzjy.resource_center.entity.SysResourceExample" resultMap="BaseResultMap">
|
|
|
|
|
<select id="selectByExample" parameterType="com.sztzjy.resource_center.entity.SysResourceExample"
|
|
|
|
|
resultMap="BaseResultMap">
|
|
|
|
|
select
|
|
|
|
|
<if test="distinct">
|
|
|
|
|
distinct
|
|
|
|
|
</if>
|
|
|
|
|
<include refid="Base_Column_List" />
|
|
|
|
|
<include refid="Base_Column_List"/>
|
|
|
|
|
from sys_resource
|
|
|
|
|
<if test="_parameter != null">
|
|
|
|
|
<include refid="Example_Where_Clause" />
|
|
|
|
|
<include refid="Example_Where_Clause"/>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderByClause != null">
|
|
|
|
|
order by ${orderByClause}
|
|
|
|
@ -96,18 +100,19 @@
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Base_Column_List" />
|
|
|
|
|
<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
|
|
|
|
|
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" />
|
|
|
|
|
<include refid="Example_Where_Clause"/>
|
|
|
|
|
</if>
|
|
|
|
|
</delete>
|
|
|
|
|
<insert id="insert" parameterType="com.sztzjy.resource_center.entity.SysResource">
|
|
|
|
@ -115,14 +120,12 @@
|
|
|
|
|
picture_url, resource_type, source,
|
|
|
|
|
one_tag, one_name, two_tag,
|
|
|
|
|
two_name, three_tag, three_name,
|
|
|
|
|
count, status, create_time
|
|
|
|
|
)
|
|
|
|
|
count, status, create_time)
|
|
|
|
|
values (#{resourceId,jdbcType=VARCHAR}, #{resourceName,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR},
|
|
|
|
|
#{pictureUrl,jdbcType=VARCHAR}, #{resourceType,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR},
|
|
|
|
|
#{oneTag,jdbcType=VARCHAR}, #{oneName,jdbcType=VARCHAR}, #{twoTag,jdbcType=VARCHAR},
|
|
|
|
|
#{twoName,jdbcType=VARCHAR}, #{threeTag,jdbcType=VARCHAR}, #{threeName,jdbcType=VARCHAR},
|
|
|
|
|
#{count,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
|
|
|
|
|
)
|
|
|
|
|
#{count,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP})
|
|
|
|
|
</insert>
|
|
|
|
|
<insert id="insertSelective" parameterType="com.sztzjy.resource_center.entity.SysResource">
|
|
|
|
|
insert into sys_resource
|
|
|
|
@ -221,10 +224,11 @@
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
<select id="countByExample" parameterType="com.sztzjy.resource_center.entity.SysResourceExample" resultType="java.lang.Long">
|
|
|
|
|
<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" />
|
|
|
|
|
<include refid="Example_Where_Clause"/>
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<update id="updateByExampleSelective" parameterType="map">
|
|
|
|
@ -277,7 +281,7 @@
|
|
|
|
|
</if>
|
|
|
|
|
</set>
|
|
|
|
|
<if test="_parameter != null">
|
|
|
|
|
<include refid="Update_By_Example_Where_Clause" />
|
|
|
|
|
<include refid="Update_By_Example_Where_Clause"/>
|
|
|
|
|
</if>
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateByExample" parameterType="map">
|
|
|
|
@ -298,7 +302,7 @@
|
|
|
|
|
status = #{record.status,jdbcType=INTEGER},
|
|
|
|
|
create_time = #{record.createTime,jdbcType=TIMESTAMP}
|
|
|
|
|
<if test="_parameter != null">
|
|
|
|
|
<include refid="Update_By_Example_Where_Clause" />
|
|
|
|
|
<include refid="Update_By_Example_Where_Clause"/>
|
|
|
|
|
</if>
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.resource_center.entity.SysResource">
|
|
|
|
@ -369,25 +373,26 @@
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<resultMap id="DtoMap" 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="one_id" jdbcType="VARCHAR" property="oneTag" />
|
|
|
|
|
<result column="one_name" jdbcType="VARCHAR" property="oneName" />
|
|
|
|
|
<result column="two_id" jdbcType="VARCHAR" property="twoTag" />
|
|
|
|
|
<result column="two_name" jdbcType="VARCHAR" property="twoName" />
|
|
|
|
|
<result column="three_id" jdbcType="VARCHAR" property="threeTag" />
|
|
|
|
|
<result column="three_name" jdbcType="VARCHAR" property="threeName" />
|
|
|
|
|
<result column="status" jdbcType="INTEGER" property="status" />
|
|
|
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
|
|
|
<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="one_id" jdbcType="VARCHAR" property="oneTag"/>
|
|
|
|
|
<result column="one_name" jdbcType="VARCHAR" property="oneName"/>
|
|
|
|
|
<result column="two_id" jdbcType="VARCHAR" property="twoTag"/>
|
|
|
|
|
<result column="two_name" jdbcType="VARCHAR" property="twoName"/>
|
|
|
|
|
<result column="three_id" jdbcType="VARCHAR" property="threeTag"/>
|
|
|
|
|
<result column="three_name" jdbcType="VARCHAR" property="threeName"/>
|
|
|
|
|
<result column="status" jdbcType="INTEGER" property="status"/>
|
|
|
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<!--重复-->
|
|
|
|
|
<select id="selectResourceByRepeat" parameterType="java.lang.String" resultMap="DtoMap">
|
|
|
|
|
SELECT sc.one_id,sc.two_id,sc.three_id,sc.one_name,sc.two_name,sc.three_name,sr.resource_name,sr.resource_id,sr.url,sr.picture_url,sr.resource_type,sr.source,sr.status,sr.create_time
|
|
|
|
|
SELECT
|
|
|
|
|
sc.one_id,sc.two_id,sc.three_id,sc.one_name,sc.two_name,sc.three_name,sr.resource_name,sr.resource_id,sr.url,sr.picture_url,sr.resource_type,sr.source,sr.status,sr.create_time
|
|
|
|
|
FROM sys_resource sr
|
|
|
|
|
left JOIN
|
|
|
|
|
sys_resource_and_course sc
|
|
|
|
@ -411,7 +416,8 @@
|
|
|
|
|
|
|
|
|
|
<!--不重复-->
|
|
|
|
|
<select id="selectResource" parameterType="java.lang.String" resultMap="DtoMap">
|
|
|
|
|
SELECT DISTINCT sc.one_id,sc.two_id,sc.three_id,sc.one_name,sc.two_name,sc.three_name,sr.resource_name,sr.resource_id,sr.url,sr.picture_url,sr.resource_type,sr.source,sr.status,sr.create_time
|
|
|
|
|
SELECT DISTINCT
|
|
|
|
|
sc.one_id,sc.two_id,sc.three_id,sc.one_name,sc.two_name,sc.three_name,sr.resource_name,sr.resource_id,sr.url,sr.picture_url,sr.resource_type,sr.source,sr.status,sr.create_time
|
|
|
|
|
FROM sys_resource sr
|
|
|
|
|
left JOIN
|
|
|
|
|
sys_resource_and_course sc
|
|
|
|
@ -429,6 +435,7 @@
|
|
|
|
|
<if test="source != null and source != ''">
|
|
|
|
|
and sr.source in (#{source},'管理员')
|
|
|
|
|
</if>
|
|
|
|
|
and sr.source ='管理员'
|
|
|
|
|
<if test="name != null and name != ''">
|
|
|
|
|
and sr.resource_name LIKE CONCAT('%', #{name}, '%')
|
|
|
|
|
</if>
|
|
|
|
|