瀏覽代碼

能源管理代码生成

wukai 5 月之前
父節點
當前提交
93f6937959

+ 127 - 0
ruoyi-admin/src/main/java/com/ruoyi/biz/controller/TwinWorkshopController.java

@@ -0,0 +1,127 @@
+package com.ruoyi.biz.controller;
+
+import java.util.List;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.biz.domain.TwinWorkshop;
+import com.ruoyi.biz.service.ITwinWorkshopService;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 车间管理Controller
+ * 
+ * @author ruoyi
+ * @date 2024-12-23
+ */
+@Controller
+@RequestMapping("/biz/workshop")
+public class TwinWorkshopController extends BaseController
+{
+    private String prefix = "biz/workshop";
+
+    @Autowired
+    private ITwinWorkshopService twinWorkshopService;
+
+    @RequiresPermissions("biz:workshop:view")
+    @GetMapping()
+    public String workshop()
+    {
+        return prefix + "/workshop";
+    }
+
+    /**
+     * 查询车间管理列表
+     */
+    @RequiresPermissions("biz:workshop:list")
+    @PostMapping("/list")
+    @ResponseBody
+    public TableDataInfo list(TwinWorkshop twinWorkshop)
+    {
+        startPage();
+        List<TwinWorkshop> list = twinWorkshopService.selectTwinWorkshopList(twinWorkshop);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出车间管理列表
+     */
+    @RequiresPermissions("biz:workshop:export")
+    @Log(title = "车间管理", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    @ResponseBody
+    public AjaxResult export(TwinWorkshop twinWorkshop)
+    {
+        List<TwinWorkshop> list = twinWorkshopService.selectTwinWorkshopList(twinWorkshop);
+        ExcelUtil<TwinWorkshop> util = new ExcelUtil<TwinWorkshop>(TwinWorkshop.class);
+        return util.exportExcel(list, "车间管理数据");
+    }
+
+    /**
+     * 新增车间管理
+     */
+    @GetMapping("/add")
+    public String add()
+    {
+        return prefix + "/add";
+    }
+
+    /**
+     * 新增保存车间管理
+     */
+    @RequiresPermissions("biz:workshop:add")
+    @Log(title = "车间管理", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    @ResponseBody
+    public AjaxResult addSave(TwinWorkshop twinWorkshop)
+    {
+        return toAjax(twinWorkshopService.insertTwinWorkshop(twinWorkshop));
+    }
+
+    /**
+     * 修改车间管理
+     */
+    @RequiresPermissions("biz:workshop:edit")
+    @GetMapping("/edit/{wsId}")
+    public String edit(@PathVariable("wsId") Long wsId, ModelMap mmap)
+    {
+        TwinWorkshop twinWorkshop = twinWorkshopService.selectTwinWorkshopByWsId(wsId);
+        mmap.put("twinWorkshop", twinWorkshop);
+        return prefix + "/edit";
+    }
+
+    /**
+     * 修改保存车间管理
+     */
+    @RequiresPermissions("biz:workshop:edit")
+    @Log(title = "车间管理", businessType = BusinessType.UPDATE)
+    @PostMapping("/edit")
+    @ResponseBody
+    public AjaxResult editSave(TwinWorkshop twinWorkshop)
+    {
+        return toAjax(twinWorkshopService.updateTwinWorkshop(twinWorkshop));
+    }
+
+    /**
+     * 删除车间管理
+     */
+    @RequiresPermissions("biz:workshop:remove")
+    @Log(title = "车间管理", businessType = BusinessType.DELETE)
+    @PostMapping( "/remove")
+    @ResponseBody
+    public AjaxResult remove(String ids)
+    {
+        return toAjax(twinWorkshopService.deleteTwinWorkshopByWsIds(ids));
+    }
+}

+ 71 - 0
ruoyi-admin/src/main/java/com/ruoyi/biz/domain/TwinWorkshop.java

@@ -0,0 +1,71 @@
+package com.ruoyi.biz.domain;
+
+import java.util.List;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 车间管理对象 twin_workshop
+ *
+ * @author ruoyi
+ * @date 2024-12-23
+ */
+@ApiModel(value = "ITwinWorkshop", description = "车间管理")
+public class TwinWorkshop extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 车间ID */
+    private Long wsId;
+
+    /** 车间名称 */
+    @Excel(name = "车间名称")
+    @ApiModelProperty("车间名称")
+    private String wsName;
+
+    /** 车间能源管理信息 */
+    private List<TwinWorkshopEnergy> twinWorkshopEnergyList;
+
+    public void setWsId(Long wsId)
+    {
+        this.wsId = wsId;
+    }
+
+    public Long getWsId()
+    {
+        return wsId;
+    }
+    public void setWsName(String wsName)
+    {
+        this.wsName = wsName;
+    }
+
+    public String getWsName()
+    {
+        return wsName;
+    }
+
+    public List<TwinWorkshopEnergy> getTwinWorkshopEnergyList()
+    {
+        return twinWorkshopEnergyList;
+    }
+
+    public void setTwinWorkshopEnergyList(List<TwinWorkshopEnergy> twinWorkshopEnergyList)
+    {
+        this.twinWorkshopEnergyList = twinWorkshopEnergyList;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("wsId", getWsId())
+            .append("wsName", getWsName())
+            .append("remark", getRemark())
+            .append("twinWorkshopEnergyList", getTwinWorkshopEnergyList())
+            .toString();
+    }
+}

+ 108 - 0
ruoyi-admin/src/main/java/com/ruoyi/biz/domain/TwinWorkshopEnergy.java

@@ -0,0 +1,108 @@
+package com.ruoyi.biz.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;
+
+/**
+ * 车间能源管理对象 twin_workshop_energy
+ * 
+ * @author ruoyi
+ * @date 2024-12-23
+ */
+public class TwinWorkshopEnergy extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 能源ID */
+    private Long energyId;
+
+    /** 车间ID */
+    @Excel(name = "车间ID")
+    private Long wsId;
+
+    /** 能源设备名称 */
+    @Excel(name = "能源设备名称")
+    private String energyName;
+
+    /** 能源设备类型 */
+    @Excel(name = "能源设备类型")
+    private String energyType;
+
+    /** 能源设备路径 */
+    @Excel(name = "能源设备路径")
+    private String energyPath;
+
+    /** 字段编码 */
+    @Excel(name = "字段编码")
+    private String energyCode;
+
+    public void setEnergyId(Long energyId) 
+    {
+        this.energyId = energyId;
+    }
+
+    public Long getEnergyId() 
+    {
+        return energyId;
+    }
+    public void setWsId(Long wsId) 
+    {
+        this.wsId = wsId;
+    }
+
+    public Long getWsId() 
+    {
+        return wsId;
+    }
+    public void setEnergyName(String energyName) 
+    {
+        this.energyName = energyName;
+    }
+
+    public String getEnergyName() 
+    {
+        return energyName;
+    }
+    public void setEnergyType(String energyType) 
+    {
+        this.energyType = energyType;
+    }
+
+    public String getEnergyType() 
+    {
+        return energyType;
+    }
+    public void setEnergyPath(String energyPath) 
+    {
+        this.energyPath = energyPath;
+    }
+
+    public String getEnergyPath() 
+    {
+        return energyPath;
+    }
+    public void setEnergyCode(String energyCode) 
+    {
+        this.energyCode = energyCode;
+    }
+
+    public String getEnergyCode() 
+    {
+        return energyCode;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("energyId", getEnergyId())
+            .append("wsId", getWsId())
+            .append("energyName", getEnergyName())
+            .append("energyType", getEnergyType())
+            .append("energyPath", getEnergyPath())
+            .append("energyCode", getEnergyCode())
+            .append("remark", getRemark())
+            .toString();
+    }
+}

+ 87 - 0
ruoyi-admin/src/main/java/com/ruoyi/biz/mapper/TwinWorkshopMapper.java

@@ -0,0 +1,87 @@
+package com.ruoyi.biz.mapper;
+
+import java.util.List;
+import com.ruoyi.biz.domain.TwinWorkshop;
+import com.ruoyi.biz.domain.TwinWorkshopEnergy;
+
+/**
+ * 车间管理Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-12-23
+ */
+public interface TwinWorkshopMapper 
+{
+    /**
+     * 查询车间管理
+     * 
+     * @param wsId 车间管理主键
+     * @return 车间管理
+     */
+    public TwinWorkshop selectTwinWorkshopByWsId(Long wsId);
+
+    /**
+     * 查询车间管理列表
+     * 
+     * @param twinWorkshop 车间管理
+     * @return 车间管理集合
+     */
+    public List<TwinWorkshop> selectTwinWorkshopList(TwinWorkshop twinWorkshop);
+
+    /**
+     * 新增车间管理
+     * 
+     * @param twinWorkshop 车间管理
+     * @return 结果
+     */
+    public int insertTwinWorkshop(TwinWorkshop twinWorkshop);
+
+    /**
+     * 修改车间管理
+     * 
+     * @param twinWorkshop 车间管理
+     * @return 结果
+     */
+    public int updateTwinWorkshop(TwinWorkshop twinWorkshop);
+
+    /**
+     * 删除车间管理
+     * 
+     * @param wsId 车间管理主键
+     * @return 结果
+     */
+    public int deleteTwinWorkshopByWsId(Long wsId);
+
+    /**
+     * 批量删除车间管理
+     * 
+     * @param wsIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteTwinWorkshopByWsIds(String[] wsIds);
+
+    /**
+     * 批量删除车间能源管理
+     * 
+     * @param wsIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteTwinWorkshopEnergyByWsIds(String[] wsIds);
+    
+    /**
+     * 批量新增车间能源管理
+     * 
+     * @param twinWorkshopEnergyList 车间能源管理列表
+     * @return 结果
+     */
+    public int batchTwinWorkshopEnergy(List<TwinWorkshopEnergy> twinWorkshopEnergyList);
+    
+
+    /**
+     * 通过车间管理主键删除车间能源管理信息
+     * 
+     * @param wsId 车间管理ID
+     * @return 结果
+     */
+    public int deleteTwinWorkshopEnergyByWsId(Long wsId);
+}

+ 61 - 0
ruoyi-admin/src/main/java/com/ruoyi/biz/service/ITwinWorkshopService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.biz.service;
+
+import java.util.List;
+import com.ruoyi.biz.domain.TwinWorkshop;
+
+/**
+ * 车间管理Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-12-23
+ */
+public interface ITwinWorkshopService 
+{
+    /**
+     * 查询车间管理
+     * 
+     * @param wsId 车间管理主键
+     * @return 车间管理
+     */
+    public TwinWorkshop selectTwinWorkshopByWsId(Long wsId);
+
+    /**
+     * 查询车间管理列表
+     * 
+     * @param twinWorkshop 车间管理
+     * @return 车间管理集合
+     */
+    public List<TwinWorkshop> selectTwinWorkshopList(TwinWorkshop twinWorkshop);
+
+    /**
+     * 新增车间管理
+     * 
+     * @param twinWorkshop 车间管理
+     * @return 结果
+     */
+    public int insertTwinWorkshop(TwinWorkshop twinWorkshop);
+
+    /**
+     * 修改车间管理
+     * 
+     * @param twinWorkshop 车间管理
+     * @return 结果
+     */
+    public int updateTwinWorkshop(TwinWorkshop twinWorkshop);
+
+    /**
+     * 批量删除车间管理
+     * 
+     * @param wsIds 需要删除的车间管理主键集合
+     * @return 结果
+     */
+    public int deleteTwinWorkshopByWsIds(String wsIds);
+
+    /**
+     * 删除车间管理信息
+     * 
+     * @param wsId 车间管理主键
+     * @return 结果
+     */
+    public int deleteTwinWorkshopByWsId(Long wsId);
+}

+ 132 - 0
ruoyi-admin/src/main/java/com/ruoyi/biz/service/impl/TwinWorkshopServiceImpl.java

@@ -0,0 +1,132 @@
+package com.ruoyi.biz.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.ArrayList;
+import com.ruoyi.common.utils.StringUtils;
+import org.springframework.transaction.annotation.Transactional;
+import com.ruoyi.biz.domain.TwinWorkshopEnergy;
+import com.ruoyi.biz.mapper.TwinWorkshopMapper;
+import com.ruoyi.biz.domain.TwinWorkshop;
+import com.ruoyi.biz.service.ITwinWorkshopService;
+import com.ruoyi.common.core.text.Convert;
+
+/**
+ * 车间管理Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-12-23
+ */
+@Service
+public class TwinWorkshopServiceImpl implements ITwinWorkshopService 
+{
+    @Autowired
+    private TwinWorkshopMapper twinWorkshopMapper;
+
+    /**
+     * 查询车间管理
+     * 
+     * @param wsId 车间管理主键
+     * @return 车间管理
+     */
+    @Override
+    public TwinWorkshop selectTwinWorkshopByWsId(Long wsId)
+    {
+        return twinWorkshopMapper.selectTwinWorkshopByWsId(wsId);
+    }
+
+    /**
+     * 查询车间管理列表
+     * 
+     * @param twinWorkshop 车间管理
+     * @return 车间管理
+     */
+    @Override
+    public List<TwinWorkshop> selectTwinWorkshopList(TwinWorkshop twinWorkshop)
+    {
+        return twinWorkshopMapper.selectTwinWorkshopList(twinWorkshop);
+    }
+
+    /**
+     * 新增车间管理
+     * 
+     * @param twinWorkshop 车间管理
+     * @return 结果
+     */
+    @Transactional
+    @Override
+    public int insertTwinWorkshop(TwinWorkshop twinWorkshop)
+    {
+        int rows = twinWorkshopMapper.insertTwinWorkshop(twinWorkshop);
+        insertTwinWorkshopEnergy(twinWorkshop);
+        return rows;
+    }
+
+    /**
+     * 修改车间管理
+     * 
+     * @param twinWorkshop 车间管理
+     * @return 结果
+     */
+    @Transactional
+    @Override
+    public int updateTwinWorkshop(TwinWorkshop twinWorkshop)
+    {
+        twinWorkshopMapper.deleteTwinWorkshopEnergyByWsId(twinWorkshop.getWsId());
+        insertTwinWorkshopEnergy(twinWorkshop);
+        return twinWorkshopMapper.updateTwinWorkshop(twinWorkshop);
+    }
+
+    /**
+     * 批量删除车间管理
+     * 
+     * @param wsIds 需要删除的车间管理主键
+     * @return 结果
+     */
+    @Transactional
+    @Override
+    public int deleteTwinWorkshopByWsIds(String wsIds)
+    {
+        twinWorkshopMapper.deleteTwinWorkshopEnergyByWsIds(Convert.toStrArray(wsIds));
+        return twinWorkshopMapper.deleteTwinWorkshopByWsIds(Convert.toStrArray(wsIds));
+    }
+
+    /**
+     * 删除车间管理信息
+     * 
+     * @param wsId 车间管理主键
+     * @return 结果
+     */
+    @Transactional
+    @Override
+    public int deleteTwinWorkshopByWsId(Long wsId)
+    {
+        twinWorkshopMapper.deleteTwinWorkshopEnergyByWsId(wsId);
+        return twinWorkshopMapper.deleteTwinWorkshopByWsId(wsId);
+    }
+
+    /**
+     * 新增车间能源管理信息
+     * 
+     * @param twinWorkshop 车间管理对象
+     */
+    public void insertTwinWorkshopEnergy(TwinWorkshop twinWorkshop)
+    {
+        List<TwinWorkshopEnergy> twinWorkshopEnergyList = twinWorkshop.getTwinWorkshopEnergyList();
+        Long wsId = twinWorkshop.getWsId();
+        if (StringUtils.isNotNull(twinWorkshopEnergyList))
+        {
+            List<TwinWorkshopEnergy> list = new ArrayList<TwinWorkshopEnergy>();
+            for (TwinWorkshopEnergy twinWorkshopEnergy : twinWorkshopEnergyList)
+            {
+                twinWorkshopEnergy.setWsId(wsId);
+                list.add(twinWorkshopEnergy);
+            }
+            if (list.size() > 0)
+            {
+                twinWorkshopMapper.batchTwinWorkshopEnergy(list);
+            }
+        }
+    }
+}

+ 97 - 0
ruoyi-admin/src/main/resources/mapper/biz/TwinWorkshopMapper.xml

@@ -0,0 +1,97 @@
+<?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.biz.mapper.TwinWorkshopMapper">
+    
+    <resultMap type="TwinWorkshop" id="TwinWorkshopResult">
+        <result property="wsId"    column="WS_ID"    />
+        <result property="wsName"    column="WS_NAME"    />
+        <result property="remark"    column="REMARK"    />
+    </resultMap>
+
+    <resultMap id="TwinWorkshopTwinWorkshopEnergyResult" type="TwinWorkshop" extends="TwinWorkshopResult">
+        <collection property="twinWorkshopEnergyList" notNullColumn="sub_ENERGY_ID" javaType="java.util.List" resultMap="TwinWorkshopEnergyResult" />
+    </resultMap>
+
+    <resultMap type="TwinWorkshopEnergy" id="TwinWorkshopEnergyResult">
+        <result property="energyId"    column="sub_ENERGY_ID"    />
+        <result property="wsId"    column="sub_WS_ID"    />
+        <result property="energyName"    column="sub_ENERGY_NAME"    />
+        <result property="energyType"    column="sub_ENERGY_TYPE"    />
+        <result property="energyPath"    column="sub_ENERGY_PATH"    />
+        <result property="energyCode"    column="sub_ENERGY_CODE"    />
+        <result property="remark"    column="sub_REMARK"    />
+    </resultMap>
+
+    <sql id="selectTwinWorkshopVo">
+        select WS_ID, WS_NAME, REMARK from twin_workshop
+    </sql>
+
+    <select id="selectTwinWorkshopList" parameterType="TwinWorkshop" resultMap="TwinWorkshopResult">
+        <include refid="selectTwinWorkshopVo"/>
+        <where>  
+            <if test="wsName != null  and wsName != ''"> and WS_NAME like concat('%', #{wsName}, '%')</if>
+            <if test="remark != null  and remark != ''"> and REMARK = #{remark}</if>
+        </where>
+    </select>
+    
+    <select id="selectTwinWorkshopByWsId" parameterType="Long" resultMap="TwinWorkshopTwinWorkshopEnergyResult">
+        select a.WS_ID, a.WS_NAME, a.REMARK,
+ b.ENERGY_ID as sub_ENERGY_ID, b.WS_ID as sub_WS_ID, b.ENERGY_NAME as sub_ENERGY_NAME, b.ENERGY_TYPE as sub_ENERGY_TYPE, b.ENERGY_PATH as sub_ENERGY_PATH, b.ENERGY_CODE as sub_ENERGY_CODE, b.REMARK as sub_REMARK
+        from twin_workshop a
+        left join twin_workshop_energy b on b.WS_ID = a.WS_ID
+        where a.WS_ID = #{wsId}
+    </select>
+        
+    <insert id="insertTwinWorkshop" parameterType="TwinWorkshop" useGeneratedKeys="true" keyProperty="wsId">
+        insert into twin_workshop
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="wsName != null">WS_NAME,</if>
+            <if test="remark != null">REMARK,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="wsName != null">#{wsName},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTwinWorkshop" parameterType="TwinWorkshop">
+        update twin_workshop
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="wsName != null">WS_NAME = #{wsName},</if>
+            <if test="remark != null">REMARK = #{remark},</if>
+        </trim>
+        where WS_ID = #{wsId}
+    </update>
+
+    <delete id="deleteTwinWorkshopByWsId" parameterType="Long">
+        delete from twin_workshop where WS_ID = #{wsId}
+    </delete>
+
+    <delete id="deleteTwinWorkshopByWsIds" parameterType="String">
+        delete from twin_workshop where WS_ID in 
+        <foreach item="wsId" collection="array" open="(" separator="," close=")">
+            #{wsId}
+        </foreach>
+    </delete>
+    
+    <delete id="deleteTwinWorkshopEnergyByWsIds" parameterType="String">
+        delete from twin_workshop_energy where WS_ID in 
+        <foreach item="wsId" collection="array" open="(" separator="," close=")">
+            #{wsId}
+        </foreach>
+    </delete>
+
+    <delete id="deleteTwinWorkshopEnergyByWsId" parameterType="Long">
+        delete from twin_workshop_energy where WS_ID = #{wsId}
+    </delete>
+
+    <insert id="batchTwinWorkshopEnergy">
+        insert into twin_workshop_energy( ENERGY_ID, WS_ID, ENERGY_NAME, ENERGY_TYPE, ENERGY_PATH, ENERGY_CODE, REMARK) values
+		<foreach item="item" index="index" collection="list" separator=",">
+            ( #{item.energyId}, #{item.wsId}, #{item.energyName}, #{item.energyType}, #{item.energyPath}, #{item.energyCode}, #{item.remark})
+        </foreach>
+    </insert>
+
+</mapper>

+ 132 - 0
ruoyi-admin/src/main/resources/templates/biz/workshop/add.html

@@ -0,0 +1,132 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<head>
+    <th:block th:include="include :: header('新增车间管理')" />
+</head>
+<body class="white-bg">
+    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
+        <form class="form-horizontal m" id="form-workshop-add">
+            <h4 class="form-header h4">车间管理信息</h4>
+            <div class="form-group">
+                <label class="col-sm-3 control-label">车间名称:</label>
+                <div class="col-sm-8">
+                    <input name="wsName" class="form-control" type="text">
+                </div>
+            </div>
+            <div class="form-group">
+                <label class="col-sm-3 control-label">备注:</label>
+                <div class="col-sm-8">
+                    <textarea name="remark" class="form-control"></textarea>
+                </div>
+            </div>
+            <h4 class="form-header h4">车间能源管理信息</h4>
+            <div class="row">
+                <div class="col-sm-12">
+                    <button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>
+                    <button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>
+                    <div class="col-sm-12 select-table table-striped">
+                        <table id="bootstrap-table"></table>
+                    </div>
+                </div>
+            </div>
+        </form>
+    </div>
+    <th:block th:include="include :: footer" />
+    <script th:inline="javascript">
+        var prefix = ctx + "biz/workshop"
+        var energyTypeDatas = [[${@dict.getType('energy_type')}]];
+        $("#form-workshop-add").validate({
+            focusCleanup: true
+        });
+
+        function submitHandler() {
+            if ($.validate.form()) {
+                $.operate.save(prefix + "/add", $('#form-workshop-add').serialize());
+            }
+        }
+
+        $(function() {
+            var options = {
+                pagination: false,
+                showSearch: false,
+                showRefresh: false,
+                showToggle: false,
+                showColumns: false,
+                sidePagination: "client",
+                columns: [{
+                    checkbox: true
+                },
+                {
+                    field: 'index',
+                    align: 'center',
+                    title: "序号",
+                    formatter: function (value, row, index) {
+                    	var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
+                    	return columnIndex + $.table.serialNumber(index);
+                    }
+                },
+                {
+                    field: 'energyName',
+                    align: 'center',
+                    title: '能源设备名称',
+                    formatter: function(value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='twinWorkshopEnergyList[%s].energyName' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    field: 'energyType',
+                    align: 'center',
+                    title: '能源设备类型',
+                    width: 60,
+                    formatter: function(value, row, index) {
+                        var name = $.common.sprintf("twinWorkshopEnergyList[%s].energyType", index);
+                        return $.common.dictToSelect(energyTypeDatas, value, name);
+                    }
+                },
+                {
+                    field: 'energyPath',
+                    align: 'center',
+                    title: '能源设备路径',
+                    width: 600,
+                    formatter: function(value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='twinWorkshopEnergyList[%s].energyPath' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    field: 'energyCode',
+                    align: 'center',
+                    title: '字段编码',
+                    formatter: function(value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='twinWorkshopEnergyList[%s].energyCode' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    title: '操作',
+                    align: 'center',
+                    formatter: function(value, row, index) {
+                        var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
+                        return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
+                    }
+                }]
+            };
+            $.table.init(options);
+        });
+
+        function addRow() {
+            var count = $("#" + table.options.id).bootstrapTable('getData').length;
+            var row = {
+                index: $.table.serialNumber(count),
+                energyName: "",
+                energyType: "",
+                energyPath: "",
+                energyCode: "",
+                remark: "",
+            }
+            sub.addRow(row);
+        }
+    </script>
+</body>
+</html>

+ 135 - 0
ruoyi-admin/src/main/resources/templates/biz/workshop/edit.html

@@ -0,0 +1,135 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<head>
+    <th:block th:include="include :: header('修改车间管理')" />
+</head>
+<body class="white-bg">
+    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
+        <form class="form-horizontal m" id="form-workshop-edit" th:object="${twinWorkshop}">
+            <h4 class="form-header h4">车间管理信息</h4>
+            <input name="wsId" th:field="*{wsId}" type="hidden">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">车间名称:</label>
+                <div class="col-sm-8">
+                    <input name="wsName" th:field="*{wsName}" class="form-control" type="text">
+                </div>
+            </div>
+            <div class="form-group">
+                <label class="col-sm-3 control-label">备注:</label>
+                <div class="col-sm-8">
+                    <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
+                </div>
+            </div>
+            <h4 class="form-header h4">车间能源管理信息</h4>
+            <div class="row">
+                <div class="col-sm-12">
+                    <button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>
+                    <button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>
+                    <div class="col-sm-12 select-table table-striped">
+                        <table id="bootstrap-table"></table>
+                    </div>
+                </div>
+            </div>
+        </form>
+    </div>
+    <th:block th:include="include :: footer" />
+    <script th:inline="javascript">
+        var prefix = ctx + "biz/workshop";
+        var energyTypeDatas = [[${@dict.getType('energy_type')}]];
+        $("#form-workshop-edit").validate({
+            focusCleanup: true
+        });
+
+        function submitHandler() {
+            if ($.validate.form()) {
+                $.operate.save(prefix + "/edit", $('#form-workshop-edit').serialize());
+            }
+        }
+
+        $(function() {
+            var options = {
+                data: [[${twinWorkshop.twinWorkshopEnergyList}]],
+                pagination: false,
+                showSearch: false,
+                showRefresh: false,
+                showToggle: false,
+                showColumns: false,
+                sidePagination: "client",
+                columns: [{
+                    checkbox: true
+                },
+                {
+                    field: 'index',
+                    align: 'center',
+                    title: "序号",
+                    formatter: function (value, row, index) {
+                    	var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
+                    	return columnIndex + $.table.serialNumber(index);
+                    }
+                },
+                {
+                    field: 'energyName',
+                    align: 'center',
+                    title: '能源设备名称',
+                    formatter: function(value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='twinWorkshopEnergyList[%s].energyName' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+
+                {
+                    field: 'energyType',
+                    align: 'center',
+                    title: '能源设备类型',
+                    width: 60,
+                    formatter: function(value, row, index) {
+                        var name = $.common.sprintf("twinWorkshopEnergyList[%s].energyType", index);
+                        return $.common.dictToSelect(energyTypeDatas, value, name);
+                    }
+                },
+                {
+                    field: 'energyPath',
+                    align: 'center',
+                    title: '能源设备路径',
+                    width: 600,
+                    formatter: function(value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='twinWorkshopEnergyList[%s].energyPath' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    field: 'energyCode',
+                    align: 'center',
+                    title: '字段编码',
+                    formatter: function(value, row, index) {
+                        var html = $.common.sprintf("<input class='form-control' type='text' name='twinWorkshopEnergyList[%s].energyCode' value='%s'>", index, value);
+                        return html;
+                    }
+                },
+                {
+                    title: '操作',
+                    align: 'center',
+                    formatter: function(value, row, index) {
+                        var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
+                        return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
+                    }
+                }]
+            };
+            $.table.init(options);
+        });
+
+        function addRow() {
+            var count = $("#" + table.options.id).bootstrapTable('getData').length;
+            var row = {
+                index: $.table.serialNumber(count),
+                energyName: "",
+                energyType: "",
+                energyPath: "",
+                energyCode: "",
+                remark: "",
+            }
+            sub.addRow(row);
+        }
+    </script>
+</body>
+</html>

+ 90 - 0
ruoyi-admin/src/main/resources/templates/biz/workshop/workshop.html

@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<head>
+    <th:block th:include="include :: header('车间管理列表')" />
+</head>
+<body class="gray-bg">
+     <div class="container-div">
+        <div class="row">
+            <div class="col-sm-12 search-collapse">
+                <form id="formId">
+                    <div class="select-list">
+                        <ul>
+                            <li>
+                                <label>车间名称:</label>
+                                <input type="text" name="wsName"/>
+                            </li>
+                            <li>
+                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
+                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
+                            </li>
+                        </ul>
+                    </div>
+                </form>
+            </div>
+
+            <div class="btn-group-sm" id="toolbar" role="group">
+                <a class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="biz:workshop:add">
+                    <i class="fa fa-plus"></i> 添加
+                </a>
+                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="biz:workshop:edit">
+                    <i class="fa fa-edit"></i> 修改
+                </a>
+                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="biz:workshop:remove">
+                    <i class="fa fa-remove"></i> 删除
+                </a>
+                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="biz:workshop:export">
+                    <i class="fa fa-download"></i> 导出
+                </a>
+            </div>
+            <div class="col-sm-12 select-table table-striped">
+                <table id="bootstrap-table"></table>
+            </div>
+        </div>
+    </div>
+    <th:block th:include="include :: footer" />
+    <script th:inline="javascript">
+        var editFlag = [[${@permission.hasPermi('biz:workshop:edit')}]];
+        var removeFlag = [[${@permission.hasPermi('biz:workshop:remove')}]];
+        var prefix = ctx + "biz/workshop";
+
+        $(function() {
+            var options = {
+                url: prefix + "/list",
+                createUrl: prefix + "/add",
+                updateUrl: prefix + "/edit/{id}",
+                removeUrl: prefix + "/remove",
+                exportUrl: prefix + "/export",
+                modalName: "车间管理",
+                columns: [{
+                    checkbox: true
+                },
+                {
+                    field: 'wsId',
+                    title: '车间ID',
+                    visible: false
+                },
+                {
+                    field: 'wsName',
+                    title: '车间名称'
+                },
+                {
+                    field: 'remark',
+                    title: '备注'
+                },
+                {
+                    title: '操作',
+                    align: 'center',
+                    formatter: function(value, row, index) {
+                        var actions = [];
+                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.wsId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
+                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.wsId + '\')"><i class="fa fa-remove"></i>删除</a>');
+                        return actions.join('');
+                    }
+                }]
+            };
+            $.table.init(options);
+        });
+    </script>
+</body>
+</html>