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.

331 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.admin.AdminDataMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.resource_center.entity.admin.AdminData">
<id column="data_id" jdbcType="VARCHAR" property="dataId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="picture_url" jdbcType="VARCHAR" property="pictureUrl" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="source" jdbcType="VARCHAR" property="source" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.sztzjy.resource_center.entity.admin.AdminDataWithBLOBs">
<result column="data_scenarios" jdbcType="LONGVARCHAR" property="dataScenarios" />
<result column="field_description" jdbcType="LONGVARCHAR" property="fieldDescription" />
</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">
data_id, name, picture_url, status, source
</sql>
<sql id="Blob_Column_List">
data_scenarios, field_description
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.sztzjy.resource_center.entity.admin.AdminDataExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from admin_data
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="com.sztzjy.resource_center.entity.admin.AdminDataExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from admin_data
<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="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from admin_data
where data_id = #{dataId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from admin_data
where data_id = #{dataId,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.resource_center.entity.admin.AdminDataExample">
delete from admin_data
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.resource_center.entity.admin.AdminDataWithBLOBs">
insert into admin_data (data_id, name, picture_url,
status, source, data_scenarios,
field_description)
values (#{dataId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{pictureUrl,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{source,jdbcType=VARCHAR}, #{dataScenarios,jdbcType=LONGVARCHAR},
#{fieldDescription,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.resource_center.entity.admin.AdminDataWithBLOBs">
insert into admin_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dataId != null">
data_id,
</if>
<if test="name != null">
name,
</if>
<if test="pictureUrl != null">
picture_url,
</if>
<if test="status != null">
status,
</if>
<if test="source != null">
source,
</if>
<if test="dataScenarios != null">
data_scenarios,
</if>
<if test="fieldDescription != null">
field_description,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dataId != null">
#{dataId,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="pictureUrl != null">
#{pictureUrl,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="source != null">
#{source,jdbcType=VARCHAR},
</if>
<if test="dataScenarios != null">
#{dataScenarios,jdbcType=LONGVARCHAR},
</if>
<if test="fieldDescription != null">
#{fieldDescription,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.resource_center.entity.admin.AdminDataExample" resultType="java.lang.Long">
select count(*) from admin_data
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update admin_data
<set>
<if test="record.dataId != null">
data_id = #{record.dataId,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.pictureUrl != null">
picture_url = #{record.pictureUrl,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.source != null">
source = #{record.source,jdbcType=VARCHAR},
</if>
<if test="record.dataScenarios != null">
data_scenarios = #{record.dataScenarios,jdbcType=LONGVARCHAR},
</if>
<if test="record.fieldDescription != null">
field_description = #{record.fieldDescription,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update admin_data
set data_id = #{record.dataId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
picture_url = #{record.pictureUrl,jdbcType=VARCHAR},
status = #{record.status,jdbcType=INTEGER},
source = #{record.source,jdbcType=VARCHAR},
data_scenarios = #{record.dataScenarios,jdbcType=LONGVARCHAR},
field_description = #{record.fieldDescription,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update admin_data
set data_id = #{record.dataId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
picture_url = #{record.pictureUrl,jdbcType=VARCHAR},
status = #{record.status,jdbcType=INTEGER},
source = #{record.source,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.resource_center.entity.admin.AdminDataWithBLOBs">
update admin_data
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="pictureUrl != null">
picture_url = #{pictureUrl,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
<if test="source != null">
source = #{source,jdbcType=VARCHAR},
</if>
<if test="dataScenarios != null">
data_scenarios = #{dataScenarios,jdbcType=LONGVARCHAR},
</if>
<if test="fieldDescription != null">
field_description = #{fieldDescription,jdbcType=LONGVARCHAR},
</if>
</set>
where data_id = #{dataId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.sztzjy.resource_center.entity.admin.AdminDataWithBLOBs">
update admin_data
set name = #{name,jdbcType=VARCHAR},
picture_url = #{pictureUrl,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
source = #{source,jdbcType=VARCHAR},
data_scenarios = #{dataScenarios,jdbcType=LONGVARCHAR},
field_description = #{fieldDescription,jdbcType=LONGVARCHAR}
where data_id = #{dataId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.resource_center.entity.admin.AdminData">
update admin_data
set name = #{name,jdbcType=VARCHAR},
picture_url = #{pictureUrl,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
source = #{source,jdbcType=VARCHAR}
where data_id = #{dataId,jdbcType=VARCHAR}
</update>
<resultMap id="dtoMap" type="com.sztzjy.resource_center.entity.admin.AdminDataReturnDto">
<id column="data_id" jdbcType="VARCHAR" property="dataId"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="picture_url" jdbcType="VARCHAR" property="pictureUrl"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="data_scenarios" jdbcType="LONGVARCHAR" property="dataScenarios"/>
<result column="field_description" jdbcType="LONGVARCHAR" property="fieldDescription"/>
<result column="source" jdbcType="VARCHAR" property="source"/>
<collection property="adminDataLabels" ofType="com.sztzjy.resource_center.entity.admin.AdminDataLabel">
<id column="label_id" jdbcType="VARCHAR" property="labelId"/>
<result column="label_name" jdbcType="VARCHAR" property="name"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="data_case_id" jdbcType="VARCHAR" property="dataCaseId"/>
</collection>
<collection property="adminFiles" ofType="com.sztzjy.resource_center.entity.admin.AdminFile">
<id column="file_url" jdbcType="VARCHAR" property="fileUrl"/>
<id column="file_id" jdbcType="VARCHAR" property="fileId"/>
<result column="file_name" jdbcType="VARCHAR" property="name"/>
<result column="source" jdbcType="VARCHAR" property="source"/>
<result column="data_case_id" jdbcType="VARCHAR" property="dataCaseId"/>
</collection>
</resultMap>
<select id="selectByConditions" resultMap="dtoMap">
SELECT a.data_id,a.name,a.picture_url,a.data_scenarios,a.field_description,a.`status`,a.source,
ad.`name`as label_name,ad.label_id,ad.type,ad.data_case_id,
af.file_url,af.`name` as file_name,af.source,af.file_id,af.data_case_id
FROM admin_data a
left join admin_data_label ad ON a.data_id = ad.data_case_id
LEFT JOIN admin_file af on a.data_id = af.data_case_id
<where>
a.status=1
<if test="keyWord !=null and keyWord !=''">
and a.name like CONCAT('%', #{keyWord}, '%')
</if>
<if test="labelName !=null and labelName !=''">
and ad.name = #{labelName}
</if>
<if test="source !=null and source !=''">
and a.source = #{source}
</if>
</where>
</select>
</mapper>