浏览代码

寿命件配置

wanggaokun 1 年之前
父节点
当前提交
2d24d98d7c

+ 104 - 0
PHM-admin/phm-manage/src/main/java/com/phm/manage/controller/LifePartConfigController.java

@@ -0,0 +1,104 @@
+package com.phm.manage.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+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.phm.common.annotation.Log;
+import com.phm.common.core.controller.BaseController;
+import com.phm.common.core.domain.AjaxResult;
+import com.phm.common.enums.BusinessType;
+import com.phm.manage.domain.LifePartConfig;
+import com.phm.manage.service.ILifePartConfigService;
+import com.phm.common.utils.poi.ExcelUtil;
+import com.phm.common.core.page.TableDataInfo;
+
+/**
+ * 寿命件配置库信息Controller
+ * 
+ * @author phm
+ * @date 2023-08-23
+ */
+@RestController
+@RequestMapping("/manage/lifePartConfig")
+public class LifePartConfigController extends BaseController
+{
+    @Autowired
+    private ILifePartConfigService lifePartConfigService;
+
+    /**
+     * 查询寿命件配置库信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('manage:lifePartConfig:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(LifePartConfig lifePartConfig)
+    {
+        startPage();
+        List<LifePartConfig> list = lifePartConfigService.selectLifePartConfigList(lifePartConfig);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出寿命件配置库信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('manage:lifePartConfig:export')")
+    @Log(title = "寿命件配置库信息", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, LifePartConfig lifePartConfig)
+    {
+        List<LifePartConfig> list = lifePartConfigService.selectLifePartConfigList(lifePartConfig);
+        ExcelUtil<LifePartConfig> util = new ExcelUtil<LifePartConfig>(LifePartConfig.class);
+        util.exportExcel(response, list, "寿命件配置库信息数据");
+    }
+
+    /**
+     * 获取寿命件配置库信息详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('manage:lifePartConfig:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(lifePartConfigService.selectLifePartConfigById(id));
+    }
+
+    /**
+     * 新增寿命件配置库信息
+     */
+    @PreAuthorize("@ss.hasPermi('manage:lifePartConfig:add')")
+    @Log(title = "寿命件配置库信息", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody LifePartConfig lifePartConfig)
+    {
+        return toAjax(lifePartConfigService.insertLifePartConfig(lifePartConfig));
+    }
+
+    /**
+     * 修改寿命件配置库信息
+     */
+    @PreAuthorize("@ss.hasPermi('manage:lifePartConfig:edit')")
+    @Log(title = "寿命件配置库信息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody LifePartConfig lifePartConfig)
+    {
+        return toAjax(lifePartConfigService.updateLifePartConfig(lifePartConfig));
+    }
+
+    /**
+     * 删除寿命件配置库信息
+     */
+    @PreAuthorize("@ss.hasPermi('manage:lifePartConfig:remove')")
+    @Log(title = "寿命件配置库信息", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(lifePartConfigService.deleteLifePartConfigByIds(ids));
+    }
+}

+ 79 - 0
PHM-admin/phm-manage/src/main/java/com/phm/manage/domain/LifePartConfig.java

@@ -0,0 +1,79 @@
+package com.phm.manage.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.phm.common.annotation.Excel;
+import com.phm.common.core.domain.BaseEntity;
+
+/**
+ * 寿命件配置库信息对象 phm_life_part_config
+ * 
+ * @author phm
+ * @date 2023-08-23
+ */
+public class LifePartConfig extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 唯一ID */
+    private Long id;
+
+    /** 寿命件名称 */
+    @Excel(name = "寿命件名称")
+    private String name;
+
+    /** 寿命监视参数名称 */
+    @Excel(name = "寿命监视参数名称")
+    private String monitorName;
+
+    /** 单位 */
+    @Excel(name = "单位")
+    private String unit;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setName(String name) 
+    {
+        this.name = name;
+    }
+
+    public String getName() 
+    {
+        return name;
+    }
+    public void setMonitorName(String monitorName) 
+    {
+        this.monitorName = monitorName;
+    }
+
+    public String getMonitorName() 
+    {
+        return monitorName;
+    }
+    public void setUnit(String unit) 
+    {
+        this.unit = unit;
+    }
+
+    public String getUnit() 
+    {
+        return unit;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("name", getName())
+            .append("monitorName", getMonitorName())
+            .append("unit", getUnit())
+            .toString();
+    }
+}

