From c2963c9ba128728788add2586f1fb5dc421ca6b5 Mon Sep 17 00:00:00 2001 From: 龚焕茏 <2842157468@qq.com> Date: 星期三, 10 四月 2024 18:11:31 +0800 Subject: [PATCH] 新增运维平台、资产管理 --- ycl-server/src/main/resources/mapper/zgyw/TPlatformMapper.xml | 103 +++++++++++ ycl-server/src/main/java/com/ycl/platform/mapper/TPlatformMapper.java | 61 ++++++ ycl-pojo/src/main/java/com/ycl/platform/domain/entity/TPlatform.java | 129 ++++++++++++++ ycl-server/src/main/java/com/ycl/platform/service/ITPlatformService.java | 61 ++++++ ycl-server/src/main/java/com/ycl/platform/service/impl/TPlatformServiceImpl.java | 90 ++++++++++ ycl-server/src/main/java/com/ycl/platform/controller/TPlatformController.java | 90 ++++++++++ 6 files changed, 534 insertions(+), 0 deletions(-) diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/TPlatform.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/TPlatform.java new file mode 100644 index 0000000..6618bb5 --- /dev/null +++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/TPlatform.java @@ -0,0 +1,129 @@ +package com.ycl.platform.domain.entity; + + +import annotation.Excel; +import com.ycl.system.entity.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 骞冲彴杩愯鐩戞帶瀵硅薄 t_platform + * + * @author gonghl + * @date 2024-04-10 + */ +public class TPlatform extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 涓婚敭 + */ + private Long id; + + /** + * 骞冲彴缂栫爜 + */ + @Excel(name = "骞冲彴缂栫爜") + private String platformCode; + + /** + * 骞冲彴鍚嶇О + */ + @Excel(name = "骞冲彴鍚嶇О") + private String platformName; + + /** + * 骞冲彴鑱旂郴浜� + */ + @Excel(name = "骞冲彴鑱旂郴浜�") + private String platformContact; + + /** + * 骞冲彴鑱旂郴浜虹數璇� + */ + @Excel(name = "骞冲彴鑱旂郴浜虹數璇�") + private String platformContactPhone; + + /** + * 鐘舵�侊細1姝e父 2寮傚父 + */ + @Excel(name = "鐘舵�侊細1姝e父 2寮傚父") + private String status; + + /** + * 閫昏緫鍒犻櫎锛�0鏈垹闄� 1鍒犻櫎 + */ + private String deleted; + + public void setId(Long id) { + this.id = id; + } + + public Long getId() { + return id; + } + + public void setPlatformCode(String platformCode) { + this.platformCode = platformCode; + } + + public String getPlatformCode() { + return platformCode; + } + + public void setPlatformName(String platformName) { + this.platformName = platformName; + } + + public String getPlatformName() { + return platformName; + } + + public void setPlatformContact(String platformContact) { + this.platformContact = platformContact; + } + + public String getPlatformContact() { + return platformContact; + } + + public void setPlatformContactPhone(String platformContactPhone) { + this.platformContactPhone = platformContactPhone; + } + + public String getPlatformContactPhone() { + return platformContactPhone; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getStatus() { + return status; + } + + public void setDeleted(String deleted) { + this.deleted = deleted; + } + + public String getDeleted() { + return deleted; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("platformCode", getPlatformCode()) + .append("platformName", getPlatformName()) + .append("platformContact", getPlatformContact()) + .append("platformContactPhone", getPlatformContactPhone()) + .append("status", getStatus()) + .append("remark", getRemark()) + .append("createTime", getCreateTime()) + .append("updateTime", getUpdateTime()) + .append("deleted", getDeleted()) + .toString(); + } +} diff --git a/ycl-server/src/main/java/com/ycl/platform/controller/TPlatformController.java b/ycl-server/src/main/java/com/ycl/platform/controller/TPlatformController.java new file mode 100644 index 0000000..167be5c --- /dev/null +++ b/ycl-server/src/main/java/com/ycl/platform/controller/TPlatformController.java @@ -0,0 +1,90 @@ +package com.ycl.platform.controller; + +import annotation.Log; +import com.ycl.platform.domain.entity.TPlatform; +import com.ycl.platform.service.ITPlatformService; +import com.ycl.system.AjaxResult; +import com.ycl.system.controller.BaseController; +import com.ycl.system.page.TableDataInfo; +import com.ycl.utils.poi.ExcelUtil; +import enumeration.BusinessType; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 骞冲彴杩愯鐩戞帶Controller + * + * @author gonghl + * @date 2024-04-10 + */ +@RestController +@RequestMapping("/platform/platformMonitor") +public class TPlatformController extends BaseController { + @Autowired + private ITPlatformService tPlatformService; + + /** + * 鏌ヨ骞冲彴杩愯鐩戞帶鍒楄〃 + */ + // @PreAuthorize("@ss.hasPermi('platform:platform:list')") + @GetMapping("/list") + public TableDataInfo list(TPlatform tPlatform) { + startPage(); + List<TPlatform> list = tPlatformService.selectTPlatformList(tPlatform); + return getDataTable(list); + } + + /** + * 瀵煎嚭骞冲彴杩愯鐩戞帶鍒楄〃 + */ + // @PreAuthorize("@ss.hasPermi('platform:platform:export')") + @Log(title = "骞冲彴杩愯鐩戞帶", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, TPlatform tPlatform) { + List<TPlatform> list = tPlatformService.selectTPlatformList(tPlatform); + ExcelUtil<TPlatform> util = new ExcelUtil<TPlatform>(TPlatform.class); + util.exportExcel(response, list, "骞冲彴杩愯鐩戞帶鏁版嵁"); + } + + /** + * 鑾峰彇骞冲彴杩愯鐩戞帶璇︾粏淇℃伅 + */ + // @PreAuthorize("@ss.hasPermi('platform:platform:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return success(tPlatformService.selectTPlatformById(id)); + } + + /** + * 鏂板骞冲彴杩愯鐩戞帶 + */ + // @PreAuthorize("@ss.hasPermi('platform:platform:add')") + @Log(title = "骞冲彴杩愯鐩戞帶", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody TPlatform tPlatform) { + return toAjax(tPlatformService.insertTPlatform(tPlatform)); + } + + /** + * 淇敼骞冲彴杩愯鐩戞帶 + */ + // @PreAuthorize("@ss.hasPermi('platform:platform:edit')") + @Log(title = "骞冲彴杩愯鐩戞帶", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody TPlatform tPlatform) { + return toAjax(tPlatformService.updateTPlatform(tPlatform)); + } + + /** + * 鍒犻櫎骞冲彴杩愯鐩戞帶 + */ + // @PreAuthorize("@ss.hasPermi('platform:platform:remove')") + @Log(title = "骞冲彴杩愯鐩戞帶", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(tPlatformService.deleteTPlatformByIds(ids)); + } +} diff --git a/ycl-server/src/main/java/com/ycl/platform/mapper/TPlatformMapper.java b/ycl-server/src/main/java/com/ycl/platform/mapper/TPlatformMapper.java new file mode 100644 index 0000000..7d7eef6 --- /dev/null +++ b/ycl-server/src/main/java/com/ycl/platform/mapper/TPlatformMapper.java @@ -0,0 +1,61 @@ +package com.ycl.platform.mapper; + +import com.ycl.platform.domain.entity.TPlatform; + +import java.util.List; + +/** + * 骞冲彴杩愯鐩戞帶Mapper鎺ュ彛 + * + * @author gonghl + * @date 2024-04-10 + */ +public interface TPlatformMapper { + /** + * 鏌ヨ骞冲彴杩愯鐩戞帶 + * + * @param id 骞冲彴杩愯鐩戞帶涓婚敭 + * @return 骞冲彴杩愯鐩戞帶 + */ + public TPlatform selectTPlatformById(Long id); + + /** + * 鏌ヨ骞冲彴杩愯鐩戞帶鍒楄〃 + * + * @param tPlatform 骞冲彴杩愯鐩戞帶 + * @return 骞冲彴杩愯鐩戞帶闆嗗悎 + */ + public List<TPlatform> selectTPlatformList(TPlatform tPlatform); + + /** + * 鏂板骞冲彴杩愯鐩戞帶 + * + * @param tPlatform 骞冲彴杩愯鐩戞帶 + * @return 缁撴灉 + */ + public int insertTPlatform(TPlatform tPlatform); + + /** + * 淇敼骞冲彴杩愯鐩戞帶 + * + * @param tPlatform 骞冲彴杩愯鐩戞帶 + * @return 缁撴灉 + */ + public int updateTPlatform(TPlatform tPlatform); + + /** + * 鍒犻櫎骞冲彴杩愯鐩戞帶 + * + * @param id 骞冲彴杩愯鐩戞帶涓婚敭 + * @return 缁撴灉 + */ + public int deleteTPlatformById(Long id); + + /** + * 鎵归噺鍒犻櫎骞冲彴杩愯鐩戞帶 + * + * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎 + * @return 缁撴灉 + */ + public int deleteTPlatformByIds(Long[] ids); +} diff --git a/ycl-server/src/main/java/com/ycl/platform/service/ITPlatformService.java b/ycl-server/src/main/java/com/ycl/platform/service/ITPlatformService.java new file mode 100644 index 0000000..8b13b28 --- /dev/null +++ b/ycl-server/src/main/java/com/ycl/platform/service/ITPlatformService.java @@ -0,0 +1,61 @@ +package com.ycl.platform.service; + +import com.ycl.platform.domain.entity.TPlatform; + +import java.util.List; + +/** + * 骞冲彴杩愯鐩戞帶Service鎺ュ彛 + * + * @author gonghl + * @date 2024-04-10 + */ +public interface ITPlatformService { + /** + * 鏌ヨ骞冲彴杩愯鐩戞帶 + * + * @param id 骞冲彴杩愯鐩戞帶涓婚敭 + * @return 骞冲彴杩愯鐩戞帶 + */ + public TPlatform selectTPlatformById(Long id); + + /** + * 鏌ヨ骞冲彴杩愯鐩戞帶鍒楄〃 + * + * @param tPlatform 骞冲彴杩愯鐩戞帶 + * @return 骞冲彴杩愯鐩戞帶闆嗗悎 + */ + public List<TPlatform> selectTPlatformList(TPlatform tPlatform); + + /** + * 鏂板骞冲彴杩愯鐩戞帶 + * + * @param tPlatform 骞冲彴杩愯鐩戞帶 + * @return 缁撴灉 + */ + public int insertTPlatform(TPlatform tPlatform); + + /** + * 淇敼骞冲彴杩愯鐩戞帶 + * + * @param tPlatform 骞冲彴杩愯鐩戞帶 + * @return 缁撴灉 + */ + public int updateTPlatform(TPlatform tPlatform); + + /** + * 鎵归噺鍒犻櫎骞冲彴杩愯鐩戞帶 + * + * @param ids 闇�瑕佸垹闄ょ殑骞冲彴杩愯鐩戞帶涓婚敭闆嗗悎 + * @return 缁撴灉 + */ + public int deleteTPlatformByIds(Long[] ids); + + /** + * 鍒犻櫎骞冲彴杩愯鐩戞帶淇℃伅 + * + * @param id 骞冲彴杩愯鐩戞帶涓婚敭 + * @return 缁撴灉 + */ + public int deleteTPlatformById(Long id); +} diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/TPlatformServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/TPlatformServiceImpl.java new file mode 100644 index 0000000..530e615 --- /dev/null +++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/TPlatformServiceImpl.java @@ -0,0 +1,90 @@ +package com.ycl.platform.service.impl; + +import com.ycl.platform.domain.entity.TPlatform; +import com.ycl.platform.mapper.TPlatformMapper; +import com.ycl.platform.service.ITPlatformService; +import com.ycl.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 骞冲彴杩愯鐩戞帶Service涓氬姟灞傚鐞� + * + * @author gonghl + * @date 2024-04-10 + */ +@Service +public class TPlatformServiceImpl implements ITPlatformService { + @Autowired + private TPlatformMapper tPlatformMapper; + + /** + * 鏌ヨ骞冲彴杩愯鐩戞帶 + * + * @param id 骞冲彴杩愯鐩戞帶涓婚敭 + * @return 骞冲彴杩愯鐩戞帶 + */ + @Override + public TPlatform selectTPlatformById(Long id) { + return tPlatformMapper.selectTPlatformById(id); + } + + /** + * 鏌ヨ骞冲彴杩愯鐩戞帶鍒楄〃 + * + * @param tPlatform 骞冲彴杩愯鐩戞帶 + * @return 骞冲彴杩愯鐩戞帶 + */ + @Override + public List<TPlatform> selectTPlatformList(TPlatform tPlatform) { + return tPlatformMapper.selectTPlatformList(tPlatform); + } + + /** + * 鏂板骞冲彴杩愯鐩戞帶 + * + * @param tPlatform 骞冲彴杩愯鐩戞帶 + * @return 缁撴灉 + */ + @Override + public int insertTPlatform(TPlatform tPlatform) { + tPlatform.setCreateTime(DateUtils.getNowDate()); + return tPlatformMapper.insertTPlatform(tPlatform); + } + + /** + * 淇敼骞冲彴杩愯鐩戞帶 + * + * @param tPlatform 骞冲彴杩愯鐩戞帶 + * @return 缁撴灉 + */ + @Override + public int updateTPlatform(TPlatform tPlatform) { + tPlatform.setUpdateTime(DateUtils.getNowDate()); + return tPlatformMapper.updateTPlatform(tPlatform); + } + + /** + * 鎵归噺鍒犻櫎骞冲彴杩愯鐩戞帶 + * + * @param ids 闇�瑕佸垹闄ょ殑骞冲彴杩愯鐩戞帶涓婚敭 + * @return 缁撴灉 + */ + @Override + public int deleteTPlatformByIds(Long[] ids) { + return tPlatformMapper.deleteTPlatformByIds(ids); + } + + /** + * 鍒犻櫎骞冲彴杩愯鐩戞帶淇℃伅 + * + * @param id 骞冲彴杩愯鐩戞帶涓婚敭 + * @return 缁撴灉 + */ + @Override + public int deleteTPlatformById(Long id) { + return tPlatformMapper.deleteTPlatformById(id); + } +} diff --git a/ycl-server/src/main/resources/mapper/zgyw/TPlatformMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/TPlatformMapper.xml new file mode 100644 index 0000000..c64af12 --- /dev/null +++ b/ycl-server/src/main/resources/mapper/zgyw/TPlatformMapper.xml @@ -0,0 +1,103 @@ +<?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.ycl.platform.mapper.TPlatformMapper"> + + <resultMap type="TPlatform" id="TPlatformResult"> + <result property="id" column="id" /> + <result property="platformCode" column="platform_code" /> + <result property="platformName" column="platform_name" /> + <result property="platformContact" column="platform_contact" /> + <result property="platformContactPhone" column="platform_contact_phone" /> + <result property="status" column="status" /> + <result property="remark" column="remark" /> + <result property="createTime" column="create_time" /> + <result property="updateTime" column="update_time" /> + <result property="deleted" column="deleted" /> + </resultMap> + + <sql id="selectTPlatformVo"> + select id, + platform_code, + platform_name, + platform_contact, + platform_contact_phone, + status, + remark, + create_time, + update_time, + deleted + from t_platform + </sql> + + <select id="selectTPlatformList" parameterType="TPlatform" resultMap="TPlatformResult"> + <include refid="selectTPlatformVo"/> + <where> + <if test="platformCode != null and platformCode != ''"> and platform_code = #{platformCode}</if> + <if test="platformName != null and platformName != ''"> and platform_name like concat('%', #{platformName}, '%')</if> + <if test="platformContact != null and platformContact != ''"> and platform_contact = #{platformContact}</if> + <if test="platformContactPhone != null and platformContactPhone != ''"> and platform_contact_phone = #{platformContactPhone}</if> + <if test="status != null and status != ''"> and status = #{status}</if> + <if test="remark != null and remark != ''"> and remark = #{remark}</if> + </where> + </select> + + <select id="selectTPlatformById" parameterType="Long" resultMap="TPlatformResult"> + <include refid="selectTPlatformVo"/> + where id = #{id} + </select> + + <insert id="insertTPlatform" parameterType="TPlatform" useGeneratedKeys="true" keyProperty="id"> + insert into t_platform + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="platformCode != null and platformCode != ''">platform_code,</if> + <if test="platformName != null and platformName != ''">platform_name,</if> + <if test="platformContact != null and platformContact != ''">platform_contact,</if> + <if test="platformContactPhone != null and platformContactPhone != ''">platform_contact_phone,</if> + <if test="status != null">status,</if> + <if test="remark != null">remark,</if> + <if test="createTime != null">create_time,</if> + <if test="updateTime != null">update_time,</if> + <if test="deleted != null">deleted,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="platformCode != null and platformCode != ''">#{platformCode},</if> + <if test="platformName != null and platformName != ''">#{platformName},</if> + <if test="platformContact != null and platformContact != ''">#{platformContact},</if> + <if test="platformContactPhone != null and platformContactPhone != ''">#{platformContactPhone},</if> + <if test="status != null">#{status},</if> + <if test="remark != null">#{remark},</if> + <if test="createTime != null">#{createTime},</if> + <if test="updateTime != null">#{updateTime},</if> + <if test="deleted != null">#{deleted},</if> + </trim> + </insert> + + <update id="updateTPlatform" parameterType="TPlatform"> + update t_platform + <trim prefix="SET" suffixOverrides=","> + <if test="platformCode != null and platformCode != ''">platform_code = #{platformCode},</if> + <if test="platformName != null and platformName != ''">platform_name = #{platformName},</if> + <if test="platformContact != null and platformContact != ''">platform_contact = #{platformContact},</if> + <if test="platformContactPhone != null and platformContactPhone != ''">platform_contact_phone = #{platformContactPhone},</if> + <if test="status != null">status = #{status},</if> + <if test="remark != null">remark = #{remark},</if> + <if test="createTime != null">create_time = #{createTime},</if> + <if test="updateTime != null">update_time = #{updateTime},</if> + <if test="deleted != null">deleted = #{deleted},</if> + </trim> + where id = #{id} + </update> + + <delete id="deleteTPlatformById" parameterType="Long"> + delete from t_platform where id = #{id} + </delete> + + <delete id="deleteTPlatformByIds" parameterType="String"> + delete from t_platform where id in + <foreach item="id" collection="array" open="(" separator="," close=")"> + #{id} + </foreach> + </delete> +</mapper> \ No newline at end of file -- Gitblit v1.8.0