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

master
xiaoCJ 4 months ago
parent 93b1b0778a
commit a6eb6289b0

@ -158,9 +158,6 @@ public class AdminComponentCodeController {
@PostMapping("getAdminData") @PostMapping("getAdminData")
@ApiOperation("展示") @ApiOperation("展示")
@AnonymousAccess @AnonymousAccess
@ -170,7 +167,7 @@ public class AdminComponentCodeController {
@RequestParam(required = false) String caseName) { @RequestParam(required = false) String caseName) {
AdminComponentCodeExample codeExample=new AdminComponentCodeExample(); AdminComponentCodeExample codeExample=new AdminComponentCodeExample();
if(!caseName.isEmpty()){ if(StringUtils.isNotBlank(caseName)){
codeExample.createCriteria().andChapterNameLike("%"+caseName+"%"); codeExample.createCriteria().andChapterNameLike("%"+caseName+"%");
} }

@ -166,7 +166,7 @@ public class AdminDataController {
private ResultEntity<PageInfo<AdminDataReturnDto>> add(@RequestParam Integer index, private ResultEntity<PageInfo<AdminDataReturnDto>> add(@RequestParam Integer index,
@RequestParam Integer size, @RequestParam Integer size,
@RequestParam(required = false) String keyWord, @RequestParam(required = false) String keyWord,
@ApiParam("精品案例不传院校案例1") @RequestParam(required = false) String type, @ApiParam("管理员/学校ID") @RequestParam(required = false) String type,
@RequestParam(required = false) String labelName) { @RequestParam(required = false) String labelName) {
List<AdminDataReturnDto> adminDataReturnDtos = adminDataMapper.selectByConditions(keyWord, type, labelName); List<AdminDataReturnDto> adminDataReturnDtos = adminDataMapper.selectByConditions(keyWord, type, labelName);
PageInfo pageInfo = PageUtil.pageHelper(adminDataReturnDtos, index, size); 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.Api;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -36,6 +39,9 @@ public class AdminLabelController {
if (StringUtils.isBlank(adminLabel.getType())) { if (StringUtils.isBlank(adminLabel.getType())) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "标签类型不能为空!"); return new ResultEntity<>(HttpStatus.BAD_REQUEST, "标签类型不能为空!");
} }
if (StringUtils.isBlank(adminLabel.getSource())) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "来源不能为空!");
}
adminLabel.setLabelId(IdUtil.randomUUID()); adminLabel.setLabelId(IdUtil.randomUUID());
adminLabelMapper.insert(adminLabel); adminLabelMapper.insert(adminLabel);
return new ResultEntity<>(HttpStatus.OK, "新增成功!"); return new ResultEntity<>(HttpStatus.OK, "新增成功!");
@ -73,17 +79,31 @@ public class AdminLabelController {
@PostMapping("getAdminLabel") @PostMapping("getAdminLabel")
@ApiOperation("展示") @ApiOperation("展示")
private ResultEntity<List<AdminLabel>> getLabel() { private ResultEntity<List<AdminLabel>> getLabel(@ApiParam("管理员端不传/老师端学生端传学校ID") @RequestParam(required = false) String source) {
AdminLabelExample example = new AdminLabelExample(); 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); List<AdminLabel> adminLabels = adminLabelMapper.selectByExample(example);
return new ResultEntity<>(adminLabels); return new ResultEntity<>(adminLabels);
} }
@PostMapping("getDropDown") @PostMapping("getDropDown")
@ApiOperation("下拉框") @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(); 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); List<AdminLabel> adminLabels = adminLabelMapper.selectByExample(example);
return new ResultEntity<>(adminLabels); return new ResultEntity<>(adminLabels);
} }

@ -16,6 +16,9 @@ public class AdminLabel {
@ApiModelProperty("类型 行业标签/专业标签/技术标签") @ApiModelProperty("类型 行业标签/专业标签/技术标签")
private String type; private String type;
@ApiModelProperty("学校ID/管理员")
private String source;
public String getLabelId() { public String getLabelId() {
return labelId; return labelId;
} }
@ -39,4 +42,12 @@ public class AdminLabel {
public void setType(String type) { public void setType(String type) {
this.type = type == null ? null : type.trim(); 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"); addCriterion("type not between", value1, value2, "type");
return (Criteria) this; 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 { public static class Criteria extends GeneratedCriteria {

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

@ -10,7 +10,8 @@
<result column="source" jdbcType="VARCHAR" property="source"/> <result column="source" jdbcType="VARCHAR" property="source"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs"
type="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs">
<result column="content" jdbcType="LONGVARCHAR" property="content"/> <result column="content" jdbcType="LONGVARCHAR" property="content"/>
<result column="catalog" jdbcType="LONGVARCHAR" property="catalog"/> <result column="catalog" jdbcType="LONGVARCHAR" property="catalog"/>
</resultMap> </resultMap>
@ -32,7 +33,8 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
@ -61,7 +63,8 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
@ -73,12 +76,15 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <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>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
content, catalog content
, catalog
</sql> </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 select
<if test="distinct"> <if test="distinct">
distinct distinct
@ -94,7 +100,8 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </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 select
<if test="distinct"> <if test="distinct">
distinct distinct
@ -117,7 +124,8 @@
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from admin_case delete
from admin_case
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</delete> </delete>
<delete id="deleteByExample" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseExample"> <delete id="deleteByExample" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseExample">
@ -129,12 +137,10 @@
<insert id="insert" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs"> <insert id="insert" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs">
insert into admin_case (id, name, label_id, insert into admin_case (id, name, label_id,
picture_url, status, source, picture_url, status, source,
create_time, content, catalog create_time, content, catalog)
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{labelId,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{labelId,jdbcType=VARCHAR},
#{pictureUrl,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{source,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>
<insert id="insertSelective" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs"> <insert id="insertSelective" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs">
insert into admin_case insert into admin_case
@ -197,7 +203,8 @@
</if> </if>
</trim> </trim>
</insert> </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 select count(*) from admin_case
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause"/>
@ -320,7 +327,6 @@
</update> </update>
<resultMap id="dtoMap" type="com.sztzjy.resource_center.entity.admin.AdminCaseReturnDto"> <resultMap id="dtoMap" type="com.sztzjy.resource_center.entity.admin.AdminCaseReturnDto">
<id column="id" jdbcType="VARCHAR" property="id"/> <id column="id" jdbcType="VARCHAR" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/> <result column="name" jdbcType="VARCHAR" property="name"/>
@ -366,7 +372,7 @@
</foreach> </foreach>
</if> </if>
<if test="source !=null and source !=''"> <if test="source !=null and source !=''">
and a.source !='管理员' and a.source in (#{source},'管理员')
</if> </if>
</where> </where>
order by a.create_time desc order by a.create_time desc

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

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

Loading…
Cancel
Save