修改标签相关接口添加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,

@ -2,17 +2,18 @@
<!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" />
<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 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>
@ -32,7 +33,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
@ -61,7 +63,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
@ -73,36 +76,40 @@
</where>
</sql>
<sql id="Base_Column_List">
id, name, label_id, picture_url, status, source, create_time
id
, name, label_id, picture_url, status, source, create_time
</sql>
<sql id="Blob_Column_List">
content, catalog
content
, catalog
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseExample" resultMap="ResultMapWithBLOBs">
<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="Base_Column_List"/>
,
<include refid="Blob_Column_List" />
<include refid="Blob_Column_List"/>
from admin_case
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<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 id="selectByExample" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from admin_case
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
@ -110,31 +117,30 @@
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
,
<include refid="Blob_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
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" />
<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
)
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}
)
#{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
@ -197,10 +203,11 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseExample" resultType="java.lang.Long">
<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" />
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
@ -235,7 +242,7 @@
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
@ -250,7 +257,7 @@
content = #{record.content,jdbcType=LONGVARCHAR},
catalog = #{record.catalog,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
@ -263,7 +270,7 @@
source = #{record.source,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs">
@ -320,7 +327,6 @@
</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"/>
@ -330,7 +336,7 @@
<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" />
<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"/>
@ -366,7 +372,7 @@
</foreach>
</if>
<if test="source !=null and source !=''">
and a.source !='管理员'
and a.source in (#{source},'管理员')
</if>
</where>
order by a.create_time desc

@ -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