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

master
xiaoCJ 4 months ago
parent 93b1b0778a
commit a6eb6289b0

@ -158,19 +158,16 @@ public class AdminComponentCodeController {
@PostMapping("getAdminData") @PostMapping("getAdminData")
@ApiOperation("展示") @ApiOperation("展示")
@AnonymousAccess @AnonymousAccess
@Transactional @Transactional
public ResultEntity getAdminData(@RequestParam Integer index, public ResultEntity getAdminData(@RequestParam Integer index,
@RequestParam Integer size, @RequestParam Integer size,
@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,

@ -1,407 +1,413 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <mapper namespace="com.sztzjy.resource_center.mapper.admin.AdminCaseMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.resource_center.entity.admin.AdminCase"> <resultMap id="BaseResultMap" type="com.sztzjy.resource_center.entity.admin.AdminCase">
<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"/>
<result column="label_id" jdbcType="VARCHAR" property="labelId" /> <result column="label_id" jdbcType="VARCHAR" property="labelId"/>
<result column="picture_url" jdbcType="VARCHAR" property="pictureUrl" /> <result column="picture_url" jdbcType="VARCHAR" property="pictureUrl"/>
<result column="status" jdbcType="INTEGER" property="status" /> <result column="status" jdbcType="INTEGER" property="status"/>
<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"
<result column="content" jdbcType="LONGVARCHAR" property="content" /> type="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs">
<result column="catalog" jdbcType="LONGVARCHAR" property="catalog" /> <result column="content" jdbcType="LONGVARCHAR" property="content"/>
</resultMap> <result column="catalog" jdbcType="LONGVARCHAR" property="catalog"/>
<sql id="Example_Where_Clause"> </resultMap>
<where> <sql id="Example_Where_Clause">
<foreach collection="oredCriteria" item="criteria" separator="or"> <where>
<if test="criteria.valid"> <foreach collection="oredCriteria" item="criteria" separator="or">
<trim prefix="(" prefixOverrides="and" suffix=")"> <if test="criteria.valid">
<foreach collection="criteria.criteria" item="criterion"> <trim prefix="(" prefixOverrides="and" suffix=")">
<choose> <foreach collection="criteria.criteria" item="criterion">
<when test="criterion.noValue"> <choose>
and ${criterion.condition} <when test="criterion.noValue">
</when> and ${criterion.condition}
<when test="criterion.singleValue"> </when>
and ${criterion.condition} #{criterion.value} <when test="criterion.singleValue">
</when> and ${criterion.condition} #{criterion.value}
<when test="criterion.betweenValue"> </when>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} <when test="criterion.betweenValue">
</when> and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
<when test="criterion.listValue"> </when>
and ${criterion.condition} <when test="criterion.listValue">
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> and ${criterion.condition}
#{listItem} <foreach close=")" collection="criterion.value" item="listItem" open="("
</foreach> separator=",">
</when> #{listItem}
</choose> </foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach> </foreach>
</trim> </where>
</if> </sql>
</foreach> <sql id="Update_By_Example_Where_Clause">
</where> <where>
</sql> <foreach collection="example.oredCriteria" item="criteria" separator="or">
<sql id="Update_By_Example_Where_Clause"> <if test="criteria.valid">
<where> <trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="example.oredCriteria" item="criteria" separator="or"> <foreach collection="criteria.criteria" item="criterion">
<if test="criteria.valid"> <choose>
<trim prefix="(" prefixOverrides="and" suffix=")"> <when test="criterion.noValue">
<foreach collection="criteria.criteria" item="criterion"> and ${criterion.condition}
<choose> </when>
<when test="criterion.noValue"> <when test="criterion.singleValue">
and ${criterion.condition} and ${criterion.condition} #{criterion.value}
</when> </when>
<when test="criterion.singleValue"> <when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when> </when>
<when test="criterion.betweenValue"> <when test="criterion.listValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} and ${criterion.condition}
</when> <foreach close=")" collection="criterion.value" item="listItem" open="("
<when test="criterion.listValue"> separator=",">
and ${criterion.condition} #{listItem}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> </foreach>
#{listItem} </when>
</foreach> </choose>
</when> </foreach>
</choose> </trim>
</if>
</foreach> </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> </if>
</foreach> </update>
</where> <update id="updateByExampleWithBLOBs" parameterType="map">
</sql> update admin_case
<sql id="Base_Column_List"> set id = #{record.id,jdbcType=VARCHAR},
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}, name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.labelId != null">
label_id = #{record.labelId,jdbcType=VARCHAR}, label_id = #{record.labelId,jdbcType=VARCHAR},
</if>
<if test="record.pictureUrl != null">
picture_url = #{record.pictureUrl,jdbcType=VARCHAR}, picture_url = #{record.pictureUrl,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=INTEGER}, status = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.source != null">
source = #{record.source,jdbcType=VARCHAR}, source = #{record.source,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR}, content = #{record.content,jdbcType=LONGVARCHAR},
</if> catalog = #{record.catalog,jdbcType=LONGVARCHAR}
<if test="record.catalog != null"> <if test="_parameter != null">
catalog = #{record.catalog,jdbcType=LONGVARCHAR}, <include refid="Update_By_Example_Where_Clause"/>
</if> </if>
</set> </update>
<if test="_parameter != null"> <update id="updateByExample" parameterType="map">
<include refid="Update_By_Example_Where_Clause" /> update admin_case
</if> set id = #{record.id,jdbcType=VARCHAR},
</update> name = #{record.name,jdbcType=VARCHAR},
<update id="updateByExampleWithBLOBs" parameterType="map"> label_id = #{record.labelId,jdbcType=VARCHAR},
update admin_case picture_url = #{record.pictureUrl,jdbcType=VARCHAR},
set id = #{record.id,jdbcType=VARCHAR}, status = #{record.status,jdbcType=INTEGER},
name = #{record.name,jdbcType=VARCHAR}, source = #{record.source,jdbcType=VARCHAR},
label_id = #{record.labelId,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=TIMESTAMP}
picture_url = #{record.pictureUrl,jdbcType=VARCHAR}, <if test="_parameter != null">
status = #{record.status,jdbcType=INTEGER}, <include refid="Update_By_Example_Where_Clause"/>
source = #{record.source,jdbcType=VARCHAR}, </if>
create_time = #{record.createTime,jdbcType=TIMESTAMP}, </update>
content = #{record.content,jdbcType=LONGVARCHAR}, <update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs">
catalog = #{record.catalog,jdbcType=LONGVARCHAR} update admin_case
<if test="_parameter != null"> <set>
<include refid="Update_By_Example_Where_Clause" /> <if test="name != null">
</if> name = #{name,jdbcType=VARCHAR},
</update> </if>
<update id="updateByExample" parameterType="map"> <if test="labelId != null">
update admin_case label_id = #{labelId,jdbcType=VARCHAR},
set id = #{record.id,jdbcType=VARCHAR}, </if>
name = #{record.name,jdbcType=VARCHAR}, <if test="pictureUrl != null">
label_id = #{record.labelId,jdbcType=VARCHAR}, picture_url = #{pictureUrl,jdbcType=VARCHAR},
picture_url = #{record.pictureUrl,jdbcType=VARCHAR}, </if>
status = #{record.status,jdbcType=INTEGER}, <if test="status != null">
source = #{record.source,jdbcType=VARCHAR}, status = #{status,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP} </if>
<if test="_parameter != null"> <if test="source != null">
<include refid="Update_By_Example_Where_Clause" /> source = #{source,jdbcType=VARCHAR},
</if> </if>
</update> <if test="createTime != null">
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs"> create_time = #{createTime,jdbcType=TIMESTAMP},
update admin_case </if>
<set> <if test="content != null">
<if test="name != null"> content = #{content,jdbcType=LONGVARCHAR},
name = #{name,jdbcType=VARCHAR}, </if>
</if> <if test="catalog != null">
<if test="labelId != null"> catalog = #{catalog,jdbcType=LONGVARCHAR},
label_id = #{labelId,jdbcType=VARCHAR}, </if>
</if> </set>
<if test="pictureUrl != null"> where id = #{id,jdbcType=VARCHAR}
picture_url = #{pictureUrl,jdbcType=VARCHAR}, </update>
</if> <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs">
<if test="status != null"> update admin_case
status = #{status,jdbcType=INTEGER}, set name = #{name,jdbcType=VARCHAR},
</if> label_id = #{labelId,jdbcType=VARCHAR},
<if test="source != null"> picture_url = #{pictureUrl,jdbcType=VARCHAR},
source = #{source,jdbcType=VARCHAR}, status = #{status,jdbcType=INTEGER},
</if> source = #{source,jdbcType=VARCHAR},
<if test="createTime != null"> create_time = #{createTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP}, content = #{content,jdbcType=LONGVARCHAR},
</if> catalog = #{catalog,jdbcType=LONGVARCHAR}
<if test="content != null"> where id = #{id,jdbcType=VARCHAR}
content = #{content,jdbcType=LONGVARCHAR}, </update>
</if> <update id="updateByPrimaryKey" parameterType="com.sztzjy.resource_center.entity.admin.AdminCase">
<if test="catalog != null"> update admin_case
catalog = #{catalog,jdbcType=LONGVARCHAR}, set name = #{name,jdbcType=VARCHAR},
</if> label_id = #{labelId,jdbcType=VARCHAR},
</set> picture_url = #{pictureUrl,jdbcType=VARCHAR},
where id = #{id,jdbcType=VARCHAR} status = #{status,jdbcType=INTEGER},
</update> source = #{source,jdbcType=VARCHAR},
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.sztzjy.resource_center.entity.admin.AdminCaseWithBLOBs"> create_time = #{createTime,jdbcType=TIMESTAMP}
update admin_case where id = #{id,jdbcType=VARCHAR}
set name = #{name,jdbcType=VARCHAR}, </update>
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"> <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"/>
<result column="label_id" jdbcType="VARCHAR" property="labelId"/> <result column="label_id" jdbcType="VARCHAR" property="labelId"/>
<result column="picture_url" jdbcType="VARCHAR" property="pictureUrl"/> <result column="picture_url" jdbcType="VARCHAR" property="pictureUrl"/>
<result column="status" jdbcType="INTEGER" property="status"/> <result column="status" jdbcType="INTEGER" property="status"/>
<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"/>
<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"/>
<collection property="adminDataLabels" ofType="com.sztzjy.resource_center.entity.admin.AdminDataLabel"> <collection property="adminDataLabels" ofType="com.sztzjy.resource_center.entity.admin.AdminDataLabel">
<id column="label_id" jdbcType="VARCHAR" property="labelId"/> <id column="label_id" jdbcType="VARCHAR" property="labelId"/>
<result column="label_name" jdbcType="VARCHAR" property="name"/> <result column="label_name" jdbcType="VARCHAR" property="name"/>
<result column="type" jdbcType="VARCHAR" property="type"/> <result column="type" jdbcType="VARCHAR" property="type"/>
<result column="data_case_id" jdbcType="VARCHAR" property="dataCaseId"/> <result column="data_case_id" jdbcType="VARCHAR" property="dataCaseId"/>
</collection> </collection>
<collection property="adminFiles" ofType="com.sztzjy.resource_center.entity.admin.AdminFile"> <collection property="adminFiles" ofType="com.sztzjy.resource_center.entity.admin.AdminFile">
<id column="file_url" jdbcType="VARCHAR" property="fileUrl"/> <id column="file_url" jdbcType="VARCHAR" property="fileUrl"/>
<id column="file_id" jdbcType="VARCHAR" property="fileId"/> <id column="file_id" jdbcType="VARCHAR" property="fileId"/>
<result column="file_name" jdbcType="VARCHAR" property="name"/> <result column="file_name" jdbcType="VARCHAR" property="name"/>
<result column="source" jdbcType="VARCHAR" property="source"/> <result column="source" jdbcType="VARCHAR" property="source"/>
<result column="data_case_id" jdbcType="VARCHAR" property="dataCaseId"/> <result column="data_case_id" jdbcType="VARCHAR" property="dataCaseId"/>
</collection> </collection>
</resultMap> </resultMap>
<select id="selectByConditions" resultMap="dtoMap"> <select id="selectByConditions" resultMap="dtoMap">
SELECT a.id,a.name,a.content,a.catalog,a.picture_url,a.`status`,a.source,a.create_time, 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, 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 af.file_url,af.`name` as file_name,af.source,af.file_id,af.data_case_id
FROM admin_case a FROM admin_case a
LEFT join admin_data_label ad ON a.id = ad.data_case_id 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_file af on a.id = af.data_case_id
LEFT JOIN admin_collect_case acc on a.id = acc.case_id LEFT JOIN admin_collect_case acc on a.id = acc.case_id
<where> <where>
<if test="keyWord !=null and keyWord !=''"> <if test="keyWord !=null and keyWord !=''">
and a.name like CONCAT('%', #{keyWord}, '%') and a.name like CONCAT('%', #{keyWord}, '%')
</if> </if>
<if test="labelName !=null and labelName.size() > 0"> <if test="labelName !=null and labelName.size() > 0">
and ad.name in and ad.name in
<foreach collection="labelName" item="item" open="(" separator="," close=")"> <foreach collection="labelName" item="item" open="(" separator="," close=")">
#{item} #{item}
</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
</select> </select>
<select id="selectByConditionsByStu" resultMap="dtoMap"> <select id="selectByConditionsByStu" resultMap="dtoMap">
SELECT a.id,a.name,a.content,a.catalog,a.picture_url,a.`status`,a.source,a.create_time, 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, 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 af.file_url,af.`name` as file_name,af.source,af.file_id,af.data_case_id
FROM admin_case a FROM admin_case a
LEFT join admin_data_label ad ON a.id = ad.data_case_id 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_file af on a.id = af.data_case_id
LEFT JOIN admin_collect_case acc on a.id = acc.case_id LEFT JOIN admin_collect_case acc on a.id = acc.case_id
<where> <where>
and a.status = 1 and a.status = 1
<if test="keyWord !=null and keyWord !=''"> <if test="keyWord !=null and keyWord !=''">
and a.name like CONCAT('%', #{keyWord}, '%') and a.name like CONCAT('%', #{keyWord}, '%')
</if> </if>
<if test="labelName != null and labelName.size() > 0"> <if test="labelName != null and labelName.size() > 0">
AND ad.name IN AND ad.name IN
<foreach collection="labelName" item="item" open="(" separator="," close=")"> <foreach collection="labelName" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="source !=null and source !='管理员'"> <if test="source !=null and source !='管理员'">
and a.source = #{source} and a.source = #{source}
</if> </if>
<if test="source == '管理员'"> <if test="source == '管理员'">
and a.source in (#{source},'管理员') and a.source in (#{source},'管理员')
</if> </if>
<if test="userId !=null and userId !=''"> <if test="userId !=null and userId !=''">
and acc.user_id = #{userId} and acc.user_id = #{userId}
</if> </if>
</where> </where>
order by a.create_time desc order by a.create_time desc
</select> </select>
</mapper> </mapper>

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