feat: 新增标签分类管理功能。

This commit is contained in:
tianyongbao
2025-12-13 15:45:22 +08:00
parent 69f80566cb
commit 864cc6bced
11 changed files with 586 additions and 0 deletions

View File

@@ -0,0 +1,109 @@
package com.intc.invest.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.intc.common.log.annotation.Log;
import com.intc.common.log.enums.BusinessType;
import com.intc.invest.domain.WorkToolSuperCategory;
import com.intc.invest.domain.vo.WorkToolSuperCategoryVo;
import com.intc.invest.domain.dto.WorkToolSuperCategoryDto;
import com.intc.invest.service.IWorkToolSuperCategoryService;
import com.intc.common.core.web.controller.BaseController;
import com.intc.common.core.web.domain.AjaxResult;
import com.intc.common.core.utils.poi.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.intc.common.core.web.page.TableDataInfo;
/**
* 工作工具大分类Controller
*
* @author tianyongbao
* @date 2025-12-13
*/
@Api(tags=" 工作工具大分类")
@RestController
@RequestMapping("/workToolSuperCategory")
public class WorkToolSuperCategoryController extends BaseController
{
@Resource
private IWorkToolSuperCategoryService workToolSuperCategoryService;
/**
* 查询工作工具大分类列表
*/
@ApiOperation(value="查询工作工具大分类列表",response = WorkToolSuperCategoryVo.class)
@GetMapping("/list")
public TableDataInfo list(WorkToolSuperCategoryDto workToolSuperCategoryDto)
{
startPage();
List<WorkToolSuperCategoryVo> list = workToolSuperCategoryService.selectWorkToolSuperCategoryList(workToolSuperCategoryDto);
return getDataTable(list);
}
/**
* 导出工作工具大分类列表
*/
@ApiOperation(value="导出工作工具大分类列表")
@Log(title = "工作工具大分类", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WorkToolSuperCategoryDto workToolSuperCategoryDto)
{
List<WorkToolSuperCategoryVo> list = workToolSuperCategoryService.selectWorkToolSuperCategoryList(workToolSuperCategoryDto);
ExcelUtil<WorkToolSuperCategoryVo> util = new ExcelUtil<WorkToolSuperCategoryVo>(WorkToolSuperCategoryVo.class);
util.exportExcel(response, list, "工作工具大分类数据");
}
/**
* 获取工作工具大分类详细信息
*/
@ApiOperation(value="获取工作工具大分类详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(workToolSuperCategoryService.selectWorkToolSuperCategoryById(id));
}
/**
* 新增工作工具大分类
*/
@ApiOperation(value="新增工作工具大分类")
@Log(title = "工作工具大分类", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WorkToolSuperCategory workToolSuperCategory)
{
return toAjax(workToolSuperCategoryService.insertWorkToolSuperCategory(workToolSuperCategory));
}
/**
* 修改工作工具大分类
*/
@ApiOperation(value="修改工作工具大分类")
@Log(title = "工作工具大分类", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WorkToolSuperCategory workToolSuperCategory)
{
return toAjax(workToolSuperCategoryService.updateWorkToolSuperCategory(workToolSuperCategory));
}
/**
* 删除工作工具大分类
*/
@ApiOperation(value="删除工作工具大分类")
@Log(title = "工作工具大分类", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(workToolSuperCategoryService.deleteWorkToolSuperCategoryByIds(ids));
}
}

View File

@@ -41,6 +41,11 @@ public class WorkToolCategory extends BaseEntity
@Excel(name = "排序")
private Integer sortOrder;
/** 大分类ID */
@ApiModelProperty(value="大分类ID")
@Excel(name = "大分类ID")
private Long superCategoryId;
/** 删除标志0代表存在 1代表删除 */
private String delFlag;
@@ -51,6 +56,7 @@ public class WorkToolCategory extends BaseEntity
.append("categoryKey", getCategoryKey())
.append("categoryTitle", getCategoryTitle())
.append("sortOrder", getSortOrder())
.append("superCategoryId", getSuperCategoryId())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())

View File

