维保记录模块接口

This commit is contained in:
lc 2024-04-09 10:51:31 +08:00
parent f399f0fa4e
commit 333fbe21d5
6 changed files with 508 additions and 0 deletions

View File

@ -0,0 +1,98 @@
package com.ruoyi.abuwx.controller;
import com.ruoyi.abuwx.domain.WbMaintenanceInformation;
import com.ruoyi.abuwx.service.IWbMaintenanceInformationService;
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-09
*/
@RestController
@RequestMapping("/abuwx/information")
public class WbMaintenanceInformationController extends BaseController
{
@Autowired
private IWbMaintenanceInformationService wbMaintenanceInformationService;
/**
* 查询维保记录列表
*/
@PreAuthorize("@ss.hasPermi('abuwx:information:list')")
@GetMapping("/list")
public TableDataInfo list(WbMaintenanceInformation wbMaintenanceInformation)
{
startPage();
List<WbMaintenanceInformation> list = wbMaintenanceInformationService.selectWbMaintenanceInformationList(wbMaintenanceInformation);
return getDataTable(list);
}
/**
* 导出维保记录列表
*/
@PreAuthorize("@ss.hasPermi('abuwx:information:export')")
@Log(title = "维保记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WbMaintenanceInformation wbMaintenanceInformation)
{
List<WbMaintenanceInformation> list = wbMaintenanceInformationService.selectWbMaintenanceInformationList(wbMaintenanceInformation);
ExcelUtil<WbMaintenanceInformation> util = new ExcelUtil<WbMaintenanceInformation>(WbMaintenanceInformation.class);
util.exportExcel(response, list, "维保记录数据");
}
/**
* 获取维保记录详细信息
*/
@PreAuthorize("@ss.hasPermi('abuwx:information:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(wbMaintenanceInformationService.selectWbMaintenanceInformationById(id));
}
/**
* 新增维保记录
*/
@PreAuthorize("@ss.hasPermi('abuwx:information:add')")
@Log(title = "维保记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WbMaintenanceInformation wbMaintenanceInformation)
{
return toAjax(wbMaintenanceInformationService.insertWbMaintenanceInformation(wbMaintenanceInformation));
}
/**
* 修改维保记录
*/
@PreAuthorize("@ss.hasPermi('abuwx:information:edit')")
@Log(title = "维保记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WbMaintenanceInformation wbMaintenanceInformation)
{
return toAjax(wbMaintenanceInformationService.updateWbMaintenanceInformation(wbMaintenanceInformation));
}
/**
* 删除维保记录
*/
@PreAuthorize("@ss.hasPermi('abuwx:information:remove')")
@Log(title = "维保记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(wbMaintenanceInformationService.deleteWbMaintenanceInformationByIds(ids));
}
}

View File

@ -0,0 +1,98 @@
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_maintenance_information
*
* @author ruoyi
* @date 2024-04-09
*/
public class WbMaintenanceInformation extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
private Long id;
/** 项目管理表id */
@Excel(name = "项目管理表id")
private Long projectId;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 图片 */
@Excel(name = "图片")
private String imageUrl;
/** 附件 */
@Excel(name = "附件")
private String fileUrl;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setProjectId(Long projectId)
{
this.projectId = projectId;
}
public Long getProjectId()
{
return projectId;
}
public void setProjectName(String projectName)
{
this.projectName = projectName;
}
public String getProjectName()
{
return projectName;
}
public void setImageUrl(String imageUrl)
{
this.imageUrl = imageUrl;
}
public String getImageUrl()
{
return imageUrl;
}
public void setFileUrl(String fileUrl)
{
this.fileUrl = fileUrl;
}
public String getFileUrl()
{
return fileUrl;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("projectId", getProjectId())
.append("projectName", getProjectName())
.append("imageUrl", getImageUrl())
.append("fileUrl", getFileUrl())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,62 @@
package com.ruoyi.abuwx.mapper;
import com.ruoyi.abuwx.domain.WbMaintenanceInformation;
import java.util.List;
/**
* 维保记录Mapper接口
*
* @author ruoyi
* @date 2024-04-09
*/
public interface WbMaintenanceInformationMapper
{
/**
* 查询维保记录
*
* @param id 维保记录主键
* @return 维保记录
*/
public WbMaintenanceInformation selectWbMaintenanceInformationById(Long id);
/**
* 查询维保记录列表
*
* @param wbMaintenanceInformation 维保记录
* @return 维保记录集合
*/
public List<WbMaintenanceInformation> selectWbMaintenanceInformationList(WbMaintenanceInformation wbMaintenanceInformation);
/**
* 新增维保记录
*
* @param wbMaintenanceInformation 维保记录
* @return 结果
*/
public int insertWbMaintenanceInformation(WbMaintenanceInformation wbMaintenanceInformation);
/**
* 修改维保记录
*
* @param wbMaintenanceInformation 维保记录
* @return 结果
*/
public int updateWbMaintenanceInformation(WbMaintenanceInformation wbMaintenanceInformation);
/**
* 删除维保记录
*
* @param id 维保记录主键
* @return 结果
*/
public int deleteWbMaintenanceInformationById(Long id);
/**
* 批量删除维保记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWbMaintenanceInformationByIds(Long[] ids);
}

View File

@ -0,0 +1,62 @@
package com.ruoyi.abuwx.service;
import com.ruoyi.abuwx.domain.WbMaintenanceInformation;
import java.util.List;
/**
* 维保记录Service接口
*
* @author ruoyi
* @date 2024-04-09
*/
public interface IWbMaintenanceInformationService
{
/**
* 查询维保记录
*
* @param id 维保记录主键
* @return 维保记录
*/
public WbMaintenanceInformation selectWbMaintenanceInformationById(Long id);
/**
* 查询维保记录列表
*
* @param wbMaintenanceInformation 维保记录
* @return 维保记录集合
*/
public List<WbMaintenanceInformation> selectWbMaintenanceInformationList(WbMaintenanceInformation wbMaintenanceInformation);
/**
* 新增维保记录
*
* @param wbMaintenanceInformation 维保记录
* @return 结果
*/
public int insertWbMaintenanceInformation(WbMaintenanceInformation wbMaintenanceInformation);
/**
* 修改维保记录
*
* @param wbMaintenanceInformation 维保记录
* @return 结果
*/
public int updateWbMaintenanceInformation(WbMaintenanceInformation wbMaintenanceInformation);
/**
* 批量删除维保记录
*
* @param ids 需要删除的维保记录主键集合
* @return 结果
*/
public int deleteWbMaintenanceInformationByIds(Long[] ids);
/**
* 删除维保记录信息
*
* @param id 维保记录主键
* @return 结果
*/
public int deleteWbMaintenanceInformationById(Long id);
}

View File

@ -0,0 +1,97 @@
package com.ruoyi.abuwx.service.impl;
import com.ruoyi.abuwx.domain.WbMaintenanceInformation;
import com.ruoyi.abuwx.mapper.WbMaintenanceInformationMapper;
import com.ruoyi.abuwx.service.IWbMaintenanceInformationService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 维保记录Service业务层处理
*
* @author ruoyi
* @date 2024-04-09
*/
@Service
public class WbMaintenanceInformationServiceImpl implements IWbMaintenanceInformationService
{
@Autowired
private WbMaintenanceInformationMapper wbMaintenanceInformationMapper;
/**
* 查询维保记录
*
* @param id 维保记录主键
* @return 维保记录
*/
@Override
public WbMaintenanceInformation selectWbMaintenanceInformationById(Long id)
{
return wbMaintenanceInformationMapper.selectWbMaintenanceInformationById(id);
}
/**
* 查询维保记录列表
*
* @param wbMaintenanceInformation 维保记录
* @return 维保记录
*/
@Override
public List<WbMaintenanceInformation> selectWbMaintenanceInformationList(WbMaintenanceInformation wbMaintenanceInformation)
{
return wbMaintenanceInformationMapper.selectWbMaintenanceInformationList(wbMaintenanceInformation);
}
/**
* 新增维保记录
*
* @param wbMaintenanceInformation 维保记录
* @return 结果
*/
@Override
public int insertWbMaintenanceInformation(WbMaintenanceInformation wbMaintenanceInformation)
{
wbMaintenanceInformation.setCreateTime(DateUtils.getNowDate());
return wbMaintenanceInformationMapper.insertWbMaintenanceInformation(wbMaintenanceInformation);
}
/**
* 修改维保记录
*
* @param wbMaintenanceInformation 维保记录
* @return 结果
*/
@Override
public int updateWbMaintenanceInformation(WbMaintenanceInformation wbMaintenanceInformation)
{
wbMaintenanceInformation.setUpdateTime(DateUtils.getNowDate());
return wbMaintenanceInformationMapper.updateWbMaintenanceInformation(wbMaintenanceInformation);
}
/**
* 批量删除维保记录
*
* @param ids 需要删除的维保记录主键
* @return 结果
*/
@Override
public int deleteWbMaintenanceInformationByIds(Long[] ids)
{
return wbMaintenanceInformationMapper.deleteWbMaintenanceInformationByIds(ids);
}
/**
* 删除维保记录信息
*
* @param id 维保记录主键
* @return 结果
*/
@Override
public int deleteWbMaintenanceInformationById(Long id)
{
return wbMaintenanceInformationMapper.deleteWbMaintenanceInformationById(id);
}
}

View File

@ -0,0 +1,91 @@
<?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.WbMaintenanceInformationMapper">
<resultMap type="WbMaintenanceInformation" id="WbMaintenanceInformationResult">
<result property="id" column="id" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="imageUrl" column="image_url" />
<result property="fileUrl" column="file_url" />
<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="selectWbMaintenanceInformationVo">
select id, project_id, project_name, image_url, file_url, create_by, create_time, update_by, update_time, remark from wb_maintenance_information
</sql>
<select id="selectWbMaintenanceInformationList" parameterType="WbMaintenanceInformation" resultMap="WbMaintenanceInformationResult">
<include refid="selectWbMaintenanceInformationVo"/>
<where>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
<if test="imageUrl != null and imageUrl != ''"> and image_url = #{imageUrl}</if>
<if test="fileUrl != null and fileUrl != ''"> and file_url = #{fileUrl}</if>
</where>
</select>
<select id="selectWbMaintenanceInformationById" parameterType="Long" resultMap="WbMaintenanceInformationResult">
<include refid="selectWbMaintenanceInformationVo"/>
where id = #{id}
</select>
<insert id="insertWbMaintenanceInformation" parameterType="WbMaintenanceInformation" useGeneratedKeys="true" keyProperty="id">
insert into wb_maintenance_information
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="projectId != null">project_id,</if>
<if test="projectName != null">project_name,</if>
<if test="imageUrl != null">image_url,</if>
<if test="fileUrl != null">file_url,</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="projectId != null">#{projectId},</if>
<if test="projectName != null">#{projectName},</if>
<if test="imageUrl != null">#{imageUrl},</if>
<if test="fileUrl != null">#{fileUrl},</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="updateWbMaintenanceInformation" parameterType="WbMaintenanceInformation">
update wb_maintenance_information
<trim prefix="SET" suffixOverrides=",">
<if test="projectId != null">project_id = #{projectId},</if>
<if test="projectName != null">project_name = #{projectName},</if>
<if test="imageUrl != null">image_url = #{imageUrl},</if>
<if test="fileUrl != null">file_url = #{fileUrl},</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="deleteWbMaintenanceInformationById" parameterType="Long">
delete from wb_maintenance_information where id = #{id}
</delete>
<delete id="deleteWbMaintenanceInformationByIds" parameterType="String">
delete from wb_maintenance_information where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>