新增删除接口,修改部分逻辑

master
xiaoCJ 8 months ago
parent 0fbd48b449
commit 3363ef88c8

@ -60,14 +60,14 @@ public class CaseStepController {
// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "该案例题正在被使用!");
// }
// else {
//todo 管理员任意修改,老师只能改自己的
SysCaseQuestion sysCaseQuestion = sysCaseQuestionMapper.selectByPrimaryKey(caseQuestionStepWithBLOBs.getCaseId());
if ("管理员".equals(source) || source.equals(sysCaseQuestion.getSource())) {
caseQuestionStepMapper.updateByPrimaryKeyWithBLOBs(caseQuestionStepWithBLOBs);
return new ResultEntity<>(HttpStatus.OK, "编辑成功!");
} else {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "权限不足!");
}
//todo 管理员任意修改,老师只能改自己的
SysCaseQuestion sysCaseQuestion = sysCaseQuestionMapper.selectByPrimaryKey(caseQuestionStepWithBLOBs.getCaseId());
if ("管理员".equals(source) || source.equals(sysCaseQuestion.getSource())) {
caseQuestionStepMapper.updateByPrimaryKeyWithBLOBs(caseQuestionStepWithBLOBs);
return new ResultEntity<>(HttpStatus.OK, "编辑成功!");
} else {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "权限不足!");
}
// }
}
@ -77,19 +77,17 @@ public class CaseStepController {
@PostMapping("deleteCase")
public ResultEntity<HttpStatus> deleteCase(@RequestBody SysCaseQuestionStepWithBLOBs sysCaseQuestionStep,
@ApiParam("哪个用的掉的请求,传管理员/学校ID") @RequestParam String source) {
List<SysTopicAndCourse> sysTopicAndCourses = getSysTopicAndCourses(sysCaseQuestionStep.getCaseId());
if (!sysTopicAndCourses.isEmpty()) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "无法删除!该案例题正在被使用!");
} else {
//todo 管理员任意删除 老师只能删除自己上传的
SysCaseQuestion sysCaseQuestion = sysCaseQuestionMapper.selectByPrimaryKey(sysCaseQuestionStep.getCaseId());
if ("管理员".equals(source) || source.equals(sysCaseQuestion.getSource())) {
caseQuestionStepMapper.deleteByPrimaryKey(sysCaseQuestionStep.getCaseStepId());
return new ResultEntity<>(HttpStatus.OK, "删除成功!");
} else {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "权限不足!");
}
// List<SysTopicAndCourse> sysTopicAndCourses = getSysTopicAndCourses(sysCaseQuestionStep.getCaseId());
// if (!sysTopicAndCourses.isEmpty()) {
// return new ResultEntity<>(HttpStatus.BAD_REQUEST, "无法删除!该案例题正在被使用!"); todo 暂时把判断去掉
// }
//todo 管理员任意删除 老师只能删除自己上传的
SysCaseQuestion sysCaseQuestion = sysCaseQuestionMapper.selectByPrimaryKey(sysCaseQuestionStep.getCaseId());
if ("管理员".equals(source) || source.equals(sysCaseQuestion.getSource())) {
caseQuestionStepMapper.deleteByPrimaryKey(sysCaseQuestionStep.getCaseStepId());
return new ResultEntity<>(HttpStatus.OK, "删除成功!");
}
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "权限不足!");
}
private List<SysTopicAndCourse> getSysTopicAndCourses(String caseId) {

@ -8,6 +8,7 @@ import com.nimbusds.jose.shaded.gson.JsonSyntaxException;
import com.sztzjy.resource_center.annotation.AnonymousAccess;
import com.sztzjy.resource_center.entity.admin.*;
import com.sztzjy.resource_center.mapper.admin.AdminCaseMapper;
import com.sztzjy.resource_center.mapper.admin.AdminCollectCaseMapper;
import com.sztzjy.resource_center.mapper.admin.AdminDataLabelMapper;
import com.sztzjy.resource_center.mapper.admin.AdminFileMapper;
import com.sztzjy.resource_center.util.PageUtil;
@ -47,6 +48,8 @@ public class AdminCaseController {
@Autowired
private AdminFileMapper adminFileMapper;
@Autowired
private AdminCollectCaseMapper adminCollectCaseMapper;
@Autowired
private IFileUtil fileUtil;
@Value("${file.path}")
private String filePath;
@ -325,25 +328,31 @@ public class AdminCaseController {
}
@PostMapping("deleteCase")
@ApiOperation("删除案例题/管理员使用")
private ResultEntity<String> deleteCase(@RequestParam String caseId) {
@PostMapping("deleteAdminCase")
@ApiOperation("案例集锦/删除")
@AnonymousAccess
private ResultEntity<HttpStatus> deleteAdminData(@RequestParam String caseId) {
try {
//删除案例绑定文件
AdminFileExample example = new AdminFileExample();
example.createCriteria().andDataCaseIdEqualTo(caseId);
adminFileMapper.deleteByExample(example);
//删除案例绑定标签
AdminDataLabelExample example1 = new AdminDataLabelExample();
example1.createCriteria().andDataCaseIdEqualTo(caseId);
adminDataLabelMapper.deleteByExample(example1);
//删除数据
adminCaseMapper.deleteByPrimaryKey(caseId);
//删除标签绑定表
AdminDataLabelExample adminDataLabelExample = new AdminDataLabelExample();
adminDataLabelExample.createCriteria().andDataCaseIdEqualTo(caseId);
adminDataLabelMapper.deleteByExample(adminDataLabelExample);
AdminFileExample adminFileExample = new AdminFileExample();
adminFileExample.createCriteria().andDataCaseIdEqualTo(caseId);
adminFileMapper.deleteByExample(adminFileExample);
AdminCollectCaseExample adminCollectCaseExample = new AdminCollectCaseExample();
adminCollectCaseExample.createCriteria().andCaseIdEqualTo(caseId);
adminCollectCaseMapper.deleteByExample(adminCollectCaseExample);
} catch (Exception e) {
e.printStackTrace();
return new ResultEntity<>(HttpStatus.INTERNAL_SERVER_ERROR, "上传失败,请联系管理员!");
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "删除失败,请联系管理员!");
}
return new ResultEntity<>(HttpStatus.OK, "删除成功!");
return new ResultEntity<HttpStatus>(HttpStatus.OK, "删除成功!");
}
}

@ -1,12 +1,12 @@
package com.sztzjy.resource_center.controller.new_module.admin;
import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.nimbusds.jose.shaded.gson.Gson;
import com.nimbusds.jose.shaded.gson.JsonSyntaxException;
import com.sztzjy.resource_center.annotation.AnonymousAccess;
import com.sztzjy.resource_center.entity.admin.*;
import com.sztzjy.resource_center.mapper.admin.AdminCollectDataMapper;
import com.sztzjy.resource_center.mapper.admin.AdminDataLabelMapper;
import com.sztzjy.resource_center.mapper.admin.AdminDataMapper;
import com.sztzjy.resource_center.mapper.admin.AdminFileMapper;
@ -46,6 +46,9 @@ public class AdminDataController {
private AdminFileMapper adminFileMapper;
@Autowired
private AdminDataMapper adminDataMapper;
@Autowired
private AdminCollectDataMapper adminCollectDataMapper;
@PostMapping("/add")
@ApiOperation("新增")
@ -90,6 +93,8 @@ public class AdminDataController {
adminDataWithBLOBs.setName(adminDataDto.getName());
adminDataWithBLOBs.setDataScenarios(adminDataDto.getDataScenarios());
adminDataWithBLOBs.setFieldDescription(adminDataDto.getFieldDescription());
adminDataWithBLOBs.setDataScenariosOriginal(adminDataDto.getDataScenariosOriginal());
adminDataWithBLOBs.setFieldDescriptionOriginal(adminDataDto.getFieldDescriptionOriginal());
adminDataWithBLOBs.setStatus(0); //默认下架,发布后上架
adminDataWithBLOBs.setCreateTime(new Date());
if (pictureFile != null) {
@ -189,7 +194,9 @@ public class AdminDataController {
adminDataWithBLOBs.setDataId(adminDataDto.getDataId());
adminDataWithBLOBs.setName(adminDataDto.getName());
adminDataWithBLOBs.setDataScenarios(adminDataDto.getDataScenarios());
adminDataWithBLOBs.setDataScenariosOriginal(adminDataDto.getDataScenariosOriginal());
adminDataWithBLOBs.setFieldDescription(adminDataDto.getFieldDescription());
adminDataWithBLOBs.setFieldDescriptionOriginal(adminDataDto.getFieldDescriptionOriginal());
adminDataWithBLOBs.setStatus(adminDataDto.getStatus()); //默认下架,发布后上架
adminDataWithBLOBs.setCreateTime(adminDataDto.getCreateTime());
// 文件上传并行处理
@ -269,4 +276,32 @@ public class AdminDataController {
}
return new ResultEntity<HttpStatus>(HttpStatus.OK, "删除成功!");
}
@PostMapping("deleteAdminData")
@ApiOperation("数据仓库/删除")
@AnonymousAccess
private ResultEntity<HttpStatus> deleteAdminData(@RequestParam String dataId) {
try {
//删除数据
adminDataMapper.deleteByPrimaryKey(dataId);
//删除标签绑定表
AdminDataLabelExample adminDataLabelExample = new AdminDataLabelExample();
adminDataLabelExample.createCriteria().andDataCaseIdEqualTo(dataId);
adminDataLabelMapper.deleteByExample(adminDataLabelExample);
AdminFileExample adminFileExample = new AdminFileExample();
adminFileExample.createCriteria().andDataCaseIdEqualTo(dataId);
adminFileMapper.deleteByExample(adminFileExample);
AdminCollectDataExample adminCollectDataExample = new AdminCollectDataExample();
adminCollectDataExample.createCriteria().andDataIdEqualTo(dataId);
adminCollectDataMapper.deleteByExample(adminCollectDataExample);
} catch (Exception e) {
e.printStackTrace();
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "删除失败,请联系管理员!");
}
return new ResultEntity<HttpStatus>(HttpStatus.OK, "删除成功!");
}
}

@ -2,7 +2,6 @@ package com.sztzjy.resource_center.entity.admin;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
/**
*

@ -31,12 +31,18 @@ public class AdminDataReturnDto {
@ApiModelProperty("数据应用场景")
private String dataScenarios;
@ApiModelProperty("数据应用场景原始数据")
private String dataScenariosOriginal;
@ApiModelProperty("收藏ID")
private String collectId;
@ApiModelProperty("字段描述")
private String fieldDescription;
@ApiModelProperty("字段描述原始数据")
private String fieldDescriptionOriginal;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date createTime;

@ -1,5 +1,6 @@
package com.sztzjy.resource_center.entity.admin;
import com.sztzjy.resource_center.entity.admin.AdminData;
import io.swagger.annotations.ApiModelProperty;
/**
*
@ -10,9 +11,15 @@ public class AdminDataWithBLOBs extends AdminData {
@ApiModelProperty("数据应用场景")
private String dataScenarios;
@ApiModelProperty("数据应用场景原始数据")
private String dataScenariosOriginal;
@ApiModelProperty("字段描述")
private String fieldDescription;
@ApiModelProperty("字段描述原始数据")
private String fieldDescriptionOriginal;
public String getDataScenarios() {
return dataScenarios;
}
@ -21,6 +28,14 @@ public class AdminDataWithBLOBs extends AdminData {
this.dataScenarios = dataScenarios == null ? null : dataScenarios.trim();
}
public String getDataScenariosOriginal() {
return dataScenariosOriginal;
}
public void setDataScenariosOriginal(String dataScenariosOriginal) {
this.dataScenariosOriginal = dataScenariosOriginal == null ? null : dataScenariosOriginal.trim();
}
public String getFieldDescription() {
return fieldDescription;
}
@ -28,4 +43,12 @@ public class AdminDataWithBLOBs extends AdminData {
public void setFieldDescription(String fieldDescription) {
this.fieldDescription = fieldDescription == null ? null : fieldDescription.trim();
}
public String getFieldDescriptionOriginal() {
return fieldDescriptionOriginal;
}
public void setFieldDescriptionOriginal(String fieldDescriptionOriginal) {
this.fieldDescriptionOriginal = fieldDescriptionOriginal == null ? null : fieldDescriptionOriginal.trim();
}
}

@ -4,11 +4,10 @@ import com.sztzjy.resource_center.entity.admin.AdminData;
import com.sztzjy.resource_center.entity.admin.AdminDataExample;
import com.sztzjy.resource_center.entity.admin.AdminDataReturnDto;
import com.sztzjy.resource_center.entity.admin.AdminDataWithBLOBs;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface AdminDataMapper {
long countByExample(AdminDataExample example);

@ -13,7 +13,7 @@ spring:
application:
name: trading_system
profiles:
active: dev
active: pro
mvc:
pathmatch:
matching-strategy: ant_path_matcher

@ -46,14 +46,14 @@
<!-- <table tableName="sys_model_question" domainObjectName="SysModelQuestion" />-->
<!-- <table tableName="sys_objective_questions" domainObjectName="SysObjectiveQuestions" />-->
<!-- <table tableName="sys_one_catalog" domainObjectName="SysOneCatalog" />-->
<table tableName="sys_resource" domainObjectName="SysResource" />
<!-- <table tableName="sys_resource" domainObjectName="SysResource" />-->
<!-- <table tableName="sys_resource_and_course" domainObjectName="SysResourceAndCourse" />-->
<!-- <table tableName="sys_resource_data" domainObjectName="SysResourceData" />-->
<!-- <table tableName="sys_school" domainObjectName="SysSchool" />-->
<!-- <table tableName="sys_three_catalog" domainObjectName="SysThreeCatalog" />-->
<!-- <table tableName="sys_topic_and_course" domainObjectName="SysTopicAndCourse" />-->
<!-- <table tableName="admin_case" domainObjectName="AdminCase" />-->
<!-- <table tableName="admin_data" domainObjectName="AdminData" />-->
<table tableName="admin_data" domainObjectName="AdminData" />
<!-- <table tableName="admin_collect_case" domainObjectName="AdminCollectCase" />-->
<!-- <table tableName="admin_collect_data" domainObjectName="AdminCollectData" />-->
<!-- <table tableName="admin_data_label" domainObjectName="AdminDataLabel" />-->

@ -1,388 +1,412 @@
<?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="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>
<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>
</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, create_time
</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"/>
</trim>
</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, field_description)
values (#{dataId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{pictureUrl,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{source,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{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="createTime != null">
create_time,
</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="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</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.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</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"/>
</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>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update admin_data
set data_id = #{record.dataId,jdbcType=VARCHAR},
</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">
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},
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},
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="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},
create_time = #{createTime,jdbcType=TIMESTAMP},
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},
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="field_description" jdbcType="LONGVARCHAR" property="fieldDescription"/>
<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.field_description,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 !=null and type !=''">
and a.source != '管理员'
</if>
</where>
order by a.create_time desc
</select>
</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>
<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="type !=null and type !=''">
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.field_description,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>
<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