修改标签相关接口添加source参数

master
xiaoCJ 4 months ago
parent 93b1b0778a
commit a6eb6289b0

@ -158,19 +158,16 @@ public class AdminComponentCodeController {
@PostMapping("getAdminData")
@ApiOperation("展示")
@AnonymousAccess
@Transactional
public ResultEntity getAdminData(@RequestParam Integer index,
@RequestParam Integer size,
@RequestParam(required = false) String caseName ) {
@RequestParam(required = false) String caseName) {
AdminComponentCodeExample codeExample=new AdminComponentCodeExample();
if(!caseName.isEmpty()){
if(StringUtils.isNotBlank(caseName)){
codeExample.createCriteria().andChapterNameLike("%"+caseName+"%");
}

@ -166,7 +166,7 @@ public class AdminDataController {
private ResultEntity<PageInfo<AdminDataReturnDto>> add(@RequestParam Integer index,
@RequestParam Integer size,
@RequestParam(required = false) String keyWord,
@ApiParam("精品案例不传院校案例1") @RequestParam(required = false) String type,
@ApiParam("管理员/学校ID") @RequestParam(required = false) String type,
@RequestParam(required = false) String labelName) {
List<AdminDataReturnDto> adminDataReturnDtos = adminDataMapper.selectByConditions(keyWord, type, labelName);
PageInfo pageInfo = PageUtil.pageHelper(adminDataReturnDtos, index, size);

@ -8,11 +8,14 @@ import com.sztzjy.resource_center.util.ResultEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -36,6 +39,9 @@ public class AdminLabelController {
if (StringUtils.isBlank(adminLabel.getType())) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "标签类型不能为空!");
}
if (StringUtils.isBlank(adminLabel.getSource())) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "来源不能为空!");
}
adminLabel.setLabelId(IdUtil.randomUUID());
adminLabelMapper.insert(adminLabel);
return new ResultEntity<>(HttpStatus.OK, "新增成功!");
@ -73,17 +79,31 @@ public class AdminLabelController {
@PostMapping("getAdminLabel")
@ApiOperation("展示")
private ResultEntity<List<AdminLabel>> getLabel() {
private ResultEntity<List<AdminLabel>> getLabel(@ApiParam("管理员端不传/老师端学生端传学校ID") @RequestParam(required = false) String source) {
AdminLabelExample example = new AdminLabelExample();
if (StringUtils.isNotBlank(source)) {
List<String> ids = new ArrayList<>();
ids.add(source);
ids.add("管理员");
example.createCriteria().andSourceIn(ids);
}
List<AdminLabel> adminLabels = adminLabelMapper.selectByExample(example);
return new ResultEntity<>(adminLabels);
}
@PostMapping("getDropDown")
@ApiOperation("下拉框")
private ResultEntity<List<AdminLabel>> getLabelByType(@RequestParam String type) {
private ResultEntity<List<AdminLabel>> getLabelByType(@RequestParam String type,
@ApiParam("管理员端不传/老师端学生端传学校ID") @RequestParam(required = false) String source) {
AdminLabelExample example = new AdminLabelExample();
example.createCriteria().andTypeEqualTo(type);
AdminLabelExample.Criteria criteria = example.createCriteria();
criteria.andTypeEqualTo(type);
if (StringUtils.isNotBlank(source)) {
List<String> ids = new ArrayList<>();
ids.add(source);
ids.add("管理员");
criteria.andSourceIn(ids);
}
List<AdminLabel> adminLabels = adminLabelMapper.selectByExample(example);
return new ResultEntity<>(adminLabels);
}

@ -16,6 +16,9 @@ public class AdminLabel {
@ApiModelProperty("类型 行业标签/专业标签/技术标签")
private String type;
@ApiModelProperty("学校ID/管理员")
private String source;
public String getLabelId() {
return labelId;
}
@ -39,4 +42,12 @@ public class AdminLabel {
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source == null ? null : source.trim();
}
}

@ -313,6 +313,76 @@ public class AdminLabelExample {
addCriterion("type not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andSourceIsNull() {
addCriterion("source is null");
return (Criteria) this;
}
public Criteria andSourceIsNotNull() {
addCriterion("source is not null");
return (Criteria) this;
}
public Criteria andSourceEqualTo(String value) {
addCriterion("source =", value, "source");
return (Criteria) this;
}
public Criteria andSourceNotEqualTo(String value) {
addCriterion("source <>", value, "source");
return (Criteria) this;
}
public Criteria andSourceGreaterThan(String value) {
addCriterion("source >", value, "source");
return (Criteria) this;
}
public Criteria andSourceGreaterThanOrEqualTo(String value) {
addCriterion("source >=", value, "source");
return (Criteria) this;
}
public Criteria andSourceLessThan(String value) {
addCriterion("source <", value, "source");
return (Criteria) this;
}
public Criteria andSourceLessThanOrEqualTo(String value) {
addCriterion("source <=", value, "source");
return (Criteria) this;
}
public Criteria andSourceLike(String value) {
addCriterion("source like", value, "source");
return (Criteria) this;
}
public Criteria andSourceNotLike(String value) {
addCriterion("source not like", value, "source");
return (Criteria) this;
}
public Criteria andSourceIn(List<String> values) {
addCriterion("source in", values, "source");
return (Criteria) this;
}
public Criteria andSourceNotIn(List<String> values) {
addCriterion("source not in", values, "source");
return (Criteria) this;
}
public Criteria andSourceBetween(String value1, String value2) {
addCriterion("source between", value1, value2, "source");
return (Criteria) this;
}
public Criteria andSourceNotBetween(String value1, String value2) {
addCriterion("source not between", value1, value2, "source");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

@ -39,7 +39,7 @@ public interface AdminDataMapper {
int updateByPrimaryKey(AdminData record);
List<AdminDataReturnDto> selectByConditions(@Param("keyWord") String keyWord,
@Param("type") String type,
@Param("source") String source,
@Param("labelName") String labelName);
List<AdminDataReturnDto> selectByConditionsBySchoolId(@Param("keyWord") String keyWord,

@ -1,407 +1,413 @@
<?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.AdminCaseMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.resource_center.entity.admin.AdminCase">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="label_id" jdbcType="VARCHAR" property="labelId" />
<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.AdminCaseWithBLOBs">
<result column="content" jdbcType="LONGVARCHAR" property="content" />
<result column="catalog" jdbcType="LONGVARCHAR" property="catalog" />
</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.AdminCase">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="label_id" jdbcType="VARCHAR" property="labelId"/>
<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.AdminCaseWithBLOBs">
<result column="content" jdbcType="LONGVARCHAR" property="content"/>
<result column="catalog" jdbcType="LONGVARCHAR" property="catalog"/>
</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">
id
, name, label_id, picture_url, status, source, create_time
</sql>
<sql id="Blob_Column_List">
content
, catalog
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseExample"
resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from admin_case
<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.AdminCaseExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from admin_case
<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_case
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete
from admin_case
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseExample">
delete from admin_case
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs">
insert into admin_case (id, name, label_id,
picture_url, status, source,
create_time, content, catalog)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{labelId,jdbcType=VARCHAR},
#{pictureUrl,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{source,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{content,jdbcType=LONGVARCHAR}, #{catalog,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs">
insert into admin_case
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="labelId != null">
label_id,
</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="content != null">
content,
</if>
<if test="catalog != null">
catalog,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="labelId != null">
#{labelId,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="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
<if test="catalog != null">
#{catalog,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseExample"
resultType="java.lang.Long">
select count(*) from admin_case
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update admin_case
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.labelId != null">
label_id = #{record.labelId,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.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
<if test="record.catalog != null">
catalog = #{record.catalog,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, name, label_id, picture_url, status, source, create_time
</sql>
<sql id="Blob_Column_List">
content, catalog
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from admin_case
<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.AdminCaseExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from admin_case
<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_case
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from admin_case
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseExample">
delete from admin_case
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs">
insert into admin_case (id, name, label_id,
picture_url, status, source,
create_time, content, catalog
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{labelId,jdbcType=VARCHAR},
#{pictureUrl,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{source,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{content,jdbcType=LONGVARCHAR}, #{catalog,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs">
insert into admin_case
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="labelId != null">
label_id,
</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="content != null">
content,
</if>
<if test="catalog != null">
catalog,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="labelId != null">
#{labelId,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="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
<if test="catalog != null">
#{catalog,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseExample" resultType="java.lang.Long">
select count(*) from admin_case
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update admin_case
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update admin_case
set id = #{record.id,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.labelId != null">
label_id = #{record.labelId,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.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
<if test="record.catalog != null">
catalog = #{record.catalog,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update admin_case
set id = #{record.id,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
label_id = #{record.labelId,jdbcType=VARCHAR},
picture_url = #{record.pictureUrl,jdbcType=VARCHAR},
status = #{record.status,jdbcType=INTEGER},
source = #{record.source,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
content = #{record.content,jdbcType=LONGVARCHAR},
catalog = #{record.catalog,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update admin_case
set id = #{record.id,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
label_id = #{record.labelId,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.AdminCaseWithBLOBs">
update admin_case
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="labelId != null">
label_id = #{labelId,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="content != null">
content = #{content,jdbcType=LONGVARCHAR},
</if>
<if test="catalog != null">
catalog = #{catalog,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs">
update admin_case
set name = #{name,jdbcType=VARCHAR},
label_id = #{labelId,jdbcType=VARCHAR},
picture_url = #{pictureUrl,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
source = #{source,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
content = #{content,jdbcType=LONGVARCHAR},
catalog = #{catalog,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.resource_center.entity.admin.AdminCase">
update admin_case
set name = #{name,jdbcType=VARCHAR},
label_id = #{labelId,jdbcType=VARCHAR},
picture_url = #{pictureUrl,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
source = #{source,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=VARCHAR}
</update>
catalog = #{record.catalog,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update admin_case
set id = #{record.id,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
label_id = #{record.labelId,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.AdminCaseWithBLOBs">
update admin_case
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="labelId != null">
label_id = #{labelId,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="content != null">
content = #{content,jdbcType=LONGVARCHAR},
</if>
<if test="catalog != null">
catalog = #{catalog,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs">
update admin_case
set name = #{name,jdbcType=VARCHAR},
label_id = #{labelId,jdbcType=VARCHAR},
picture_url = #{pictureUrl,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
source = #{source,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
content = #{content,jdbcType=LONGVARCHAR},
catalog = #{catalog,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.resource_center.entity.admin.AdminCase">
update admin_case
set name = #{name,jdbcType=VARCHAR},
label_id = #{labelId,jdbcType=VARCHAR},
picture_url = #{pictureUrl,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
source = #{source,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=VARCHAR}
</update>
<resultMap id="dtoMap" type="com.sztzjy.resource_center.entity.admin.AdminCaseReturnDto">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="label_id" jdbcType="VARCHAR" property="labelId"/>
<result column="picture_url" jdbcType="VARCHAR" property="pictureUrl"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="content" jdbcType="LONGVARCHAR" property="content"/>
<result column="catalog" jdbcType="LONGVARCHAR" property="catalog"/>
<result column="source" jdbcType="VARCHAR" property="source"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<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>
<resultMap id="dtoMap" type="com.sztzjy.resource_center.entity.admin.AdminCaseReturnDto">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="label_id" jdbcType="VARCHAR" property="labelId"/>
<result column="picture_url" jdbcType="VARCHAR" property="pictureUrl"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="content" jdbcType="LONGVARCHAR" property="content"/>
<result column="catalog" jdbcType="LONGVARCHAR" property="catalog"/>
<result column="source" jdbcType="VARCHAR" property="source"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<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.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 !='管理员'
</if>
</where>
order by a.create_time desc
</select>
<select id="selectByConditions" 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 in (#{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,
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>
and a.status = 1
<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 == '管理员'">
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="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,
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>
and a.status = 1
<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 == '管理员'">
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>

@ -375,8 +375,8 @@
<if test="labelName !=null and labelName !=''">
and ad.name in (#{labelName})
</if>
<if test="type !=null and type !=''">
and a.source != '管理员'
<if test="source !=null and source !=''">
and a.source in (#{source},'管理员')
</if>
</where>
order by a.create_time desc

@ -5,6 +5,7 @@
<id column="label_id" jdbcType="VARCHAR" property="labelId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="source" jdbcType="VARCHAR" property="source" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -65,7 +66,7 @@
</where>
</sql>
<sql id="Base_Column_List">
label_id, name, type
label_id, name, type, source
</sql>
<select id="selectByExample" parameterType="com.sztzjy.resource_center.entity.admin.AdminLabelExample" resultMap="BaseResultMap">
select
@ -98,10 +99,10 @@
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.resource_center.entity.admin.AdminLabel">
insert into admin_label (label_id, name, type
)
values (#{labelId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}
)
insert into admin_label (label_id, name, type,
source)
values (#{labelId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{source,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.resource_center.entity.admin.AdminLabel">
insert into admin_label
@ -115,6 +116,9 @@
<if test="type != null">
type,
</if>
<if test="source != null">
source,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="labelId != null">
@ -126,6 +130,9 @@
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="source != null">
#{source,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.resource_center.entity.admin.AdminLabelExample" resultType="java.lang.Long">
@ -146,6 +153,9 @@
<if test="record.type != null">
type = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.source != null">
source = #{record.source,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -155,7 +165,8 @@
update admin_label
set label_id = #{record.labelId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
type = #{record.type,jdbcType=VARCHAR}
type = #{record.type,jdbcType=VARCHAR},
source = #{record.source,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -169,24 +180,29 @@
<if test="type != null">
type = #{type,jdbcType=VARCHAR},
</if>
<if test="source != null">
source = #{source,jdbcType=VARCHAR},
</if>
</set>
where label_id = #{labelId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.resource_center.entity.admin.AdminLabel">
update admin_label
set name = #{name,jdbcType=VARCHAR},
type = #{type,jdbcType=VARCHAR}
type = #{type,jdbcType=VARCHAR},
source = #{source,jdbcType=VARCHAR}
where label_id = #{labelId,jdbcType=VARCHAR}
</update>
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO admin_label (label_id, name, type)
INSERT INTO admin_label (label_id, name, type,source)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.labelId},
#{item.name},
#{item.type}
#{item.type},
#{item.source}
)
</foreach>
</insert>

Loading…
Cancel
Save