@@ -0,0 +1,61 @@
package com.intc.invest.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.intc.common.core.annotation.Excel;
import com.intc.common.core.web.domain.BaseEntity;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.*;
/**
* 工作工具大分类对象 work_tool_super_category
*
* @author tianyongbao
* @date 2025-12-13
*/
@ApiModel("工作工具大分类对象")
@Data
public class WorkToolSuperCategory extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 大分类标识 */
@ApiModelProperty(value="大分类标识)")
@NotNull(message="大分类标识不能为空")
@Excel(name = "大分类标识")
private String superCategoryKey;
/** 大分类名称 */
@ApiModelProperty(value="大分类名称)")
@NotNull(message="大分类名称不能为空")
@Excel(name = "大分类名称")
private String superCategoryTitle;
/** 排序序号 */
@ApiModelProperty(value="排序序号")
@Excel(name = "排序序号")
private Integer sortOrder;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("superCategoryKey", getSuperCategoryKey())
.append("superCategoryTitle", getSuperCategoryTitle())
.append("sortOrder", getSortOrder())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -26,4 +26,8 @@ public class WorkToolCategoryDto extends BaseEntity implements Serializable
/** 分类标题 */
@ApiModelProperty(value="分类标题")
private String categoryTitle;
/** 大分类ID */
@ApiModelProperty(value="大分类ID")
private Long superCategoryId;
}

View File

@@ -0,0 +1,29 @@
package com.intc.invest.domain.dto;
import com.intc.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* 工作工具大分类Dto对象 work_tool_super_category
*
* @author tianyongbao
* @date 2025-12-13
*/
@ApiModel("工作工具大分类Dto对象")
@Data
public class WorkToolSuperCategoryDto extends BaseEntity implements Serializable
{
private static final long serialVersionUID = 1L;
/** 大分类标识 */
@ApiModelProperty(value="大分类标识")
private String superCategoryKey;
/** 大分类名称 */
@ApiModelProperty(value="大分类名称")
private String superCategoryTitle;
}

View File

@@ -0,0 +1,17 @@
package com.intc.invest.domain.vo;
import com.intc.invest.domain.WorkToolSuperCategory;
import lombok.Data;
import io.swagger.annotations.ApiModel;
/**
* 工作工具大分类Vo对象 work_tool_super_category
*
* @author tianyongbao
* @date 2025-12-13
*/
@ApiModel("工作工具大分类Vo对象")
@Data
public class WorkToolSuperCategoryVo extends WorkToolSuperCategory
{
}

View File

