feat: 新增工作台管理功能。

This commit is contained in:
tianyongbao
2025-12-12 23:25:30 +08:00
parent ef2f35a128
commit 2a9fb076bd
16 changed files with 1236 additions and 0 deletions

View File

@@ -0,0 +1,110 @@
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.WorkToolCategory;
import com.intc.invest.domain.vo.WorkToolCategoryVo;
import com.intc.invest.domain.dto.WorkToolCategoryDto;
import com.intc.invest.service.IWorkToolCategoryService;
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 intc
* @date 2024-12-12
*/
@Api(tags="工具分类")
@RestController
@RequestMapping("/workToolCategory")
public class WorkToolCategoryController extends BaseController
{
@Resource
private IWorkToolCategoryService workToolCategoryService;
/**
* 查询工具分类列表
*/
@ApiOperation(value="查询工具分类列表",response = WorkToolCategoryVo.class)
@GetMapping("/list")
public TableDataInfo list(WorkToolCategoryDto workToolCategoryDto)
{
startPage();
List<WorkToolCategoryVo> list = workToolCategoryService.selectWorkToolCategoryList(workToolCategoryDto);
return getDataTable(list);
}
/**
* 导出工具分类列表
*/
@ApiOperation(value="导出工具分类列表")
@Log(title = "工具分类", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WorkToolCategoryDto workToolCategoryDto)
{
List<WorkToolCategoryVo> list = workToolCategoryService.selectWorkToolCategoryList(workToolCategoryDto);
ExcelUtil<WorkToolCategoryVo> util = new ExcelUtil<WorkToolCategoryVo>(WorkToolCategoryVo.class);
util.exportExcel(response, list, "工具分类数据");
}
/**
* 获取工具分类详细信息
*/
@ApiOperation(value="获取工具分类详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(workToolCategoryService.selectWorkToolCategoryById(id));
}
/**
* 新增工具分类
*/
@ApiOperation(value="新增工具分类")
@Log(title = "工具分类", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WorkToolCategory workToolCategory)
{
return toAjax(workToolCategoryService.insertWorkToolCategory(workToolCategory));
}
/**
* 修改工具分类
*/
@ApiOperation(value="修改工具分类")
@Log(title = "工具分类", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WorkToolCategory workToolCategory)
{
return toAjax(workToolCategoryService.updateWorkToolCategory(workToolCategory));
}
/**
* 删除工具分类
*/
@ApiOperation(value="删除工具分类")
@Log(title = "工具分类", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(workToolCategoryService.deleteWorkToolCategoryByIds(ids));
}
}

View File

@@ -0,0 +1,110 @@
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.WorkTool;
import com.intc.invest.domain.vo.WorkToolVo;
import com.intc.invest.domain.dto.WorkToolDto;
import com.intc.invest.service.IWorkToolService;
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 intc
* @date 2024-12-12
*/
@Api(tags="工具")
@RestController
@RequestMapping("/workTool")
public class WorkToolController extends BaseController
{
@Resource
private IWorkToolService workToolService;
/**
* 查询工具列表
*/
@ApiOperation(value="查询工具列表",response = WorkToolVo.class)
@GetMapping("/list")
public TableDataInfo list(WorkToolDto workToolDto)
{
startPage();
List<WorkToolVo> list = workToolService.selectWorkToolList(workToolDto);
return getDataTable(list);
}
/**
* 导出工具列表
*/
@ApiOperation(value="导出工具列表")
@Log(title = "工具", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WorkToolDto workToolDto)
{
List<WorkToolVo> list = workToolService.selectWorkToolList(workToolDto);
ExcelUtil<WorkToolVo> util = new ExcelUtil<WorkToolVo>(WorkToolVo.class);
util.exportExcel(response, list, "工具数据");
}
/**
* 获取工具详细信息
*/
@ApiOperation(value="获取工具详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(workToolService.selectWorkToolById(id));
}
/**
* 新增工具
*/
@ApiOperation(value="新增工具")
@Log(title = "工具", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WorkTool workTool)
{
return toAjax(workToolService.insertWorkTool(workTool));
}
/**
* 修改工具
*/
@ApiOperation(value="修改工具")
@Log(title = "工具", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WorkTool workTool)
{
return toAjax(workToolService.updateWorkTool(workTool));
}
/**
* 删除工具
*/
@ApiOperation(value="删除工具")
@Log(title = "工具", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(workToolService.deleteWorkToolByIds(ids));
}
}

