修改案例相关sql

master
xiaoCJ 4 months ago
parent 8f15c374de
commit df80528656

@ -228,12 +228,12 @@ public class AdminCaseController {
@PostMapping("get")
@ApiOperation("展示")
@ApiOperation("管理员展示")
@AnonymousAccess
private ResultEntity<PageInfo<AdminCaseReturnDto>> get(@RequestParam Integer index,
@RequestParam Integer size,
@RequestParam(required = false) String keyWord,
@ApiParam("精品案例不传,院校案例传'院校案例'") @RequestParam(required = false) String source,
@RequestParam(required = false) String source,
@RequestParam(required = false) String labelName) {
List<String> list = new ArrayList<>();
if (StringUtils.isNotBlank(labelName)) {
@ -246,6 +246,25 @@ public class AdminCaseController {
}
@PostMapping("teaGet")
@ApiOperation("老师端展示")
@AnonymousAccess
private ResultEntity<PageInfo<AdminCaseReturnDto>> teaGet(@RequestParam Integer index,
@RequestParam Integer size,
@RequestParam(required = false) String keyWord,
@RequestParam(required = false) String source,
@RequestParam(required = false) String labelName) {
List<String> list = new ArrayList<>();
if (StringUtils.isNotBlank(labelName)) {
String[] split = labelName.split(",");
list = Arrays.asList(split);
}
List<AdminCaseReturnDto> adminCaseReturnDtos = adminCaseMapper.teaSelectByConditions(keyWord, source, list);
PageInfo pageInfo = PageUtil.pageHelper(adminCaseReturnDtos, index, size);
return new ResultEntity<>(pageInfo);
}
@PostMapping("updateAdminCase")
@ApiOperation("案例编辑/没改的参数别传")
@Transactional

@ -162,7 +162,7 @@ public class AdminDataController {
@PostMapping("get")
@ApiOperation("展示")
@ApiOperation("管理员展示")
@AnonymousAccess
private ResultEntity<PageInfo<AdminDataReturnDto>> add(@RequestParam Integer index,
@RequestParam Integer size,
@ -174,6 +174,20 @@ public class AdminDataController {
return new ResultEntity<>(pageInfo);
}
@PostMapping("teaGet")
@ApiOperation("老师端展示")
@AnonymousAccess
private ResultEntity<PageInfo<AdminDataReturnDto>> teaGet(@RequestParam Integer index,
@RequestParam Integer size,
@RequestParam(required = false) String keyWord,
@ApiParam("0全部1院校") @RequestParam Integer type,
@ApiParam("学校ID") @RequestParam String source,
@RequestParam(required = false) String labelName) {
List<AdminDataReturnDto> adminDataReturnDtos = adminDataMapper.teaSelectByConditions(keyWord, type,source, labelName);
PageInfo pageInfo = PageUtil.pageHelper(adminDataReturnDtos, index, size);
return new ResultEntity<>(pageInfo);
}
@PostMapping("updateAdminData")
@ApiOperation("编辑")

@ -48,4 +48,8 @@ public interface AdminCaseMapper {
@Param("source") String source,
@Param("labelName") List<String> list);
List<AdminCaseReturnDto> teaSelectByConditions(@Param("keyWord") String keyWord,
@Param("source") String source,
@Param("labelName") List<String> list);
}

@ -46,4 +46,9 @@ public interface AdminDataMapper {
@Param("source") String source,
@Param("userId") String userId,
@Param("labelName") String labelName);
List<AdminDataReturnDto> teaSelectByConditions(@Param("keyWord") String keyWord,
@Param("type") Integer type,
@Param("source") String source,
@Param("labelName") String labelName);
}

@ -372,13 +372,15 @@
</foreach>
</if>
<if test="source !=null and source !=''">
and a.source in (#{source},'管理员')
and a.source =#{source}
</if>
<if test="source ==null">
and a.source !='管理员'
</if>
</where>
order by a.create_time desc
</select>
<select id="selectByConditionsByStu" resultMap="dtoMap">
SELECT a.id,a.name,a.content,a.catalog,a.picture_url,a.`status`,a.source,a.create_time,
ad.`name`as label_name,ad.label_id,ad.type,ad.data_case_id,
@ -402,7 +404,7 @@
and a.source = #{source}
</if>
<if test="source == '管理员'">
and a.source in (#{source},'管理员')
and a.source ='管理员'
</if>
<if test="userId !=null and userId !=''">
and acc.user_id = #{userId}
@ -410,4 +412,32 @@
</where>
order by a.create_time desc
</select>
<select id="teaSelectByConditions" resultMap="dtoMap">
SELECT a.id,a.name,a.content,a.catalog,a.picture_url,a.`status`,a.source,a.create_time,
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_case a
LEFT join admin_data_label ad ON a.id = ad.data_case_id
LEFT JOIN admin_file af on a.id = af.data_case_id
LEFT JOIN admin_collect_case acc on a.id = acc.case_id
<where>
<if test="keyWord !=null and keyWord !=''">
and a.name like CONCAT('%', #{keyWord}, '%')
</if>
<if test="labelName !=null and labelName.size() > 0">
and ad.name in
<foreach collection="labelName" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="source !=null and source !=''">
and a.source =#{source}
</if>
<if test="source ==null or source ==''">
and a.source in('管理员',#{source})
</if>
</where>
order by a.create_time desc
</select>
</mapper>

@ -1,412 +1,452 @@
<?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" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.sztzjy.resource_center.entity.admin.AdminDataWithBLOBs">
<result column="data_scenarios" jdbcType="LONGVARCHAR" property="dataScenarios" />
<result column="data_scenarios_original" jdbcType="LONGVARCHAR" property="dataScenariosOriginal" />
<result column="field_description" jdbcType="LONGVARCHAR" property="fieldDescription" />
<result column="field_description_original" jdbcType="LONGVARCHAR" property="fieldDescriptionOriginal" />
</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>
<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"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs"
type="com.sztzjy.resource_center.entity.admin.AdminDataWithBLOBs">
<result column="data_scenarios" jdbcType="LONGVARCHAR" property="dataScenarios"/>
<result column="data_scenarios_original" jdbcType="LONGVARCHAR" property="dataScenariosOriginal"/>
<result column="field_description" jdbcType="LONGVARCHAR" property="fieldDescription"/>
<result column="field_description_original" jdbcType="LONGVARCHAR" property="fieldDescriptionOriginal"/>
</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>
</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>
</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>
</trim>
</where>
</sql>
<sql id="Base_Column_List">
data_id
, name, picture_url, status, source, create_time
</sql>
<sql id="Blob_Column_List">
data_scenarios
, data_scenarios_original, field_description, field_description_original
</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, create_time,
data_scenarios, data_scenarios_original,
field_description, field_description_original)
values (#{dataId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{pictureUrl,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{source,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{dataScenarios,jdbcType=LONGVARCHAR}, #{dataScenariosOriginal,jdbcType=LONGVARCHAR},
#{fieldDescription,jdbcType=LONGVARCHAR}, #{fieldDescriptionOriginal,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="createTime != null">
create_time,
</if>
<if test="dataScenarios != null">
data_scenarios,
</if>
<if test="dataScenariosOriginal != null">
data_scenarios_original,
</if>
<if test="fieldDescription != null">
field_description,
</if>
<if test="fieldDescriptionOriginal != null">
field_description_original,
</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="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="dataScenarios != null">
#{dataScenarios,jdbcType=LONGVARCHAR},
</if>
<if test="dataScenariosOriginal != null">
#{dataScenariosOriginal,jdbcType=LONGVARCHAR},
</if>
<if test="fieldDescription != null">
#{fieldDescription,jdbcType=LONGVARCHAR},
</if>
<if test="fieldDescriptionOriginal != null">
#{fieldDescriptionOriginal,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.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.dataScenarios != null">
data_scenarios = #{record.dataScenarios,jdbcType=LONGVARCHAR},
</if>
<if test="record.dataScenariosOriginal != null">
data_scenarios_original = #{record.dataScenariosOriginal,jdbcType=LONGVARCHAR},
</if>
<if test="record.fieldDescription != null">
field_description = #{record.fieldDescription,jdbcType=LONGVARCHAR},
</if>
<if test="record.fieldDescriptionOriginal != null">
field_description_original = #{record.fieldDescriptionOriginal,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
data_id, name, picture_url, status, source, create_time
</sql>
<sql id="Blob_Column_List">
data_scenarios, data_scenarios_original, field_description, field_description_original
</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, create_time,
data_scenarios, data_scenarios_original,
field_description, field_description_original
)
values (#{dataId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{pictureUrl,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{source,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{dataScenarios,jdbcType=LONGVARCHAR}, #{dataScenariosOriginal,jdbcType=LONGVARCHAR},
#{fieldDescription,jdbcType=LONGVARCHAR}, #{fieldDescriptionOriginal,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="createTime != null">
create_time,
</if>
<if test="dataScenarios != null">
data_scenarios,
</if>
<if test="dataScenariosOriginal != null">
data_scenarios_original,
</if>
<if test="fieldDescription != null">
field_description,
</if>
<if test="fieldDescriptionOriginal != null">
field_description_original,
</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="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="dataScenarios != null">
#{dataScenarios,jdbcType=LONGVARCHAR},
</if>
<if test="dataScenariosOriginal != null">
#{dataScenariosOriginal,jdbcType=LONGVARCHAR},
</if>
<if test="fieldDescription != null">
#{fieldDescription,jdbcType=LONGVARCHAR},
</if>
<if test="fieldDescriptionOriginal != null">
#{fieldDescriptionOriginal,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">
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update admin_data
set data_id = #{record.dataId,jdbcType=VARCHAR},
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.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.dataScenarios != null">
data_scenarios = #{record.dataScenarios,jdbcType=LONGVARCHAR},
</if>
<if test="record.dataScenariosOriginal != null">
data_scenarios_original = #{record.dataScenariosOriginal,jdbcType=LONGVARCHAR},
</if>
<if test="record.fieldDescription != null">
field_description = #{record.fieldDescription,jdbcType=LONGVARCHAR},
</if>
<if test="record.fieldDescriptionOriginal != null">
field_description_original = #{record.fieldDescriptionOriginal,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},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
data_scenarios = #{record.dataScenarios,jdbcType=LONGVARCHAR},
data_scenarios_original = #{record.dataScenariosOriginal,jdbcType=LONGVARCHAR},
field_description = #{record.fieldDescription,jdbcType=LONGVARCHAR},
field_description_original = #{record.fieldDescriptionOriginal,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},
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.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="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="dataScenarios != null">
data_scenarios = #{dataScenarios,jdbcType=LONGVARCHAR},
</if>
<if test="dataScenariosOriginal != null">
data_scenarios_original = #{dataScenariosOriginal,jdbcType=LONGVARCHAR},
</if>
<if test="fieldDescription != null">
field_description = #{fieldDescription,jdbcType=LONGVARCHAR},
</if>
<if test="fieldDescriptionOriginal != null">
field_description_original = #{fieldDescriptionOriginal,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},
create_time = #{createTime,jdbcType=TIMESTAMP},
data_scenarios = #{dataScenarios,jdbcType=LONGVARCHAR},
data_scenarios_original = #{dataScenariosOriginal,jdbcType=LONGVARCHAR},
field_description = #{fieldDescription,jdbcType=LONGVARCHAR},
field_description_original = #{fieldDescriptionOriginal,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},
create_time = #{createTime,jdbcType=TIMESTAMP}
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="data_scenarios_original" jdbcType="LONGVARCHAR" property="dataScenariosOriginal"/>
<result column="field_description" jdbcType="LONGVARCHAR" property="fieldDescription"/>
<result column="field_description_original" jdbcType="LONGVARCHAR" property="fieldDescriptionOriginal"/>
<result column="source" jdbcType="VARCHAR" property="source"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="id" jdbcType="VARCHAR" property="collectId"/>
<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>
field_description_original = #{record.fieldDescriptionOriginal,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},
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.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="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="dataScenarios != null">
data_scenarios = #{dataScenarios,jdbcType=LONGVARCHAR},
</if>
<if test="dataScenariosOriginal != null">
data_scenarios_original = #{dataScenariosOriginal,jdbcType=LONGVARCHAR},
</if>
<if test="fieldDescription != null">
field_description = #{fieldDescription,jdbcType=LONGVARCHAR},
</if>
<if test="fieldDescriptionOriginal != null">
field_description_original = #{fieldDescriptionOriginal,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},
create_time = #{createTime,jdbcType=TIMESTAMP},
data_scenarios = #{dataScenarios,jdbcType=LONGVARCHAR},
data_scenarios_original = #{dataScenariosOriginal,jdbcType=LONGVARCHAR},
field_description = #{fieldDescription,jdbcType=LONGVARCHAR},
field_description_original = #{fieldDescriptionOriginal,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},
create_time = #{createTime,jdbcType=TIMESTAMP}
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="data_scenarios_original" jdbcType="LONGVARCHAR" property="dataScenariosOriginal"/>
<result column="field_description" jdbcType="LONGVARCHAR" property="fieldDescription"/>
<result column="field_description_original" jdbcType="LONGVARCHAR" property="fieldDescriptionOriginal"/>
<result column="source" jdbcType="VARCHAR" property="source"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="id" jdbcType="VARCHAR" property="collectId"/>
<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.data_scenarios_original,a.field_description,a.field_description_original,a.`status`,a.source,a.create_time,
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
LEFT JOIN admin_collect_data acc on a.data_id = acc.data_id
<where>
<if test="keyWord !=null and keyWord !=''">
and a.name like CONCAT('%', #{keyWord}, '%')
</if>
<if test="labelName !=null and labelName !=''">
and ad.name in (#{labelName})
</if>
<if test="source !=null and source !=''">
and a.source !='管理员'
</if>
</where>
order by a.create_time desc
</select>
<select id="selectByConditionsBySchoolId" resultMap="dtoMap">
SELECT
a.data_id,a.name,a.picture_url,a.data_scenarios,a.data_scenarios_original,a.field_description,a.field_description_original,a.`status`,a.source,a.create_time,
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,
acc.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
LEFT JOIN admin_collect_data acc on a.data_id = acc.data_id
<where>
and 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>
<if test="source ==null">
and a.source ='管理员'
</if>
<if test="userId !=null and userId !=''">
and acc.user_id = #{userId}
</if>
</where>
order by a.create_time desc
</select>
<select id="selectByConditions" resultMap="dtoMap">
SELECT a.data_id,a.name,a.picture_url,a.data_scenarios,a.data_scenarios_original,a.field_description,a.field_description_original,a.`status`,a.source,a.create_time,
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
LEFT JOIN admin_collect_data acc on a.data_id = acc.data_id
<where>
<if test="keyWord !=null and keyWord !=''">
and a.name like CONCAT('%', #{keyWord}, '%')
</if>
<if test="labelName !=null and labelName !=''">
and ad.name in (#{labelName})
</if>
<if test="source !=null and source !=''">
and a.source in (#{source},'管理员')
</if>
</where>
order by a.create_time desc
</select>
<select id="teaSelectByConditions" resultMap="dtoMap">
SELECT
a.data_id,a.name,a.picture_url,a.data_scenarios,a.data_scenarios_original,a.field_description,a.field_description_original,a.`status`,a.source,a.create_time,
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
LEFT JOIN admin_collect_data acc on a.data_id = acc.data_id
<where>
<if test="keyWord !=null and keyWord !=''">
and a.name like CONCAT('%', #{keyWord}, '%')
</if>
<if test="labelName !=null and labelName !=''">
and ad.name in (#{labelName})
</if>
<if test="type == 1">
AND a.source = #{source}
</if>
<if test="type == 0">
AND a.source IN ('管理员', #{source})
</if>
</where>
order by a.create_time desc
</select>
<select id="selectByConditionsBySchoolId" resultMap="dtoMap">
SELECT a.data_id,a.name,a.picture_url,a.data_scenarios,a.data_scenarios_original,a.field_description,a.field_description_original,a.`status`,a.source,a.create_time,
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,
acc.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
LEFT JOIN admin_collect_data acc on a.data_id = acc.data_id
<where>
and 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 in (#{source},'管理员')
</if>
<if test="userId !=null and userId !=''">
and acc.user_id = #{userId}
</if>
</where>
order by a.create_time desc
</select>
</mapper>
Loading…
Cancel
Save