+ 61 - 0
PHM-admin/phm-manage/src/main/java/com/phm/manage/mapper/LifePartConfigMapper.java

@@ -0,0 +1,61 @@
+package com.phm.manage.mapper;
+
+import java.util.List;
+import com.phm.manage.domain.LifePartConfig;
+
+/**
+ * 寿命件配置库信息Mapper接口
+ * 
+ * @author phm
+ * @date 2023-08-23
+ */
+public interface LifePartConfigMapper 
+{
+    /**
+     * 查询寿命件配置库信息
+     * 
+     * @param id 寿命件配置库信息主键
+     * @return 寿命件配置库信息
+     */
+    public LifePartConfig selectLifePartConfigById(Long id);
+
+    /**
+     * 查询寿命件配置库信息列表
+     * 
+     * @param lifePartConfig 寿命件配置库信息
+     * @return 寿命件配置库信息集合
+     */
+    public List<LifePartConfig> selectLifePartConfigList(LifePartConfig lifePartConfig);
+
+    /**
+     * 新增寿命件配置库信息
+     * 
+     * @param lifePartConfig 寿命件配置库信息
+     * @return 结果
+     */
+    public int insertLifePartConfig(LifePartConfig lifePartConfig);
+
+    /**
+     * 修改寿命件配置库信息
+     * 
+     * @param lifePartConfig 寿命件配置库信息
+     * @return 结果
+     */
+    public int updateLifePartConfig(LifePartConfig lifePartConfig);
+
+    /**
+     * 删除寿命件配置库信息
+     * 
+     * @param id 寿命件配置库信息主键
+     * @return 结果
+     */
+    public int deleteLifePartConfigById(Long id);
+
+    /**
+     * 批量删除寿命件配置库信息
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteLifePartConfigByIds(Long[] ids);
+}

+ 61 - 0
PHM-admin/phm-manage/src/main/java/com/phm/manage/service/ILifePartConfigService.java

@@ -0,0 +1,61 @@
+package com.phm.manage.service;
+
+import java.util.List;
+import com.phm.manage.domain.LifePartConfig;
+
+/**
+ * 寿命件配置库信息Service接口
+ * 
+ * @author phm
+ * @date 2023-08-23
+ */
+public interface ILifePartConfigService 
+{
+    /**
+     * 查询寿命件配置库信息
+     * 
+     * @param id 寿命件配置库信息主键
+     * @return 寿命件配置库信息
+     */
+    public LifePartConfig selectLifePartConfigById(Long id);
+
+    /**
+     * 查询寿命件配置库信息列表
+     * 
+     * @param lifePartConfig 寿命件配置库信息
+     * @return 寿命件配置库信息集合
+     */
+    public List<LifePartConfig> selectLifePartConfigList(LifePartConfig lifePartConfig);
+
+    /**
+     * 新增寿命件配置库信息
+     * 
+     * @param lifePartConfig 寿命件配置库信息
+     * @return 结果
+     */
+    public int insertLifePartConfig(LifePartConfig lifePartConfig);
+
+    /**
+     * 修改寿命件配置库信息
+     * 
+     * @param lifePartConfig 寿命件配置库信息
+     * @return 结果
+     */
+    public int updateLifePartConfig(LifePartConfig lifePartConfig);
+
+    /**
+     * 批量删除寿命件配置库信息
+     * 
+     * @param ids 需要删除的寿命件配置库信息主键集合
+     * @return 结果
+     */
+    public int deleteLifePartConfigByIds(Long[] ids);
+
+    /**
+     * 删除寿命件配置库信息信息
+     * 
+     * @param id 寿命件配置库信息主键
+     * @return 结果
+     */
+    public int deleteLifePartConfigById(Long id);
+}

+ 93 - 0
PHM-admin/phm-manage/src/main/java/com/phm/manage/service/impl/LifePartConfigServiceImpl.java

@@ -0,0 +1,93 @@
+package com.phm.manage.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.phm.manage.mapper.LifePartConfigMapper;
+import com.phm.manage.domain.LifePartConfig;
+import com.phm.manage.service.ILifePartConfigService;
+
+/**
+ * 寿命件配置库信息Service业务层处理
+ * 
+ * @author phm
+ * @date 2023-08-23
+ */
+@Service
+public class LifePartConfigServiceImpl implements ILifePartConfigService 
+{
+    @Autowired
+    private LifePartConfigMapper lifePartConfigMapper;
+
+    /**
+     * 查询寿命件配置库信息
+     * 
+     * @param id 寿命件配置库信息主键
+     * @return 寿命件配置库信息
+     */
+    @Override
+    public LifePartConfig selectLifePartConfigById(Long id)
+    {
+        return lifePartConfigMapper.selectLifePartConfigById(id);
+    }
+
+    /**
+     * 查询寿命件配置库信息列表
+     * 
+     * @param lifePartConfig 寿命件配置库信息
+     * @return 寿命件配置库信息
+     */
+    @Override
+    public List<LifePartConfig> selectLifePartConfigList(LifePartConfig lifePartConfig)
+    {
+        return lifePartConfigMapper.selectLifePartConfigList(lifePartConfig);
+    }
+
+    /**
+     * 新增寿命件配置库信息
+     * 
+     * @param lifePartConfig 寿命件配置库信息
+     * @return 结果
+     */
+    @Override
+    public int insertLifePartConfig(LifePartConfig lifePartConfig)
+    {
+        return lifePartConfigMapper.insertLifePartConfig(lifePartConfig);
+    }
+
+    /**
+     * 修改寿命件配置库信息
+     * 
+     * @param lifePartConfig 寿命件配置库信息
+     * @return 结果
+     */
+    @Override
+    public int updateLifePartConfig(LifePartConfig lifePartConfig)
+    {
+        return lifePartConfigMapper.updateLifePartConfig(lifePartConfig);
+    }
+
+    /**
+     * 批量删除寿命件配置库信息
+     * 
+     * @param ids 需要删除的寿命件配置库信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteLifePartConfigByIds(Long[] ids)
+    {
+        return lifePartConfigMapper.deleteLifePartConfigByIds(ids);
+    }
+
+    /**
+     * 删除寿命件配置库信息信息
+     * 
+     * @param id 寿命件配置库信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteLifePartConfigById(Long id)
+    {
+        return lifePartConfigMapper.deleteLifePartConfigById(id);
+    }
+}

+ 66 - 0
PHM-admin/phm-manage/src/main/resources/mapper/manage/LifePartConfigMapper.xml

@@ -0,0 +1,66 @@
+<?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.phm.manage.mapper.LifePartConfigMapper">
+    
+    <resultMap type="LifePartConfig" id="LifePartConfigResult">
+        <result property="id"    column="id"    />
+        <result property="name"    column="name"    />
+        <result property="monitorName"    column="monitor_name"    />
+        <result property="unit"    column="unit"    />
+    </resultMap>
+
+    <sql id="selectLifePartConfigVo">
+        select id, name, monitor_name, unit from phm_life_part_config
+    </sql>
+
+    <select id="selectLifePartConfigList" parameterType="LifePartConfig" resultMap="LifePartConfigResult">
+        <include refid="selectLifePartConfigVo"/>
+        <where>  
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+            <if test="monitorName != null  and monitorName != ''"> and monitor_name like concat('%', #{monitorName}, '%')</if>
+            <if test="unit != null  and unit != ''"> and unit = #{unit}</if>
+        </where>
+    </select>
+    
+    <select id="selectLifePartConfigById" parameterType="Long" resultMap="LifePartConfigResult">
+        <include refid="selectLifePartConfigVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertLifePartConfig" parameterType="LifePartConfig" useGeneratedKeys="true" keyProperty="id">
+        insert into phm_life_part_config
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="name != null">name,</if>
+            <if test="monitorName != null">monitor_name,</if>
+            <if test="unit != null">unit,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="name != null">#{name},</if>
+            <if test="monitorName != null">#{monitorName},</if>
+            <if test="unit != null">#{unit},</if>
+         </trim>
+    </insert>
+
+    <update id="updateLifePartConfig" parameterType="LifePartConfig">
+        update phm_life_part_config
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="name != null">name = #{name},</if>
+            <if test="monitorName != null">monitor_name = #{monitorName},</if>
+            <if test="unit != null">unit = #{unit},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteLifePartConfigById" parameterType="Long">
+        delete from phm_life_part_config where id = #{id}
+    </delete>
+
+    <delete id="deleteLifePartConfigByIds" parameterType="String">
+        delete from phm_life_part_config where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>