diff --git a/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminComponentCodeController.java b/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminComponentCodeController.java index 8d37374..23d84f4 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminComponentCodeController.java +++ b/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminComponentCodeController.java @@ -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+"%"); } diff --git a/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminDataController.java b/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminDataController.java index e106fdb..831ef1a 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminDataController.java +++ b/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminDataController.java @@ -166,7 +166,7 @@ public class AdminDataController { private ResultEntity> 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 adminDataReturnDtos = adminDataMapper.selectByConditions(keyWord, type, labelName); PageInfo pageInfo = PageUtil.pageHelper(adminDataReturnDtos, index, size); diff --git a/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminLabelController.java b/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminLabelController.java index a5020e1..072d799 100644 --- a/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminLabelController.java +++ b/src/main/java/com/sztzjy/resource_center/controller/new_module/admin/AdminLabelController.java @@ -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> getLabel() { + private ResultEntity> getLabel(@ApiParam("管理员端不传/老师端学生端传学校ID") @RequestParam(required = false) String source) { AdminLabelExample example = new AdminLabelExample(); + if (StringUtils.isNotBlank(source)) { + List ids = new ArrayList<>(); + ids.add(source); + ids.add("管理员"); + example.createCriteria().andSourceIn(ids); + } List adminLabels = adminLabelMapper.selectByExample(example); return new ResultEntity<>(adminLabels); } @PostMapping("getDropDown") @ApiOperation("下拉框") - private ResultEntity> getLabelByType(@RequestParam String type) { + private ResultEntity> 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 ids = new ArrayList<>(); + ids.add(source); + ids.add("管理员"); + criteria.andSourceIn(ids); + } List adminLabels = adminLabelMapper.selectByExample(example); return new ResultEntity<>(adminLabels); } diff --git a/src/main/java/com/sztzjy/resource_center/entity/admin/AdminLabel.java b/src/main/java/com/sztzjy/resource_center/entity/admin/AdminLabel.java index c3559de..5fff58e 100644 --- a/src/main/java/com/sztzjy/resource_center/entity/admin/AdminLabel.java +++ b/src/main/java/com/sztzjy/resource_center/entity/admin/AdminLabel.java @@ -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(); + } } \ No newline at end of file diff --git a/src/main/java/com/sztzjy/resource_center/entity/admin/AdminLabelExample.java b/src/main/java/com/sztzjy/resource_center/entity/admin/AdminLabelExample.java index b2780f8..fcc77e6 100644 --- a/src/main/java/com/sztzjy/resource_center/entity/admin/AdminLabelExample.java +++ b/src/main/java/com/sztzjy/resource_center/entity/admin/AdminLabelExample.java @@ -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 values) { + addCriterion("source in", values, "source"); + return (Criteria) this; + } + + public Criteria andSourceNotIn(List 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 { diff --git a/src/main/java/com/sztzjy/resource_center/mapper/admin/AdminDataMapper.java b/src/main/java/com/sztzjy/resource_center/mapper/admin/AdminDataMapper.java index 115a62d..e4786de 100644 --- a/src/main/java/com/sztzjy/resource_center/mapper/admin/AdminDataMapper.java +++ b/src/main/java/com/sztzjy/resource_center/mapper/admin/AdminDataMapper.java @@ -39,7 +39,7 @@ public interface AdminDataMapper { int updateByPrimaryKey(AdminData record); List selectByConditions(@Param("keyWord") String keyWord, - @Param("type") String type, + @Param("source") String source, @Param("labelName") String labelName); List selectByConditionsBySchoolId(@Param("keyWord") String keyWord, diff --git a/src/main/resources/mapper/AdminCaseMapper.xml b/src/main/resources/mapper/AdminCaseMapper.xml index 0ebcb46..c65a853 100644 --- a/src/main/resources/mapper/AdminCaseMapper.xml +++ b/src/main/resources/mapper/AdminCaseMapper.xml @@ -1,407 +1,413 @@ - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + - + + + + id + , name, label_id, picture_url, status, source, create_time + + + content + , catalog + + + + + + delete + from admin_case + where id = #{id,jdbcType=VARCHAR} + + + delete from admin_case + + + + + + 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 into admin_case + + + id, + + + name, + + + label_id, + + + picture_url, + + + status, + + + source, + + + create_time, + + + content, + + + catalog, + + + + + #{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}, + + + + + + update admin_case + + + 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}, + + + + - - - - - id, name, label_id, picture_url, status, source, create_time - - - content, catalog - - - - - - delete from admin_case - where id = #{id,jdbcType=VARCHAR} - - - delete from admin_case - - - - - - 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 into admin_case - - - id, - - - name, - - - label_id, - - - picture_url, - - - status, - - - source, - - - create_time, - - - content, - - - catalog, - - - - - #{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}, - - - - - - update admin_case - - - id = #{record.id,jdbcType=VARCHAR}, - - + + + 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}, - - - - - - - - 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} - - - - - - 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} - - - - - - update admin_case - - - 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 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 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} - - + catalog = #{record.catalog,jdbcType=LONGVARCHAR} + + + + + + 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} + + + + + + update admin_case + + + 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 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 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} + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - + \ No newline at end of file diff --git a/src/main/resources/mapper/AdminDataMapper.xml b/src/main/resources/mapper/AdminDataMapper.xml index f70772c..492c69f 100644 --- a/src/main/resources/mapper/AdminDataMapper.xml +++ b/src/main/resources/mapper/AdminDataMapper.xml @@ -375,8 +375,8 @@ and ad.name in (#{labelName}) - - and a.source != '管理员' + + and a.source in (#{source},'管理员') order by a.create_time desc diff --git a/src/main/resources/mapper/AdminLabelMapper.xml b/src/main/resources/mapper/AdminLabelMapper.xml index f28184c..ba44404 100644 --- a/src/main/resources/mapper/AdminLabelMapper.xml +++ b/src/main/resources/mapper/AdminLabelMapper.xml @@ -5,6 +5,7 @@ + @@ -65,7 +66,7 @@ - label_id, name, type + label_id, name, type, source @@ -146,6 +153,9 @@ type = #{record.type,jdbcType=VARCHAR}, + + source = #{record.source,jdbcType=VARCHAR}, + @@ -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} @@ -169,24 +180,29 @@ type = #{type,jdbcType=VARCHAR}, + + source = #{source,jdbcType=VARCHAR}, + where label_id = #{labelId,jdbcType=VARCHAR} 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} - INSERT INTO admin_label (label_id, name, type) + INSERT INTO admin_label (label_id, name, type,source) VALUES ( #{item.labelId}, #{item.name}, - #{item.type} + #{item.type}, + #{item.source} )