@@ -0,0 +1,82 @@
package com.intc.invest.mapper;
import com.intc.common.datascope.annotation.DataScope;
import com.intc.invest.domain.WorkToolSuperCategory;
import com.intc.invest.domain.dto.WorkToolSuperCategoryDto;
import com.intc.invest.domain.vo.WorkToolSuperCategoryVo;
import java.util.List;
/**
* 工作工具大分类Mapper接口
*
* @author tianyongbao
* @date 2025-12-13
*/
public interface WorkToolSuperCategoryMapper
{
/**
* 查询工作工具大分类
*
* @param id 工作工具大分类主键
* @return 工作工具大分类
*/
public WorkToolSuperCategoryVo selectWorkToolSuperCategoryById(Long id);
/**
* 查询工作工具大分类列表
*
* @param workToolSuperCategoryDto 工作工具大分类
* @return 工作工具大分类集合
*/
@DataScope(businessAlias = "a")
public List<WorkToolSuperCategoryVo> selectWorkToolSuperCategoryList(WorkToolSuperCategoryDto workToolSuperCategoryDto);
/**
* 新增工作工具大分类
*
* @param workToolSuperCategory 工作工具大分类
* @return 结果
*/
public int insertWorkToolSuperCategory(WorkToolSuperCategory workToolSuperCategory);
/**
* 修改工作工具大分类
*
* @param workToolSuperCategory 工作工具大分类
* @return 结果
*/
public int updateWorkToolSuperCategory(WorkToolSuperCategory workToolSuperCategory);
/**
* 删除工作工具大分类
*
* @param id 工作工具大分类主键
* @return 结果
*/
public int deleteWorkToolSuperCategoryById(Long id);
/**
* 批量删除工作工具大分类
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWorkToolSuperCategoryByIds(Long[] ids);
/**
* 逻辑删除工作工具大分类
*
* @param id 工作工具大分类主键
* @return 结果
*/
public int removeWorkToolSuperCategoryById(Long id);
/**
* 批量逻辑删除工作工具大分类
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int removeWorkToolSuperCategoryByIds(Long[] ids);
}

View File

@@ -0,0 +1,63 @@
package com.intc.invest.service;
import java.util.List;
import com.intc.invest.domain.WorkToolSuperCategory;
import com.intc.invest.domain.dto.WorkToolSuperCategoryDto;
import com.intc.invest.domain.vo.WorkToolSuperCategoryVo;
/**
* 工作工具大分类Service接口
*
* @author tianyongbao
* @date 2025-12-13
*/
public interface IWorkToolSuperCategoryService
{
/**
* 查询工作工具大分类
*
* @param id 工作工具大分类主键
* @return 工作工具大分类
*/
public WorkToolSuperCategoryVo selectWorkToolSuperCategoryById(Long id);
/**
* 查询工作工具大分类列表
*
* @param workToolSuperCategoryDto 工作工具大分类
* @return 工作工具大分类集合
*/
public List<WorkToolSuperCategoryVo> selectWorkToolSuperCategoryList(WorkToolSuperCategoryDto workToolSuperCategoryDto);
/**
* 新增工作工具大分类
*
* @param workToolSuperCategory 工作工具大分类
* @return 结果
*/
public int insertWorkToolSuperCategory(WorkToolSuperCategory workToolSuperCategory);
/**
* 修改工作工具大分类
*
* @param workToolSuperCategory 工作工具大分类
* @return 结果
*/
public int updateWorkToolSuperCategory(WorkToolSuperCategory workToolSuperCategory);
/**
* 批量删除工作工具大分类
*
* @param ids 需要删除的工作工具大分类主键集合
* @return 结果
*/
public int deleteWorkToolSuperCategoryByIds(Long[] ids);
/**
* 删除工作工具大分类信息
*
* @param id 工作工具大分类主键
* @return 结果
*/
public int deleteWorkToolSuperCategoryById(Long id);
}

View File

@@ -0,0 +1,104 @@
package com.intc.invest.service.impl;
import com.intc.common.core.utils.DateUtils;
import com.intc.common.core.utils.IdWorker;
import com.intc.common.security.utils.SecurityUtils;
import com.intc.invest.domain.WorkToolSuperCategory;
import com.intc.invest.domain.dto.WorkToolSuperCategoryDto;
import com.intc.invest.domain.vo.WorkToolSuperCategoryVo;
import com.intc.invest.mapper.WorkToolSuperCategoryMapper;
import com.intc.invest.service.IWorkToolSuperCategoryService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 工作工具大分类Service业务层处理
*
* @author tianyongbao
* @date 2025-12-13
*/
@Service
public class WorkToolSuperCategoryServiceImpl implements IWorkToolSuperCategoryService
{
@Resource
private WorkToolSuperCategoryMapper workToolSuperCategoryMapper;
/**
* 查询工作工具大分类
*
* @param id 工作工具大分类主键
* @return 工作工具大分类
*/
@Override
public WorkToolSuperCategoryVo selectWorkToolSuperCategoryById(Long id)
{
return workToolSuperCategoryMapper.selectWorkToolSuperCategoryById(id);
}
/**
* 查询工作工具大分类列表
*
* @param workToolSuperCategoryDto 工作工具大分类
* @return 工作工具大分类
*/
@Override
public List<WorkToolSuperCategoryVo> selectWorkToolSuperCategoryList(WorkToolSuperCategoryDto workToolSuperCategoryDto)
{
return workToolSuperCategoryMapper.selectWorkToolSuperCategoryList(workToolSuperCategoryDto);
}
/**
* 新增工作工具大分类
*
* @param workToolSuperCategory 工作工具大分类
* @return 结果
*/
@Override
public int insertWorkToolSuperCategory(WorkToolSuperCategory workToolSuperCategory)
{
workToolSuperCategory.setCreateBy(SecurityUtils.getUsername());
workToolSuperCategory.setCreateTime(DateUtils.getNowDate());
workToolSuperCategory.setId(IdWorker.getId());
return workToolSuperCategoryMapper.insertWorkToolSuperCategory(workToolSuperCategory);
}
/**
* 修改工作工具大分类
*
* @param workToolSuperCategory 工作工具大分类
* @return 结果
*/
@Override
public int updateWorkToolSuperCategory(WorkToolSuperCategory workToolSuperCategory)
{
workToolSuperCategory.setUpdateBy(SecurityUtils.getUsername());
workToolSuperCategory.setUpdateTime(DateUtils.getNowDate());
return workToolSuperCategoryMapper.updateWorkToolSuperCategory(workToolSuperCategory);
}
/**
* 批量删除工作工具大分类
*
* @param ids 需要删除的工作工具大分类主键
* @return 结果
*/
@Override
public int deleteWorkToolSuperCategoryByIds(Long[] ids)
{
return workToolSuperCategoryMapper.removeWorkToolSuperCategoryByIds(ids);
}
/**
* 删除工作工具大分类信息
*
* @param id 工作工具大分类主键
* @return 结果
*/
@Override
public int deleteWorkToolSuperCategoryById(Long id)
{
return workToolSuperCategoryMapper.removeWorkToolSuperCategoryById(id);
}
}

View File

@@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="categoryKey" column="category_key" />
<result property="categoryTitle" column="category_title" />
<result property="sortOrder" column="sort_order" />
<result property="superCategoryId" column="super_category_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
@@ -23,6 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wtc.category_key,
wtc.category_title,
wtc.sort_order,
wtc.super_category_id,
wtc.create_by,
wtc.create_time,
wtc.update_by,
@@ -38,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wtc.del_flag='0'
<if test="categoryKey != null and categoryKey != ''"> and wtc.category_key like '%'|| #{categoryKey}||'%'</if>
<if test="categoryTitle != null and categoryTitle != ''"> and wtc.category_title like '%'|| #{categoryTitle}||'%'</if>
<if test="superCategoryId != null"> and wtc.super_category_id = #{superCategoryId}</if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
@@ -56,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="categoryKey != null and categoryKey != ''">category_key,</if>
<if test="categoryTitle != null and categoryTitle != ''">category_title,</if>
<if test="sortOrder != null">sort_order,</if>
<if test="superCategoryId != null">super_category_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
@@ -68,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="categoryKey != null and categoryKey != ''">#{categoryKey},</if>
<if test="categoryTitle != null and categoryTitle != ''">#{categoryTitle},</if>
<if test="sortOrder != null">#{sortOrder},</if>
<if test="superCategoryId != null">#{superCategoryId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
@@ -83,6 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="categoryKey != null and categoryKey != ''">category_key = #{categoryKey},</if>
<if test="categoryTitle != null and categoryTitle != ''">category_title = #{categoryTitle},</if>
<if test="sortOrder != null">sort_order = #{sortOrder},</if>
<if test="superCategoryId != null">super_category_id = #{superCategoryId},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>

View File

@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.intc.invest.mapper.WorkToolSuperCategoryMapper">
<resultMap type="WorkToolSuperCategoryVo" id="WorkToolSuperCategoryResult">
<result property="id" column="id" />
<result property="superCategoryKey" column="super_category_key" />
<result property="superCategoryTitle" column="super_category_title" />
<result property="sortOrder" column="sort_order" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectWorkToolSuperCategoryVo">
select a.id, a.super_category_key, a.super_category_title, a.sort_order, a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.remark from work_tool_super_category a
</sql>
<select id="selectWorkToolSuperCategoryList" parameterType="WorkToolSuperCategoryDto" resultMap="WorkToolSuperCategoryResult">
<include refid="selectWorkToolSuperCategoryVo"/>
<where>
a.del_flag='0'
<if test="superCategoryKey != null and superCategoryKey != ''"> and a.super_category_key like '%'|| #{superCategoryKey}||'%'</if>
<if test="superCategoryTitle != null and superCategoryTitle != ''"> and a.super_category_title like '%'|| #{superCategoryTitle}||'%'</if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
order by a.sort_order asc, a.create_time desc
</select>
<select id="selectWorkToolSuperCategoryById" parameterType="Long" resultMap="WorkToolSuperCategoryResult">
<include refid="selectWorkToolSuperCategoryVo"/>
where a.id = #{id}
</select>
<insert id="insertWorkToolSuperCategory" parameterType="WorkToolSuperCategory">
insert into work_tool_super_category
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="superCategoryKey != null and superCategoryKey != ''">super_category_key,</if>
<if test="superCategoryTitle != null and superCategoryTitle != ''">super_category_title,</if>
<if test="sortOrder != null">sort_order,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="superCategoryKey != null and superCategoryKey != ''">#{superCategoryKey},</if>
<if test="superCategoryTitle != null and superCategoryTitle != ''">#{superCategoryTitle},</if>
<if test="sortOrder != null">#{sortOrder},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateWorkToolSuperCategory" parameterType="WorkToolSuperCategory">
update work_tool_super_category
<trim prefix="SET" suffixOverrides=",">
<if test="superCategoryKey != null and superCategoryKey != ''">super_category_key = #{superCategoryKey},</if>
<if test="superCategoryTitle != null and superCategoryTitle != ''">super_category_title = #{superCategoryTitle},</if>
<if test="sortOrder != null">sort_order = #{sortOrder},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWorkToolSuperCategoryById" parameterType="Long">
delete from work_tool_super_category where id = #{id}
</delete>
<delete id="deleteWorkToolSuperCategoryByIds" parameterType="String">
delete from work_tool_super_category where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="removeWorkToolSuperCategoryById" parameterType="Long">
update work_tool_super_category set del_flag='2' where id = #{id}
</update>
<update id="removeWorkToolSuperCategoryByIds" parameterType="String">
update work_tool_super_category set del_flag='2' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>