项目管理接口

This commit is contained in:
lc 2024-04-08 15:01:17 +08:00
parent 9367abf74b
commit c2a2545227
7 changed files with 449 additions and 6 deletions

View File

@ -0,0 +1,98 @@
package com.ruoyi.abuwx.controller;
import com.ruoyi.abuwx.domain.WbProject;
import com.ruoyi.abuwx.service.IWbProjectService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 项目管理Controller
*
* @author ruoyi
* @date 2024-04-08
*/
@RestController
@RequestMapping("/abuwx/project")
public class WbProjectController extends BaseController
{
@Autowired
private IWbProjectService wbProjectService;
/**
* 查询项目管理列表
*/
@PreAuthorize("@ss.hasPermi('abuwx:project:list')")
@GetMapping("/list")
public TableDataInfo list(WbProject wbProject)
{
startPage();
List<WbProject> list = wbProjectService.selectWbProjectList(wbProject);
return getDataTable(list);
}
/**
* 导出项目管理列表
*/
@PreAuthorize("@ss.hasPermi('abuwx:project:export')")
@Log(title = "项目管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WbProject wbProject)
{
List<WbProject> list = wbProjectService.selectWbProjectList(wbProject);
ExcelUtil<WbProject> util = new ExcelUtil<WbProject>(WbProject.class);
util.exportExcel(response, list, "项目管理数据");
}
/**
* 获取项目管理详细信息
*/
@PreAuthorize("@ss.hasPermi('abuwx:project:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(wbProjectService.selectWbProjectById(id));
}
/**
* 新增项目管理
*/
@PreAuthorize("@ss.hasPermi('abuwx:project:add')")
@Log(title = "项目管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WbProject wbProject)
{
return toAjax(wbProjectService.insertWbProject(wbProject));
}
/**
* 修改项目管理
*/
@PreAuthorize("@ss.hasPermi('abuwx:project:edit')")
@Log(title = "项目管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WbProject wbProject)
{
return toAjax(wbProjectService.updateWbProject(wbProject));
}
/**
* 删除项目管理
*/
@PreAuthorize("@ss.hasPermi('abuwx:project:remove')")
@Log(title = "项目管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(wbProjectService.deleteWbProjectByIds(ids));
}
}

View File

@ -0,0 +1,65 @@
package com.ruoyi.abuwx.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 项目管理对象 wb_project
*
* @author ruoyi
* @date 2024-04-08
*/
public class WbProject extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
private Long id;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 项目概况 */
@Excel(name = "项目概况")
private String projectOverview;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setProjectName(String projectName)
{
this.projectName = projectName;
}
public String getProjectName()
{
return projectName;
}
public void setProjectOverview(String projectOverview)
{
this.projectOverview = projectOverview;
}
public String getProjectOverview()
{
return projectOverview;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("projectName", getProjectName())
.append("projectOverview", getProjectOverview())
.toString();
}
}

View File

@ -0,0 +1,62 @@
package com.ruoyi.abuwx.mapper;
import com.ruoyi.abuwx.domain.WbProject;
import java.util.List;
/**
* 项目管理Mapper接口
*
* @author ruoyi
* @date 2024-04-08
*/
public interface WbProjectMapper
{
/**
* 查询项目管理
*
* @param id 项目管理主键
* @return 项目管理
*/
public WbProject selectWbProjectById(Long id);
/**
* 查询项目管理列表
*
* @param wbProject 项目管理
* @return 项目管理集合
*/
public List<WbProject> selectWbProjectList(WbProject wbProject);
/**
* 新增项目管理
*
* @param wbProject 项目管理
* @return 结果
*/
public int insertWbProject(WbProject wbProject);
/**
* 修改项目管理
*
* @param wbProject 项目管理
* @return 结果
*/
public int updateWbProject(WbProject wbProject);
/**
* 删除项目管理
*
* @param id 项目管理主键
* @return 结果
*/
public int deleteWbProjectById(Long id);
/**
* 批量删除项目管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWbProjectByIds(Long[] ids);
}

View File

@ -0,0 +1,62 @@
package com.ruoyi.abuwx.service;
import com.ruoyi.abuwx.domain.WbProject;
import java.util.List;
/**
* 项目管理Service接口
*
* @author ruoyi
* @date 2024-04-08
*/
public interface IWbProjectService
{
/**
* 查询项目管理
*
* @param id 项目管理主键
* @return 项目管理
*/
public WbProject selectWbProjectById(Long id);
/**
* 查询项目管理列表
*
* @param wbProject 项目管理
* @return 项目管理集合
*/
public List<WbProject> selectWbProjectList(WbProject wbProject);
/**
* 新增项目管理
*
* @param wbProject 项目管理
* @return 结果
*/
public int insertWbProject(WbProject wbProject);
/**
* 修改项目管理
*
* @param wbProject 项目管理
* @return 结果
*/
public int updateWbProject(WbProject wbProject);
/**
* 批量删除项目管理
*
* @param ids 需要删除的项目管理主键集合
* @return 结果
*/
public int deleteWbProjectByIds(Long[] ids);
/**
* 删除项目管理信息
*
* @param id 项目管理主键
* @return 结果
*/
public int deleteWbProjectById(Long id);
}

View File

@ -0,0 +1,94 @@
package com.ruoyi.abuwx.service.impl;
import com.ruoyi.abuwx.domain.WbProject;
import com.ruoyi.abuwx.mapper.WbProjectMapper;
import com.ruoyi.abuwx.service.IWbProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 项目管理Service业务层处理
*
* @author ruoyi
* @date 2024-04-08
*/
@Service
public class WbProjectServiceImpl implements IWbProjectService
{
@Autowired
private WbProjectMapper wbProjectMapper;
/**
* 查询项目管理
*
* @param id 项目管理主键
* @return 项目管理
*/
@Override
public WbProject selectWbProjectById(Long id)
{
return wbProjectMapper.selectWbProjectById(id);
}
/**
* 查询项目管理列表
*
* @param wbProject 项目管理
* @return 项目管理
*/
@Override
public List<WbProject> selectWbProjectList(WbProject wbProject)
{
return wbProjectMapper.selectWbProjectList(wbProject);
}
/**
* 新增项目管理
*
* @param wbProject 项目管理
* @return 结果
*/
@Override
public int insertWbProject(WbProject wbProject)
{
return wbProjectMapper.insertWbProject(wbProject);
}
/**
* 修改项目管理
*
* @param wbProject 项目管理
* @return 结果
*/
@Override
public int updateWbProject(WbProject wbProject)
{
return wbProjectMapper.updateWbProject(wbProject);
}
/**
* 批量删除项目管理
*
* @param ids 需要删除的项目管理主键
* @return 结果
*/
@Override
public int deleteWbProjectByIds(Long[] ids)
{
return wbProjectMapper.deleteWbProjectByIds(ids);
}
/**
* 删除项目管理信息
*
* @param id 项目管理主键
* @return 结果
*/
@Override
public int deleteWbProjectById(Long id)
{
return wbProjectMapper.deleteWbProjectById(id);
}
}

View File

@ -0,0 +1,61 @@
<?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.ruoyi.abuwx.mapper.WbProjectMapper">
<resultMap type="WbProject" id="WbProjectResult">
<result property="id" column="id" />
<result property="projectName" column="project_name" />
<result property="projectOverview" column="project_overview" />
</resultMap>
<sql id="selectWbProjectVo">
select id, project_name, project_overview from wb_project
</sql>
<select id="selectWbProjectList" parameterType="WbProject" resultMap="WbProjectResult">
<include refid="selectWbProjectVo"/>
<where>
<if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
<if test="projectOverview != null and projectOverview != ''"> and project_overview = #{projectOverview}</if>
</where>
</select>
<select id="selectWbProjectById" parameterType="Long" resultMap="WbProjectResult">
<include refid="selectWbProjectVo"/>
where id = #{id}
</select>
<insert id="insertWbProject" parameterType="WbProject" useGeneratedKeys="true" keyProperty="id">
insert into wb_project
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="projectName != null">project_name,</if>
<if test="projectOverview != null">project_overview,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectName != null">#{projectName},</if>
<if test="projectOverview != null">#{projectOverview},</if>
</trim>
</insert>
<update id="updateWbProject" parameterType="WbProject">
update wb_project
<trim prefix="SET" suffixOverrides=",">
<if test="projectName != null">project_name = #{projectName},</if>
<if test="projectOverview != null">project_overview = #{projectOverview},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWbProjectById" parameterType="Long">
delete from wb_project where id = #{id}
</delete>
<delete id="deleteWbProjectByIds" parameterType="String">
delete from wb_project where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -1,11 +1,5 @@
package com.ruoyi.common.utils.file;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Objects;
import org.apache.commons.io.FilenameUtils;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.exception.file.FileNameLengthLimitExceededException;
@ -14,6 +8,13 @@ import com.ruoyi.common.exception.file.InvalidExtensionException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.Seq;
import org.apache.commons.io.FilenameUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Objects;
/**
* 文件上传工具类