修改案例相关sql

master
xiaoCJ 4 months ago
parent 8f15c374de
commit df80528656

@ -228,12 +228,12 @@ public class AdminCaseController {
@PostMapping("get") @PostMapping("get")
@ApiOperation("展示") @ApiOperation("管理员展示")
@AnonymousAccess @AnonymousAccess
private ResultEntity<PageInfo<AdminCaseReturnDto>> get(@RequestParam Integer index, private ResultEntity<PageInfo<AdminCaseReturnDto>> get(@RequestParam Integer index,
@RequestParam Integer size, @RequestParam Integer size,
@RequestParam(required = false) String keyWord, @RequestParam(required = false) String keyWord,
@ApiParam("精品案例不传,院校案例传'院校案例'") @RequestParam(required = false) String source, @RequestParam(required = false) String source,
@RequestParam(required = false) String labelName) { @RequestParam(required = false) String labelName) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
if (StringUtils.isNotBlank(labelName)) { 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") @PostMapping("updateAdminCase")
@ApiOperation("案例编辑/没改的参数别传") @ApiOperation("案例编辑/没改的参数别传")
@Transactional @Transactional

@ -162,7 +162,7 @@ public class AdminDataController {
@PostMapping("get") @PostMapping("get")
@ApiOperation("展示") @ApiOperation("管理员展示")
@AnonymousAccess @AnonymousAccess
private ResultEntity<PageInfo<AdminDataReturnDto>> add(@RequestParam Integer index, private ResultEntity<PageInfo<AdminDataReturnDto>> add(@RequestParam Integer index,
@RequestParam Integer size, @RequestParam Integer size,
@ -174,6 +174,20 @@ public class AdminDataController {
return new ResultEntity<>(pageInfo); 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") @PostMapping("updateAdminData")
@ApiOperation("编辑") @ApiOperation("编辑")

@ -48,4 +48,8 @@ public interface AdminCaseMapper {
@Param("source") String source, @Param("source") String source,
@Param("labelName") List<String> list); @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("source") String source,
@Param("userId") String userId, @Param("userId") String userId,
@Param("labelName") String labelName); @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> </foreach>
</if> </if>
<if test="source !=null and source !=''"> <if test="source !=null and source !=''">
and a.source in (#{source},'管理员') and a.source =#{source}
</if>
<if test="source ==null">
and a.source !='管理员'
</if> </if>
</where> </where>
order by a.create_time desc order by a.create_time desc
</select> </select>
<select id="selectByConditionsByStu" resultMap="dtoMap"> <select id="selectByConditionsByStu" resultMap="dtoMap">
SELECT a.id,a.name,a.content,a.catalog,a.picture_url,a.`status`,a.source,a.create_time, 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, ad.`name`as label_name,ad.label_id,ad.type,ad.data_case_id,
@ -402,7 +404,7 @@
and a.source = #{source} and a.source = #{source}
</if> </if>
<if test="source == '管理员'"> <if test="source == '管理员'">
and a.source in (#{source},'管理员') and a.source ='管理员'
</if> </if>
<if test="userId !=null and userId !=''"> <if test="userId !=null and userId !=''">
and acc.user_id = #{userId} and acc.user_id = #{userId}
@ -410,4 +412,32 @@
</where> </where>
order by a.create_time desc order by a.create_time desc
</select> </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> </mapper>

@ -1,412 +1,452 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <mapper namespace="com.sztzjy.resource_center.mapper.admin.AdminDataMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.resource_center.entity.admin.AdminData"> <resultMap id="BaseResultMap" type="com.sztzjy.resource_center.entity.admin.AdminData">
<id column="data_id" jdbcType="VARCHAR" property="dataId" /> <id column="data_id" jdbcType="VARCHAR" property="dataId"/>
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name"/>
<result column="picture_url" jdbcType="VARCHAR" property="pictureUrl" /> <result column="picture_url" jdbcType="VARCHAR" property="pictureUrl"/>
<result column="status" jdbcType="INTEGER" property="status" /> <result column="status" jdbcType="INTEGER" property="status"/>
<result column="source" jdbcType="VARCHAR" property="source" /> <result column="source" jdbcType="VARCHAR" property="source"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.sztzjy.resource_center.entity.admin.AdminDataWithBLOBs"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs"
<result column="data_scenarios" jdbcType="LONGVARCHAR" property="dataScenarios" /> type="com.sztzjy.resource_center.entity.admin.AdminDataWithBLOBs">
<result column="data_scenarios_original" jdbcType="LONGVARCHAR" property="dataScenariosOriginal" /> <result column="data_scenarios" jdbcType="LONGVARCHAR" property="dataScenarios"/>
<result column="field_description" jdbcType="LONGVARCHAR" property="fieldDescription" /> <result column="data_scenarios_original" jdbcType="LONGVARCHAR" property="dataScenariosOriginal"/>
<result column="field_description_original" jdbcType="LONGVARCHAR" property="fieldDescriptionOriginal" /> <result column="field_description" jdbcType="LONGVARCHAR" property="fieldDescription"/>
</resultMap> <result column="field_description_original" jdbcType="LONGVARCHAR" property="fieldDescriptionOriginal"/>
<sql id="Example_Where_Clause"> </resultMap>
<where> <sql id="Example_Where_Clause">
<foreach collection="oredCriteria" item="criteria" separator="or"> <where>
<if test="criteria.valid"> <foreach collection="oredCriteria" item="criteria" separator="or">
<trim prefix="(" prefixOverrides="and" suffix=")"> <if test="criteria.valid">
<foreach collection="criteria.criteria" item="criterion"> <trim prefix="(" prefixOverrides="and" suffix=")">
<choose> <foreach collection="criteria.criteria" item="criterion">
<when test="criterion.noValue"> <choose>
and ${criterion.condition} <when test="criterion.noValue">
</when> and ${criterion.condition}
<when test="criterion.singleValue"> </when>
and ${criterion.condition} #{criterion.value} <when test="criterion.singleValue">
</when> and ${criterion.condition} #{criterion.value}
<when test="criterion.betweenValue"> </when>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} <when test="criterion.betweenValue">
</when> and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
<when test="criterion.listValue"> </when>
and ${criterion.condition} <when test="criterion.listValue">
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> and ${criterion.condition}
#{listItem} <foreach close=")" collection="criterion.value" item="listItem" open="("
</foreach> separator=",">
</when> #{listItem}
</choose> </foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach> </foreach>
</trim> </where>
</if> </sql>
</foreach> <sql id="Update_By_Example_Where_Clause">
</where> <where>
</sql> <foreach collection="example.oredCriteria" item="criteria" separator="or">
<sql id="Update_By_Example_Where_Clause"> <if test="criteria.valid">
<where> <trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="example.oredCriteria" item="criteria" separator="or"> <foreach collection="criteria.criteria" item="criterion">
<if test="criteria.valid"> <choose>
<trim prefix="(" prefixOverrides="and" suffix=")"> <when test="criterion.noValue">
<foreach collection="criteria.criteria" item="criterion"> and ${criterion.condition}
<choose> </when>
<when test="criterion.noValue"> <when test="criterion.singleValue">
and ${criterion.condition} and ${criterion.condition} #{criterion.value}
</when> </when>
<when test="criterion.singleValue"> <when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when> </when>
<when test="criterion.betweenValue"> <when test="criterion.listValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} and ${criterion.condition}
</when> <foreach close=")" collection="criterion.value" item="listItem" open="("
<when test="criterion.listValue"> separator=",">
and ${criterion.condition} #{listItem}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> </foreach>
#{listItem} </when>
</foreach> </choose>
</when> </foreach>
</choose> </trim>
</if>
</foreach> </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> </if>
</foreach> </update>
</where> <update id="updateByExampleWithBLOBs" parameterType="map">
</sql> update admin_data
<sql id="Base_Column_List"> set data_id = #{record.dataId,jdbcType=VARCHAR},
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}, name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.pictureUrl != null">
picture_url = #{record.pictureUrl,jdbcType=VARCHAR}, picture_url = #{record.pictureUrl,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=INTEGER}, status = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.source != null">
source = #{record.source,jdbcType=VARCHAR}, source = #{record.source,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.dataScenarios != null">
data_scenarios = #{record.dataScenarios,jdbcType=LONGVARCHAR}, data_scenarios = #{record.dataScenarios,jdbcType=LONGVARCHAR},
</if>
<if test="record.dataScenariosOriginal != null">
data_scenarios_original = #{record.dataScenariosOriginal,jdbcType=LONGVARCHAR}, data_scenarios_original = #{record.dataScenariosOriginal,jdbcType=LONGVARCHAR},
</if>
<if test="record.fieldDescription != null">
field_description = #{record.fieldDescription,jdbcType=LONGVARCHAR}, field_description = #{record.fieldDescription,jdbcType=LONGVARCHAR},
</if> field_description_original = #{record.fieldDescriptionOriginal,jdbcType=LONGVARCHAR}
<if test="record.fieldDescriptionOriginal != null"> <if test="_parameter != null">
field_description_original = #{record.fieldDescriptionOriginal,jdbcType=LONGVARCHAR}, <include refid="Update_By_Example_Where_Clause"/>
</if> </if>
</set> </update>
<if test="_parameter != null"> <update id="updateByExample" parameterType="map">
<include refid="Update_By_Example_Where_Clause" /> update admin_data
</if> set data_id = #{record.dataId,jdbcType=VARCHAR},
</update> name = #{record.name,jdbcType=VARCHAR},
<update id="updateByExampleWithBLOBs" parameterType="map"> picture_url = #{record.pictureUrl,jdbcType=VARCHAR},
update admin_data status = #{record.status,jdbcType=INTEGER},
set data_id = #{record.dataId,jdbcType=VARCHAR}, source = #{record.source,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=TIMESTAMP}
picture_url = #{record.pictureUrl,jdbcType=VARCHAR}, <if test="_parameter != null">
status = #{record.status,jdbcType=INTEGER}, <include refid="Update_By_Example_Where_Clause"/>
source = #{record.source,jdbcType=VARCHAR}, </if>
create_time = #{record.createTime,jdbcType=TIMESTAMP}, </update>
data_scenarios = #{record.dataScenarios,jdbcType=LONGVARCHAR}, <update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.resource_center.entity.admin.AdminDataWithBLOBs">
data_scenarios_original = #{record.dataScenariosOriginal,jdbcType=LONGVARCHAR}, update admin_data
field_description = #{record.fieldDescription,jdbcType=LONGVARCHAR}, <set>
field_description_original = #{record.fieldDescriptionOriginal,jdbcType=LONGVARCHAR} <if test="name != null">
<if test="_parameter != null"> name = #{name,jdbcType=VARCHAR},
<include refid="Update_By_Example_Where_Clause" /> </if>
</if> <if test="pictureUrl != null">
</update> picture_url = #{pictureUrl,jdbcType=VARCHAR},
<update id="updateByExample" parameterType="map"> </if>
update admin_data <if test="status != null">
set data_id = #{record.dataId,jdbcType=VARCHAR}, status = #{status,jdbcType=INTEGER},
name = #{record.name,jdbcType=VARCHAR}, </if>
picture_url = #{record.pictureUrl,jdbcType=VARCHAR}, <if test="source != null">
status = #{record.status,jdbcType=INTEGER}, source = #{source,jdbcType=VARCHAR},
source = #{record.source,jdbcType=VARCHAR}, </if>
create_time = #{record.createTime,jdbcType=TIMESTAMP} <if test="createTime != null">
<if test="_parameter != null"> create_time = #{createTime,jdbcType=TIMESTAMP},
<include refid="Update_By_Example_Where_Clause" /> </if>
</if> <if test="dataScenarios != null">
</update> data_scenarios = #{dataScenarios,jdbcType=LONGVARCHAR},
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.resource_center.entity.admin.AdminDataWithBLOBs"> </if>
update admin_data <if test="dataScenariosOriginal != null">
<set> data_scenarios_original = #{dataScenariosOriginal,jdbcType=LONGVARCHAR},
<if test="name != null"> </if>
name = #{name,jdbcType=VARCHAR}, <if test="fieldDescription != null">
</if> field_description = #{fieldDescription,jdbcType=LONGVARCHAR},
<if test="pictureUrl != null"> </if>
picture_url = #{pictureUrl,jdbcType=VARCHAR}, <if test="fieldDescriptionOriginal != null">
</if> field_description_original = #{fieldDescriptionOriginal,jdbcType=LONGVARCHAR},
<if test="status != null"> </if>
status = #{status,jdbcType=INTEGER}, </set>
</if> where data_id = #{dataId,jdbcType=VARCHAR}
<if test="source != null"> </update>
source = #{source,jdbcType=VARCHAR}, <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.sztzjy.resource_center.entity.admin.AdminDataWithBLOBs">
</if> update admin_data
<if test="createTime != null"> set name = #{name,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}, picture_url = #{pictureUrl,jdbcType=VARCHAR},
</if> status = #{status,jdbcType=INTEGER},
<if test="dataScenarios != null"> source = #{source,jdbcType=VARCHAR},
data_scenarios = #{dataScenarios,jdbcType=LONGVARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP},
</if> data_scenarios = #{dataScenarios,jdbcType=LONGVARCHAR},
<if test="dataScenariosOriginal != null"> data_scenarios_original = #{dataScenariosOriginal,jdbcType=LONGVARCHAR},
data_scenarios_original = #{dataScenariosOriginal,jdbcType=LONGVARCHAR}, field_description = #{fieldDescription,jdbcType=LONGVARCHAR},
</if> field_description_original = #{fieldDescriptionOriginal,jdbcType=LONGVARCHAR}
<if test="fieldDescription != null"> where data_id = #{dataId,jdbcType=VARCHAR}
field_description = #{fieldDescription,jdbcType=LONGVARCHAR}, </update>
</if> <update id="updateByPrimaryKey" parameterType="com.sztzjy.resource_center.entity.admin.AdminData">
<if test="fieldDescriptionOriginal != null"> update admin_data
field_description_original = #{fieldDescriptionOriginal,jdbcType=LONGVARCHAR}, set name = #{name,jdbcType=VARCHAR},
</if> picture_url = #{pictureUrl,jdbcType=VARCHAR},
</set> status = #{status,jdbcType=INTEGER},
where data_id = #{dataId,jdbcType=VARCHAR} source = #{source,jdbcType=VARCHAR},
</update> create_time = #{createTime,jdbcType=TIMESTAMP}
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.sztzjy.resource_center.entity.admin.AdminDataWithBLOBs"> where data_id = #{dataId,jdbcType=VARCHAR}
update admin_data </update>
set name = #{name,jdbcType=VARCHAR}, <resultMap id="dtoMap" type="com.sztzjy.resource_center.entity.admin.AdminDataReturnDto">
picture_url = #{pictureUrl,jdbcType=VARCHAR}, <id column="data_id" jdbcType="VARCHAR" property="dataId"/>
status = #{status,jdbcType=INTEGER}, <result column="name" jdbcType="VARCHAR" property="name"/>
source = #{source,jdbcType=VARCHAR}, <result column="picture_url" jdbcType="VARCHAR" property="pictureUrl"/>
create_time = #{createTime,jdbcType=TIMESTAMP}, <result column="status" jdbcType="INTEGER" property="status"/>
data_scenarios = #{dataScenarios,jdbcType=LONGVARCHAR}, <result column="data_scenarios" jdbcType="LONGVARCHAR" property="dataScenarios"/>
data_scenarios_original = #{dataScenariosOriginal,jdbcType=LONGVARCHAR}, <result column="data_scenarios_original" jdbcType="LONGVARCHAR" property="dataScenariosOriginal"/>
field_description = #{fieldDescription,jdbcType=LONGVARCHAR}, <result column="field_description" jdbcType="LONGVARCHAR" property="fieldDescription"/>
field_description_original = #{fieldDescriptionOriginal,jdbcType=LONGVARCHAR} <result column="field_description_original" jdbcType="LONGVARCHAR" property="fieldDescriptionOriginal"/>
where data_id = #{dataId,jdbcType=VARCHAR} <result column="source" jdbcType="VARCHAR" property="source"/>
</update> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.resource_center.entity.admin.AdminData"> <result column="id" jdbcType="VARCHAR" property="collectId"/>
update admin_data <collection property="adminDataLabels" ofType="com.sztzjy.resource_center.entity.admin.AdminDataLabel">
set name = #{name,jdbcType=VARCHAR}, <id column="label_id" jdbcType="VARCHAR" property="labelId"/>
picture_url = #{pictureUrl,jdbcType=VARCHAR}, <result column="label_name" jdbcType="VARCHAR" property="name"/>
status = #{status,jdbcType=INTEGER}, <result column="type" jdbcType="VARCHAR" property="type"/>
source = #{source,jdbcType=VARCHAR}, <result column="data_case_id" jdbcType="VARCHAR" property="dataCaseId"/>
create_time = #{createTime,jdbcType=TIMESTAMP} </collection>
where data_id = #{dataId,jdbcType=VARCHAR} <collection property="adminFiles" ofType="com.sztzjy.resource_center.entity.admin.AdminFile">
</update> <id column="file_url" jdbcType="VARCHAR" property="fileUrl"/>
<resultMap id="dtoMap" type="com.sztzjy.resource_center.entity.admin.AdminDataReturnDto"> <id column="file_id" jdbcType="VARCHAR" property="fileId"/>
<id column="data_id" jdbcType="VARCHAR" property="dataId"/> <result column="file_name" jdbcType="VARCHAR" property="name"/>
<result column="name" jdbcType="VARCHAR" property="name"/> <result column="source" jdbcType="VARCHAR" property="source"/>
<result column="picture_url" jdbcType="VARCHAR" property="pictureUrl"/> <result column="data_case_id" jdbcType="VARCHAR" property="dataCaseId"/>
<result column="status" jdbcType="INTEGER" property="status"/> </collection>
<result column="data_scenarios" jdbcType="LONGVARCHAR" property="dataScenarios"/> </resultMap>
<result column="data_scenarios_original" jdbcType="LONGVARCHAR" property="dataScenariosOriginal"/>
<result column="field_description" jdbcType="LONGVARCHAR" property="fieldDescription"/> <select id="selectByConditions" resultMap="dtoMap">
<result column="field_description_original" jdbcType="LONGVARCHAR" property="fieldDescriptionOriginal"/> SELECT
<result column="source" jdbcType="VARCHAR" property="source"/> 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,
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> ad.`name`as label_name,ad.label_id,ad.type,ad.data_case_id,
<result column="id" jdbcType="VARCHAR" property="collectId"/> af.file_url,af.`name` as file_name,af.source,af.file_id,af.data_case_id
<collection property="adminDataLabels" ofType="com.sztzjy.resource_center.entity.admin.AdminDataLabel"> FROM admin_data a
<id column="label_id" jdbcType="VARCHAR" property="labelId"/> LEFT join admin_data_label ad ON a.data_id = ad.data_case_id
<result column="label_name" jdbcType="VARCHAR" property="name"/> LEFT JOIN admin_file af on a.data_id = af.data_case_id
<result column="type" jdbcType="VARCHAR" property="type"/> LEFT JOIN admin_collect_data acc on a.data_id = acc.data_id
<result column="data_case_id" jdbcType="VARCHAR" property="dataCaseId"/> <where>
</collection> <if test="keyWord !=null and keyWord !=''">
<collection property="adminFiles" ofType="com.sztzjy.resource_center.entity.admin.AdminFile"> and a.name like CONCAT('%', #{keyWord}, '%')
<id column="file_url" jdbcType="VARCHAR" property="fileUrl"/> </if>
<id column="file_id" jdbcType="VARCHAR" property="fileId"/> <if test="labelName !=null and labelName !=''">
<result column="file_name" jdbcType="VARCHAR" property="name"/> and ad.name in (#{labelName})
<result column="source" jdbcType="VARCHAR" property="source"/> </if>
<result column="data_case_id" jdbcType="VARCHAR" property="dataCaseId"/> <if test="source !=null and source !=''">
</collection> and a.source !='管理员'
</resultMap> </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> </mapper>
Loading…
Cancel
Save