Jelajahi Sumber

创建 table sim_sim 相关。

tom 5 bulan lalu
induk
melakukan
e2af5cd8dd

+ 98 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/SimController.java

@@ -0,0 +1,98 @@
+package com.ruoyi.sim.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.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.sim.domain.Sim;
+import com.ruoyi.sim.service.ISimService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 模拟器Controller
+ *
+ * @author tom
+ * @date 2024-12-11
+ */
+@RestController
+@RequestMapping("/sim/sim")
+public class SimController extends BaseController {
+    @Autowired
+    private ISimService simService;
+
+    /**
+     * 查询模拟器列表
+     */
+    @PreAuthorize("@ss.hasPermi('sim:sim:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(Sim sim) {
+        startPage();
+        List<Sim> list = simService.selectSimList(sim);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出模拟器列表
+     */
+    @PreAuthorize("@ss.hasPermi('sim:sim:export')")
+    @Log(title = "模拟器", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, Sim sim) {
+        List<Sim> list = simService.selectSimList(sim);
+        ExcelUtil<Sim> util = new ExcelUtil<Sim>(Sim.class);
+        util.exportExcel(response, list, "模拟器数据");
+    }
+
+    /**
+     * 获取模拟器详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('sim:sim:query')")
+    @GetMapping(value = "/{simId}")
+    public AjaxResult getInfo(@PathVariable("simId") Long simId) {
+        return success(simService.selectSimBySimId(simId));
+    }
+
+    /**
+     * 新增模拟器
+     */
+    @PreAuthorize("@ss.hasPermi('sim:sim:add')")
+    @Log(title = "模拟器", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody Sim sim) {
+        return toAjax(simService.insertSim(sim));
+    }
+
+    /**
+     * 修改模拟器
+     */
+    @PreAuthorize("@ss.hasPermi('sim:sim:edit')")
+    @Log(title = "模拟器", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody Sim sim) {
+        return toAjax(simService.updateSim(sim));
+    }
+
+    /**
+     * 删除模拟器
+     */
+    @PreAuthorize("@ss.hasPermi('sim:sim:remove')")
+    @Log(title = "模拟器", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{simIds}")
+    public AjaxResult remove(@PathVariable Long[] simIds) {
+        return toAjax(simService.deleteSimBySimIds(simIds));
+    }
+}

+ 101 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/domain/Sim.java

@@ -0,0 +1,101 @@
+package com.ruoyi.sim.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;
+
+/**
+ * 模拟器对象 sim_sim
+ *
+ * @author tom
+ * @date 2024-12-11
+ */
+public class Sim extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 模拟器ID
+     */
+    private Long simId;
+
+    /**
+     * 座ID
+     */
+    @Excel(name = "座ID")
+    private Long seatId;
+
+    /**
+     * 模拟器类型
+     */
+    @Excel(name = "模拟器类型")
+    private String simType;
+
+    /**
+     * 模拟器在线 1:在线 2:离线 3:硬件故障异常
+     */
+    @Excel(name = "模拟器在线 1:在线 2:离线 3:硬件故障异常")
+    private String state;
+
+    /**
+     * 模拟器序列号
+     */
+    @Excel(name = "模拟器序列号")
+    private String simSn;
+
+    public void setSimId(Long simId) {
+        this.simId = simId;
+    }
+
+    public Long getSimId() {
+        return simId;
+    }
+
+    public void setSeatId(Long seatId) {
+        this.seatId = seatId;
+    }
+
+    public Long getSeatId() {
+        return seatId;
+    }
+
+    public void setSimType(String simType) {
+        this.simType = simType;
+    }
+
+    public String getSimType() {
+        return simType;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setSimSn(String simSn) {
+        this.simSn = simSn;
+    }
+
+    public String getSimSn() {
+        return simSn;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("simId", getSimId())
+                .append("seatId", getSeatId())
+                .append("simType", getSimType())
+                .append("state", getState())
+                .append("simSn", getSimSn())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .append("remark", getRemark())
+                .toString();
+    }
+}

+ 61 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/mapper/SimMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.sim.mapper;
+
+import java.util.List;
+
+import com.ruoyi.sim.domain.Sim;
+
+/**
+ * 模拟器Mapper接口
+ *
+ * @author tom
+ * @date 2024-12-11
+ */
+public interface SimMapper {
+    /**
+     * 查询模拟器
+     *
+     * @param simId 模拟器主键
+     * @return 模拟器
+     */
+    public Sim selectSimBySimId(Long simId);
+
+    /**
+     * 查询模拟器列表
+     *
+     * @param sim 模拟器
+     * @return 模拟器集合
+     */
+    public List<Sim> selectSimList(Sim sim);
+
+    /**
+     * 新增模拟器
+     *
+     * @param sim 模拟器
+     * @return 结果
+     */
+    public int insertSim(Sim sim);
+
+    /**
+     * 修改模拟器
+     *
+     * @param sim 模拟器
+     * @return 结果
+     */
+    public int updateSim(Sim sim);
+
+    /**
+     * 删除模拟器
+     *
+     * @param simId 模拟器主键
+     * @return 结果
+     */
+    public int deleteSimBySimId(Long simId);
+
+    /**
+     * 批量删除模拟器
+     *
+     * @param simIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteSimBySimIds(Long[] simIds);
+}

+ 61 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/ISimService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.sim.service;
+
+import java.util.List;
+
+import com.ruoyi.sim.domain.Sim;
+
+/**
+ * 模拟器Service接口
+ *
+ * @author tom
+ * @date 2024-12-11
+ */
+public interface ISimService {
+    /**
+     * 查询模拟器
+     *
+     * @param simId 模拟器主键
+     * @return 模拟器
+     */
+    public Sim selectSimBySimId(Long simId);
+
+    /**
+     * 查询模拟器列表
+     *
+     * @param sim 模拟器
+     * @return 模拟器集合
+     */
+    public List<Sim> selectSimList(Sim sim);
+
+    /**
+     * 新增模拟器
+     *
+     * @param sim 模拟器
+     * @return 结果
+     */
+    public int insertSim(Sim sim);
+
+    /**
+     * 修改模拟器
+     *
+     * @param sim 模拟器
+     * @return 结果
+     */
+    public int updateSim(Sim sim);
+
+    /**
+     * 批量删除模拟器
+     *
+     * @param simIds 需要删除的模拟器主键集合
+     * @return 结果
+     */
+    public int deleteSimBySimIds(Long[] simIds);
+
+    /**
+     * 删除模拟器信息
+     *
+     * @param simId 模拟器主键
+     * @return 结果
+     */
+    public int deleteSimBySimId(Long simId);
+}

+ 90 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/SimServiceImpl.java

@@ -0,0 +1,90 @@
+package com.ruoyi.sim.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.sim.mapper.SimMapper;
+import com.ruoyi.sim.domain.Sim;
+import com.ruoyi.sim.service.ISimService;
+
+/**
+ * 模拟器Service业务层处理
+ *
+ * @author tom
+ * @date 2024-12-11
+ */
+@Service
+public class SimServiceImpl implements ISimService {
+    @Autowired
+    private SimMapper simMapper;
+
+    /**
+     * 查询模拟器
+     *
+     * @param simId 模拟器主键
+     * @return 模拟器
+     */
+    @Override
+    public Sim selectSimBySimId(Long simId) {
+        return simMapper.selectSimBySimId(simId);
+    }
+
+    /**
+     * 查询模拟器列表
+     *
+     * @param sim 模拟器
+     * @return 模拟器
+     */
+    @Override
+    public List<Sim> selectSimList(Sim sim) {
+        return simMapper.selectSimList(sim);
+    }
+
+    /**
+     * 新增模拟器
+     *
+     * @param sim 模拟器
+     * @return 结果
+     */
+    @Override
+    public int insertSim(Sim sim) {
+        sim.setCreateTime(DateUtils.getNowDate());
+        return simMapper.insertSim(sim);
+    }
+
+    /**
+     * 修改模拟器
+     *
+     * @param sim 模拟器
+     * @return 结果
+     */
+    @Override
+    public int updateSim(Sim sim) {
+        sim.setUpdateTime(DateUtils.getNowDate());
+        return simMapper.updateSim(sim);
+    }
+
+    /**
+     * 批量删除模拟器
+     *
+     * @param simIds 需要删除的模拟器主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSimBySimIds(Long[] simIds) {
+        return simMapper.deleteSimBySimIds(simIds);
+    }
+
+    /**
+     * 删除模拟器信息
+     *
+     * @param simId 模拟器主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSimBySimId(Long simId) {
+        return simMapper.deleteSimBySimId(simId);
+    }
+}

+ 103 - 0
ruoyi-sim/src/main/resources/mapper/sim/SimMapper.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.ruoyi.sim.mapper.SimMapper">
+
+    <resultMap type="Sim" id="SimResult">
+        <result property="simId" column="sim_id"/>
+        <result property="seatId" column="seat_id"/>
+        <result property="simType" column="sim_type"/>
+        <result property="state" column="state"/>
+        <result property="simSn" column="sim_sn"/>
+        <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="selectSimVo">
+        select sim_id,
+               seat_id,
+               sim_type,
+               state,
+               sim_sn,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               remark
+        from sim_sim
+    </sql>
+
+    <select id="selectSimList" parameterType="Sim" resultMap="SimResult">
+        <include refid="selectSimVo"/>
+        <where>
+            <if test="seatId != null ">and seat_id = #{seatId}</if>
+            <if test="simType != null  and simType != ''">and sim_type = #{simType}</if>
+            <if test="state != null  and state != ''">and state = #{state}</if>
+            <if test="simSn != null  and simSn != ''">and sim_sn = #{simSn}</if>
+        </where>
+    </select>
+
+    <select id="selectSimBySimId" parameterType="Long" resultMap="SimResult">
+        <include refid="selectSimVo"/>
+        where sim_id = #{simId}
+    </select>
+
+    <insert id="insertSim" parameterType="Sim" useGeneratedKeys="true" keyProperty="simId">
+        insert into sim_sim
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="seatId != null">seat_id,</if>
+            <if test="simType != null and simType != ''">sim_type,</if>
+            <if test="state != null and state != ''">state,</if>
+            <if test="simSn != null and simSn != ''">sim_sn,</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="seatId != null">#{seatId},</if>
+            <if test="simType != null and simType != ''">#{simType},</if>
+            <if test="state != null and state != ''">#{state},</if>
+            <if test="simSn != null and simSn != ''">#{simSn},</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="updateSim" parameterType="Sim">
+        update sim_sim
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="seatId != null">seat_id = #{seatId},</if>
+            <if test="simType != null and simType != ''">sim_type = #{simType},</if>
+            <if test="state != null and state != ''">state = #{state},</if>
+            <if test="simSn != null and simSn != ''">sim_sn = #{simSn},</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 sim_id = #{simId}
+    </update>
+
+    <delete id="deleteSimBySimId" parameterType="Long">
+        delete
+        from sim_sim
+        where sim_id = #{simId}
+    </delete>
+
+    <delete id="deleteSimBySimIds" parameterType="String">
+        delete from sim_sim where sim_id in
+        <foreach item="simId" collection="array" open="(" separator="," close=")">
+            #{simId}
+        </foreach>
+    </delete>
+</mapper>