View File

@@ -0,0 +1,93 @@
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
*
* @author intc
* @date 2024-12-12
*/
@ApiModel("工具对象")
@Data
public class WorkTool extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 分类ID */
@ApiModelProperty(value="分类ID")
@NotNull(message="分类ID不能为空")
@Excel(name = "分类ID")
private Long categoryId;
/** 工具名称 */
@ApiModelProperty(value="工具名称")
@NotBlank(message="工具名称不能为空")
@Excel(name = "工具名称")
private String name;
/** 描述 */
@ApiModelProperty(value="描述")
@Excel(name = "描述")
private String description;
/** URL */
@ApiModelProperty(value="URL")
@NotBlank(message="URL不能为空")
@Excel(name = "URL")
private String url;
/** 显示URL */
@ApiModelProperty(value="显示URL")
@Excel(name = "显示URL")
private String displayUrl;
/** 图标 */
@ApiModelProperty(value="图标")
@Excel(name = "图标")
private String icon;
/** 颜色 */
@ApiModelProperty(value="颜色")
@Excel(name = "颜色")
private String color;
/** 排序 */
@ApiModelProperty(value="排序")
@Excel(name = "排序")
private Integer sortOrder;
/** 删除标志0代表存在 1代表删除 */
private String delFlag;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("categoryId", getCategoryId())
.append("name", getName())
.append("description", getDescription())
.append("url", getUrl())
.append("displayUrl", getDisplayUrl())
.append("icon", getIcon())
.append("color", getColor())
.append("sortOrder", getSortOrder())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("delFlag", getDelFlag())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -0,0 +1,62 @@
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_category
*
* @author intc
* @date 2024-12-12
*/
@ApiModel("工具分类对象")
@Data
public class WorkToolCategory extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 分类键 */
@ApiModelProperty(value="分类键")
@NotBlank(message="分类键不能为空")
@Excel(name = "分类键")
private String categoryKey;
/** 分类标题 */
@ApiModelProperty(value="分类标题")
@NotBlank(message="分类标题不能为空")
@Excel(name = "分类标题")
private String categoryTitle;
/** 排序 */
@ApiModelProperty(value="排序")
@Excel(name = "排序")
private Integer sortOrder;
/** 删除标志0代表存在 1代表删除 */
private String delFlag;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("categoryKey", getCategoryKey())
.append("categoryTitle", getCategoryTitle())
.append("sortOrder", getSortOrder())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("delFlag", getDelFlag())
.append("remark", getRemark())
.toString();
}
}

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_category
*
* @author intc
* @date 2024-12-12
*/
@ApiModel("工具分类Dto对象")
@Data
public class WorkToolCategoryDto extends BaseEntity implements Serializable
{
private static final long serialVersionUID = 1L;
/** 分类键 */
@ApiModelProperty(value="分类键")
private String categoryKey;
/** 分类标题 */
@ApiModelProperty(value="分类标题")
private String categoryTitle;
}

View File

@@ -0,0 +1,33 @@
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
*
* @author intc
* @date 2024-12-12
*/
@ApiModel("工具Dto对象")
@Data
public class WorkToolDto extends BaseEntity implements Serializable
{
private static final long serialVersionUID = 1L;
/** 分类ID */
@ApiModelProperty(value="分类ID")
private Long categoryId;
/** 工具名称 */
@ApiModelProperty(value="工具名称")
private String name;
/** 分类键 */
@ApiModelProperty(value="分类键")
private String categoryKey;
}

View File

@@ -0,0 +1,17 @@
package com.intc.invest.domain.vo;
import com.intc.invest.domain.WorkToolCategory;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
* 工具分类Vo对象 work_tool_category
*
* @author intc
* @date 2024-12-12
*/
@ApiModel("工具分类Vo对象")
@Data
public class WorkToolCategoryVo extends WorkToolCategory
{
}

View File

@@ -0,0 +1,25 @@
package com.intc.invest.domain.vo;
import com.intc.invest.domain.WorkTool;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 工具Vo对象 work_tool
*
* @author intc
* @date 2024-12-12
*/
@ApiModel("工具Vo对象")
@Data
public class WorkToolVo extends WorkTool
{
/** 分类键 */
@ApiModelProperty(value="分类键")
private String categoryKey;
/** 分类标题 */
@ApiModelProperty(value="分类标题")
private String categoryTitle;
}

View File

@@ -0,0 +1,82 @@
package com.intc.invest.mapper;
import com.intc.common.datascope.annotation.DataScope;
import com.intc.invest.domain.WorkToolCategory;
import com.intc.invest.domain.dto.WorkToolCategoryDto;
import com.intc.invest.domain.vo.WorkToolCategoryVo;
import java.util.List;
/**
* 工具分类Mapper接口
*
* @author intc
* @date 2024-12-12
*/
public interface WorkToolCategoryMapper
{
/**
* 查询工具分类
*
* @param id 工具分类主键
* @return 工具分类
*/
public WorkToolCategoryVo selectWorkToolCategoryById(Long id);
/**
* 查询工具分类列表
*
* @param workToolCategoryDto 工具分类
* @return 工具分类集合
*/
@DataScope(businessAlias = "wtc")
public List<WorkToolCategoryVo> selectWorkToolCategoryList(WorkToolCategoryDto workToolCategoryDto);
/**
* 新增工具分类
*
* @param workToolCategory 工具分类
* @return 结果
*/
public int insertWorkToolCategory(WorkToolCategory workToolCategory);
/**
* 修改工具分类
*
* @param workToolCategory 工具分类
* @return 结果
*/
public int updateWorkToolCategory(WorkToolCategory workToolCategory);
/**
* 删除工具分类
*
* @param id 工具分类主键
* @return 结果
*/
public int deleteWorkToolCategoryById(Long id);
/**
* 批量删除工具分类
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWorkToolCategoryByIds(Long[] ids);
/**
* 逻辑删除工具分类
*
* @param id 工具分类主键
* @return 结果
*/
public int removeWorkToolCategoryById(Long id);
/**
* 批量逻辑删除工具分类
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int removeWorkToolCategoryByIds(Long[] ids);
}

View File

@@ -0,0 +1,82 @@
package com.intc.invest.mapper;
import com.intc.common.datascope.annotation.DataScope;
import com.intc.invest.domain.WorkTool;
import com.intc.invest.domain.dto.WorkToolDto;
import com.intc.invest.domain.vo.WorkToolVo;
import java.util.List;
/**
* 工具Mapper接口
*
* @author intc
* @date 2024-12-12
*/
public interface WorkToolMapper
{
/**
* 查询工具
*
* @param id 工具主键
* @return 工具
*/
public WorkToolVo selectWorkToolById(Long id);
/**
* 查询工具列表
*
* @param workToolDto 工具
* @return 工具集合
*/
@DataScope(businessAlias = "wt")
public List<WorkToolVo> selectWorkToolList(WorkToolDto workToolDto);
/**
* 新增工具
*
* @param workTool 工具
* @return 结果
*/
public int insertWorkTool(WorkTool workTool);
/**
* 修改工具
*
* @param workTool 工具
* @return 结果
*/
public int updateWorkTool(WorkTool workTool);
/**
* 删除工具
*
* @param id 工具主键
* @return 结果
*/
public int deleteWorkToolById(Long id);
/**
* 批量删除工具
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWorkToolByIds(Long[] ids);
/**
* 逻辑删除工具
*
* @param id 工具主键
* @return 结果
*/
public int removeWorkToolById(Long id);
/**
* 批量逻辑删除工具
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int removeWorkToolByIds(Long[] ids);
}

View File

@@ -0,0 +1,63 @@
package com.intc.invest.service;
import java.util.List;
import com.intc.invest.domain.WorkToolCategory;
import com.intc.invest.domain.dto.WorkToolCategoryDto;
import com.intc.invest.domain.vo.WorkToolCategoryVo;
/**
* 工具分类Service接口
*
* @author intc
* @date 2024-12-12
*/
public interface IWorkToolCategoryService
{
/**
* 查询工具分类
*
* @param id 工具分类主键
* @return 工具分类
*/
public WorkToolCategoryVo selectWorkToolCategoryById(Long id);
/**
* 查询工具分类列表
*
* @param workToolCategoryDto 工具分类
* @return 工具分类集合
*/
public List<WorkToolCategoryVo> selectWorkToolCategoryList(WorkToolCategoryDto workToolCategoryDto);
/**
* 新增工具分类
*
* @param workToolCategory 工具分类
* @return 结果
*/
public int insertWorkToolCategory(WorkToolCategory workToolCategory);
/**
* 修改工具分类
*
* @param workToolCategory 工具分类
* @return 结果
*/
public int updateWorkToolCategory(WorkToolCategory workToolCategory);
/**
* 批量删除工具分类
*
* @param ids 需要删除的工具分类主键集合
* @return 结果
*/
public int deleteWorkToolCategoryByIds(Long[] ids);
/**
* 删除工具分类信息
*
* @param id 工具分类主键
* @return 结果
*/
public int deleteWorkToolCategoryById(Long id);
}

View File

@@ -0,0 +1,63 @@
package com.intc.invest.service;
import java.util.List;
import com.intc.invest.domain.WorkTool;
import com.intc.invest.domain.dto.WorkToolDto;
import com.intc.invest.domain.vo.WorkToolVo;
/**
* 工具Service接口
*
* @author intc
* @date 2024-12-12
*/
public interface IWorkToolService
{
/**
* 查询工具
*
* @param id 工具主键
* @return 工具
*/
public WorkToolVo selectWorkToolById(Long id);
/**
* 查询工具列表
*
* @param workToolDto 工具
* @return 工具集合
*/
public List<WorkToolVo> selectWorkToolList(WorkToolDto workToolDto);
/**
* 新增工具
*
* @param workTool 工具
* @return 结果
*/
public int insertWorkTool(WorkTool workTool);
/**
* 修改工具
*
* @param workTool 工具
* @return 结果
*/
public int updateWorkTool(WorkTool workTool);
/**
* 批量删除工具
*
* @param ids 需要删除的工具主键集合
* @return 结果
*/
public int deleteWorkToolByIds(Long[] ids);
/**
* 删除工具信息
*
* @param id 工具主键
* @return 结果
*/
public int deleteWorkToolById(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.WorkToolCategory;
import com.intc.invest.domain.dto.WorkToolCategoryDto;
import com.intc.invest.domain.vo.WorkToolCategoryVo;
import com.intc.invest.mapper.WorkToolCategoryMapper;
import com.intc.invest.service.IWorkToolCategoryService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 工具分类Service业务层处理
*
* @author intc
* @date 2024-12-12
*/
@Service
public class WorkToolCategoryServiceImpl implements IWorkToolCategoryService
{
@Resource
private WorkToolCategoryMapper workToolCategoryMapper;
/**
* 查询工具分类
*
* @param id 工具分类主键
* @return 工具分类
*/
@Override
public WorkToolCategoryVo selectWorkToolCategoryById(Long id)
{
return workToolCategoryMapper.selectWorkToolCategoryById(id);
}
/**
* 查询工具分类列表
*
* @param workToolCategoryDto 工具分类
* @return 工具分类
*/
@Override
public List<WorkToolCategoryVo> selectWorkToolCategoryList(WorkToolCategoryDto workToolCategoryDto)
{
return workToolCategoryMapper.selectWorkToolCategoryList(workToolCategoryDto);
}
/**
* 新增工具分类
*
* @param workToolCategory 工具分类
* @return 结果
*/
@Override
public int insertWorkToolCategory(WorkToolCategory workToolCategory)
{
workToolCategory.setCreateBy(SecurityUtils.getUsername());
workToolCategory.setCreateTime(DateUtils.getNowDate());
workToolCategory.setId(IdWorker.getId());
return workToolCategoryMapper.insertWorkToolCategory(workToolCategory);
}
/**
* 修改工具分类
*
* @param workToolCategory 工具分类
* @return 结果
*/
@Override
public int updateWorkToolCategory(WorkToolCategory workToolCategory)
{
workToolCategory.setUpdateBy(SecurityUtils.getUsername());
workToolCategory.setUpdateTime(DateUtils.getNowDate());
return workToolCategoryMapper.updateWorkToolCategory(workToolCategory);
}
/**
* 批量删除工具分类
*
* @param ids 需要删除的工具分类主键
* @return 结果
*/
@Override
public int deleteWorkToolCategoryByIds(Long[] ids)
{
return workToolCategoryMapper.removeWorkToolCategoryByIds(ids);
}
/**
* 删除工具分类信息
*
* @param id 工具分类主键
* @return 结果
*/
@Override
public int deleteWorkToolCategoryById(Long id)
{
return workToolCategoryMapper.removeWorkToolCategoryById(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.WorkTool;
import com.intc.invest.domain.dto.WorkToolDto;
import com.intc.invest.domain.vo.WorkToolVo;
import com.intc.invest.mapper.WorkToolMapper;
import com.intc.invest.service.IWorkToolService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 工具Service业务层处理
*
* @author intc
* @date 2024-12-12
*/
@Service
public class WorkToolServiceImpl implements IWorkToolService
{
@Resource
private WorkToolMapper workToolMapper;
/**
* 查询工具
*
* @param id 工具主键
* @return 工具
*/
@Override
public WorkToolVo selectWorkToolById(Long id)
{
return workToolMapper.selectWorkToolById(id);
}
/**
* 查询工具列表
*
* @param workToolDto 工具
* @return 工具
*/
@Override
public List<WorkToolVo> selectWorkToolList(WorkToolDto workToolDto)
{
return workToolMapper.selectWorkToolList(workToolDto);
}
/**
* 新增工具
*
* @param workTool 工具
* @return 结果
*/
@Override
public int insertWorkTool(WorkTool workTool)
{
workTool.setCreateBy(SecurityUtils.getUsername());
workTool.setCreateTime(DateUtils.getNowDate());
workTool.setId(IdWorker.getId());
return workToolMapper.insertWorkTool(workTool);
}
/**
* 修改工具
*
* @param workTool 工具
* @return 结果
*/
@Override
public int updateWorkTool(WorkTool workTool)
{
workTool.setUpdateBy(SecurityUtils.getUsername());
workTool.setUpdateTime(DateUtils.getNowDate());
return workToolMapper.updateWorkTool(workTool);
}
/**
* 批量删除工具
*
* @param ids 需要删除的工具主键
* @return 结果
*/
@Override
public int deleteWorkToolByIds(Long[] ids)
{
return workToolMapper.removeWorkToolByIds(ids);
}
/**
* 删除工具信息
*
* @param id 工具主键
* @return 结果
*/
@Override
public int deleteWorkToolById(Long id)
{
return workToolMapper.removeWorkToolById(id);
}
}

View File

@@ -0,0 +1,114 @@
<?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.WorkToolCategoryMapper">
<resultMap type="WorkToolCategoryVo" id="WorkToolCategoryResult">
<result property="id" column="id" />
<result property="categoryKey" column="category_key" />
<result property="categoryTitle" column="category_title" />
<result property="sortOrder" column="sort_order" />
<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="delFlag" column="del_flag" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectWorkToolCategoryVo">
select
wtc.id,
wtc.category_key,
wtc.category_title,
wtc.sort_order,
wtc.create_by,
wtc.create_time,
wtc.update_by,
wtc.update_time,
wtc.del_flag,
wtc.remark
from work_tool_category wtc
</sql>
<select id="selectWorkToolCategoryList" parameterType="WorkToolCategoryDto" resultMap="WorkToolCategoryResult">
<include refid="selectWorkToolCategoryVo"/>
<where>
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>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
order by wtc.sort_order asc, wtc.create_time desc
</select>
<select id="selectWorkToolCategoryById" parameterType="Long" resultMap="WorkToolCategoryResult">
<include refid="selectWorkToolCategoryVo"/>
where wtc.id = #{id}
</select>
<insert id="insertWorkToolCategory" parameterType="WorkToolCategory">
insert into work_tool_category
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<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="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="delFlag != null">del_flag,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="categoryKey != null and categoryKey != ''">#{categoryKey},</if>
<if test="categoryTitle != null and categoryTitle != ''">#{categoryTitle},</if>
<if test="sortOrder != null">#{sortOrder},</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="delFlag != null">#{delFlag},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateWorkToolCategory" parameterType="WorkToolCategory">
update work_tool_category
<trim prefix="SET" suffixOverrides=",">
<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="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="deleteWorkToolCategoryById" parameterType="Long">
delete from work_tool_category where id = #{id}
</delete>
<delete id="deleteWorkToolCategoryByIds" parameterType="String">
delete from work_tool_category where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="removeWorkToolCategoryById" parameterType="Long">
update work_tool_category set del_flag='1' where id = #{id}
</update>
<update id="removeWorkToolCategoryByIds" parameterType="String">
update work_tool_category set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

View File

@@ -0,0 +1,145 @@
<?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.WorkToolMapper">
<resultMap type="WorkToolVo" id="WorkToolResult">
<result property="id" column="id" />
<result property="categoryId" column="category_id" />
<result property="name" column="name" />
<result property="description" column="description" />
<result property="url" column="url" />
<result property="displayUrl" column="display_url" />
<result property="icon" column="icon" />
<result property="color" column="color" />
<result property="sortOrder" column="sort_order" />
<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="delFlag" column="del_flag" />
<result property="remark" column="remark" />
<result property="categoryKey" column="category_key" />
<result property="categoryTitle" column="category_title" />
</resultMap>
<sql id="selectWorkToolVo">
select
wt.id,
wt.category_id,
wt.name,
wt.description,
wt.url,
wt.display_url,
wt.icon,
wt.color,
wt.sort_order,
wt.create_by,
wt.create_time,
wt.update_by,
wt.update_time,
wt.del_flag,
wt.remark,
wtc.category_key,
wtc.category_title
from work_tool wt
left join work_tool_category wtc on wt.category_id = wtc.id
</sql>
<select id="selectWorkToolList" parameterType="WorkToolDto" resultMap="WorkToolResult">
<include refid="selectWorkToolVo"/>
<where>
wt.del_flag='0'
<if test="categoryId != null"> and wt.category_id = #{categoryId}</if>
<if test="name != null and name != ''"> and wt.name like '%'|| #{name}||'%'</if>
<if test="categoryKey != null and categoryKey != ''"> and wtc.category_key = #{categoryKey}</if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
order by wt.category_id asc, wt.sort_order asc, wt.create_time desc
</select>
<select id="selectWorkToolById" parameterType="Long" resultMap="WorkToolResult">
<include refid="selectWorkToolVo"/>
where wt.id = #{id}
</select>
<insert id="insertWorkTool" parameterType="WorkTool">
insert into work_tool
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="categoryId != null">category_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="description != null">description,</if>
<if test="url != null and url != ''">url,</if>
<if test="displayUrl != null">display_url,</if>
<if test="icon != null">icon,</if>
<if test="color != null">color,</if>
<if test="sortOrder != null">sort_order,</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="delFlag != null">del_flag,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="categoryId != null">#{categoryId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="description != null">#{description},</if>
<if test="url != null and url != ''">#{url},</if>
<if test="displayUrl != null">#{displayUrl},</if>
<if test="icon != null">#{icon},</if>
<if test="color != null">#{color},</if>
<if test="sortOrder != null">#{sortOrder},</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="delFlag != null">#{delFlag},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateWorkTool" parameterType="WorkTool">
update work_tool
<trim prefix="SET" suffixOverrides=",">
<if test="categoryId != null">category_id = #{categoryId},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="description != null">description = #{description},</if>
<if test="url != null and url != ''">url = #{url},</if>
<if test="displayUrl != null">display_url = #{displayUrl},</if>
<if test="icon != null">icon = #{icon},</if>
<if test="color != null">color = #{color},</if>
<if test="sortOrder != null">sort_order = #{sortOrder},</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="deleteWorkToolById" parameterType="Long">
delete from work_tool where id = #{id}
</delete>
<delete id="deleteWorkToolByIds" parameterType="String">
delete from work_tool where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="removeWorkToolById" parameterType="Long">
update work_tool set del_flag='1' where id = #{id}
</update>
<update id="removeWorkToolByIds" parameterType="String">
update work_tool set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>