ly 3 lat temu
rodzic
commit
3245e29b0f

+ 4 - 1
master/src/main/java/com/ruoyi/project/ticket/controller/THazardWorkPermitController.java

@@ -36,7 +36,8 @@ public class THazardWorkPermitController extends BaseController {
 
     @Autowired
     private ITPermitRelationService itPermitRelationService;
-
+    @Autowired
+    private TTicketIdController tTicketIdController;
     /**
      * 查询危害工作许可证列表
      */
@@ -107,6 +108,8 @@ public class THazardWorkPermitController extends BaseController {
     @Log(title = "危害工作许可证", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody THazardWorkPermit tHazardWorkPermit) {
+        Long ticketId =  tTicketIdController.createId();
+        tHazardWorkPermit.setaId(ticketId);
         tHazardWorkPermitService.insertTHazardWorkPermit(tHazardWorkPermit);
         //保存危害工作许可证关联数据
         PermitRelation permitRelation = new PermitRelation();

+ 107 - 0
master/src/main/java/com/ruoyi/project/ticket/controller/TTicketIdController.java

@@ -0,0 +1,107 @@
+package com.ruoyi.project.ticket.controller;
+
+import java.util.List;
+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.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.project.ticket.domain.TTicketId;
+import com.ruoyi.project.ticket.service.ITTicketIdService;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.web.page.TableDataInfo;
+
+/**
+ * 作业票编号Controller
+ *
+ * @author ruoyi
+ * @date 2022-01-10
+ */
+@RestController
+@RequestMapping("/ticket/id")
+public class TTicketIdController extends BaseController
+{
+    @Autowired
+    private ITTicketIdService tTicketIdService;
+
+    //添加票据id
+    public synchronized Long createId(){
+        TTicketId t = tTicketIdService.selectTTicketIdById(1l);
+        Long id = t.getTicketId();
+        Long newId = id +1;
+        t.setTicketId(newId);
+        tTicketIdService.updateTTicketId(t);
+        return newId;
+    };
+
+    /**
+     * 查询作业票编号列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(TTicketId tTicketId)
+    {
+        startPage();
+        List<TTicketId> list = tTicketIdService.selectTTicketIdList(tTicketId);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出作业票编号列表
+     */
+    @Log(title = "作业票编号", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(TTicketId tTicketId)
+    {
+        List<TTicketId> list = tTicketIdService.selectTTicketIdList(tTicketId);
+        ExcelUtil<TTicketId> util = new ExcelUtil<TTicketId>(TTicketId.class);
+        return util.exportExcel(list, "id");
+    }
+
+    /**
+     * 获取作业票编号详细信息
+     */
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(tTicketIdService.selectTTicketIdById(id));
+    }
+
+    /**
+     * 新增作业票编号
+     */
+    @Log(title = "作业票编号", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TTicketId tTicketId)
+    {
+        return toAjax(tTicketIdService.insertTTicketId(tTicketId));
+    }
+
+    /**
+     * 修改作业票编号
+     */
+    @Log(title = "作业票编号", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TTicketId tTicketId)
+    {
+        return toAjax(tTicketIdService.updateTTicketId(tTicketId));
+    }
+
+    /**
+     * 删除作业票编号
+     */
+    @Log(title = "作业票编号", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(tTicketIdService.deleteTTicketIdByIds(ids));
+    }
+}

+ 194 - 0
master/src/main/java/com/ruoyi/project/ticket/domain/TTicketId.java

@@ -0,0 +1,194 @@
+package com.ruoyi.project.ticket.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import com.ruoyi.framework.web.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 作业票编号对象 t_ticket_id
+ *
+ * @author ruoyi
+ * @date 2022-01-10
+ */
+public class TTicketId extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** ID */
+    private Long id;
+
+    /** 工作票id */
+    @Excel(name = "工作票id")
+    private Long ticketId;
+
+    /** 部门id */
+    @Excel(name = "部门id")
+    private Long deptId;
+
+    /** 装置 */
+    @Excel(name = "装置")
+    private String plantCode;
+
+    /** 工作票类型 */
+    @Excel(name = "工作票类型")
+    private String ticketType;
+
+    /** 完整票号 */
+    @Excel(name = "完整票号")
+    private String ticketFull;
+
+    /** $column.columnComment */
+    private Long delFlag;
+
+    /** $column.columnComment */
+    @Excel(name = "完整票号")
+    private String createrCode;
+
+    /** $column.columnComment */
+    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
+    @Excel(name = "完整票号", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date createdate;
+
+    /** $column.columnComment */
+    @Excel(name = "完整票号")
+    private String updaterCode;
+
+    /** $column.columnComment */
+    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
+    @Excel(name = "完整票号", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date updatedate;
+
+    /** $column.columnComment */
+    @Excel(name = "完整票号")
+    private String remarks;
+
+    public void setId(Long id)
+    {
+        this.id = id;
+    }
+
+    public Long getId()
+    {
+        return id;
+    }
+    public void setTicketId(Long ticketId)
+    {
+        this.ticketId = ticketId;
+    }
+
+    public Long getTicketId()
+    {
+        return ticketId;
+    }
+    public void setDeptId(Long deptId)
+    {
+        this.deptId = deptId;
+    }
+
+    public Long getDeptId()
+    {
+        return deptId;
+    }
+    public void setPlantCode(String plantCode)
+    {
+        this.plantCode = plantCode;
+    }
+
+    public String getPlantCode()
+    {
+        return plantCode;
+    }
+
+    public String getTicketType() {
+        return ticketType;
+    }
+
+    public void setTicketType(String ticketType) {
+        this.ticketType = ticketType;
+    }
+
+    public void setTicketFull(String ticketFull)
+    {
+        this.ticketFull = ticketFull;
+    }
+
+    public String getTicketFull()
+    {
+        return ticketFull;
+    }
+    public void setDelFlag(Long delFlag)
+    {
+        this.delFlag = delFlag;
+    }
+
+    public Long getDelFlag()
+    {
+        return delFlag;
+    }
+    public void setCreaterCode(String createrCode)
+    {
+        this.createrCode = createrCode;
+    }
+
+    public String getCreaterCode()
+    {
+        return createrCode;
+    }
+    public void setCreatedate(Date createdate)
+    {
+        this.createdate = createdate;
+    }
+
+    public Date getCreatedate()
+    {
+        return createdate;
+    }
+    public void setUpdaterCode(String updaterCode)
+    {
+        this.updaterCode = updaterCode;
+    }
+
+    public String getUpdaterCode()
+    {
+        return updaterCode;
+    }
+    public void setUpdatedate(Date updatedate)
+    {
+        this.updatedate = updatedate;
+    }
+
+    public Date getUpdatedate()
+    {
+        return updatedate;
+    }
+    public void setRemarks(String remarks)
+    {
+        this.remarks = remarks;
+    }
+
+    public String getRemarks()
+    {
+        return remarks;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("ticketId", getTicketId())
+            .append("deptId", getDeptId())
+            .append("plantCode", getPlantCode())
+            .append("ticketType", getTicketType())
+            .append("ticketFull", getTicketFull())
+            .append("delFlag", getDelFlag())
+            .append("createrCode", getCreaterCode())
+            .append("createdate", getCreatedate())
+            .append("updaterCode", getUpdaterCode())
+            .append("updatedate", getUpdatedate())
+            .append("remarks", getRemarks())
+            .toString();
+    }
+}

+ 63 - 0
master/src/main/java/com/ruoyi/project/ticket/mapper/TTicketIdMapper.java

@@ -0,0 +1,63 @@
+package com.ruoyi.project.ticket.mapper;
+
+import java.util.List;
+import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
+import com.ruoyi.project.ticket.domain.TTicketId;
+
+/**
+ * 作业票编号Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2022-01-10
+ */
+public interface TTicketIdMapper 
+{
+    /**
+     * 查询作业票编号
+     * 
+     * @param id 作业票编号ID
+     * @return 作业票编号
+     */
+    public TTicketId selectTTicketIdById(Long id);
+
+    /**
+     * 查询作业票编号列表
+     * 
+     * @param tTicketId 作业票编号
+     * @return 作业票编号集合
+     */
+    @DataScope(deptAlias = "d")
+    public List<TTicketId> selectTTicketIdList(TTicketId tTicketId);
+
+    /**
+     * 新增作业票编号
+     * 
+     * @param tTicketId 作业票编号
+     * @return 结果
+     */
+    public int insertTTicketId(TTicketId tTicketId);
+
+    /**
+     * 修改作业票编号
+     * 
+     * @param tTicketId 作业票编号
+     * @return 结果
+     */
+    public int updateTTicketId(TTicketId tTicketId);
+
+    /**
+     * 删除作业票编号
+     * 
+     * @param id 作业票编号ID
+     * @return 结果
+     */
+    public int deleteTTicketIdById(Long id);
+
+    /**
+     * 批量删除作业票编号
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteTTicketIdByIds(Long[] ids);
+}

+ 61 - 0
master/src/main/java/com/ruoyi/project/ticket/service/ITTicketIdService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.project.ticket.service;
+
+import java.util.List;
+import com.ruoyi.project.ticket.domain.TTicketId;
+
+/**
+ * 作业票编号Service接口
+ * 
+ * @author ruoyi
+ * @date 2022-01-10
+ */
+public interface ITTicketIdService 
+{
+    /**
+     * 查询作业票编号
+     * 
+     * @param id 作业票编号ID
+     * @return 作业票编号
+     */
+    public TTicketId selectTTicketIdById(Long id);
+
+    /**
+     * 查询作业票编号列表
+     * 
+     * @param tTicketId 作业票编号
+     * @return 作业票编号集合
+     */
+    public List<TTicketId> selectTTicketIdList(TTicketId tTicketId);
+
+    /**
+     * 新增作业票编号
+     * 
+     * @param tTicketId 作业票编号
+     * @return 结果
+     */
+    public int insertTTicketId(TTicketId tTicketId);
+
+    /**
+     * 修改作业票编号
+     * 
+     * @param tTicketId 作业票编号
+     * @return 结果
+     */
+    public int updateTTicketId(TTicketId tTicketId);
+
+    /**
+     * 批量删除作业票编号
+     * 
+     * @param ids 需要删除的作业票编号ID
+     * @return 结果
+     */
+    public int deleteTTicketIdByIds(Long[] ids);
+
+    /**
+     * 删除作业票编号信息
+     * 
+     * @param id 作业票编号ID
+     * @return 结果
+     */
+    public int deleteTTicketIdById(Long id);
+}

+ 93 - 0
master/src/main/java/com/ruoyi/project/ticket/service/impl/TTicketIdServiceImpl.java

@@ -0,0 +1,93 @@
+package com.ruoyi.project.ticket.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.project.ticket.mapper.TTicketIdMapper;
+import com.ruoyi.project.ticket.domain.TTicketId;
+import com.ruoyi.project.ticket.service.ITTicketIdService;
+
+/**
+ * 作业票编号Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2022-01-10
+ */
+@Service
+public class TTicketIdServiceImpl implements ITTicketIdService
+{
+    @Autowired
+    private TTicketIdMapper tTicketIdMapper;
+
+    /**
+     * 查询作业票编号
+     *
+     * @param id 作业票编号ID
+     * @return 作业票编号
+     */
+    @Override
+    public TTicketId selectTTicketIdById(Long id)
+    {
+        return tTicketIdMapper.selectTTicketIdById(id);
+    }
+
+    /**
+     * 查询作业票编号列表
+     *
+     * @param tTicketId 作业票编号
+     * @return 作业票编号
+     */
+    @Override
+    public List<TTicketId> selectTTicketIdList(TTicketId tTicketId)
+    {
+        return tTicketIdMapper.selectTTicketIdList(tTicketId);
+    }
+
+    /**
+     * 新增作业票编号
+     *
+     * @param tTicketId 作业票编号
+     * @return 结果
+     */
+    @Override
+    public int insertTTicketId(TTicketId tTicketId)
+    {
+        return tTicketIdMapper.insertTTicketId(tTicketId);
+    }
+
+    /**
+     * 修改作业票编号
+     *
+     * @param tTicketId 作业票编号
+     * @return 结果
+     */
+    @Override
+    public int updateTTicketId(TTicketId tTicketId)
+    {
+        return tTicketIdMapper.updateTTicketId(tTicketId);
+    }
+
+    /**
+     * 批量删除作业票编号
+     *
+     * @param ids 需要删除的作业票编号ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTTicketIdByIds(Long[] ids)
+    {
+        return tTicketIdMapper.deleteTTicketIdByIds(ids);
+    }
+
+    /**
+     * 删除作业票编号信息
+     *
+     * @param id 作业票编号ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTTicketIdById(Long id)
+    {
+        return tTicketIdMapper.deleteTTicketIdById(id);
+    }
+}

+ 1 - 1
master/src/main/resources/application.yml

@@ -175,7 +175,7 @@ gen:
   # 作者
   author: ruoyi
   # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
-  packageName: com.ruoyi.project.ehs # 自动去除表前缀,默认是true
+  packageName: com.ruoyi.project.ticket # 自动去除表前缀,默认是true
   autoRemovePre: false
   # 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
   tablePrefix: t_

+ 2 - 2
master/src/main/resources/mybatis/ticket/THazardWorkPermitMapper.xml

@@ -509,9 +509,9 @@
     </select>
 
     <insert id="insertTHazardWorkPermit" parameterType="THazardWorkPermit" useGeneratedKeys="true" keyColumn="aId">
-        <selectKey keyProperty="aId" resultType="long" order="BEFORE">
+        <!--<selectKey keyProperty="aId" resultType="long" order="BEFORE">
             SELECT seq_t_hazard_work_permit.NEXTVAL as aId FROM DUAL
-        </selectKey>
+        </selectKey>-->
         insert into t_hazard_work_permit
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="aId != null">a_id,</if>

+ 116 - 0
master/src/main/resources/mybatis/ticket/TTicketIdMapper.xml

@@ -0,0 +1,116 @@
+<?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.project.ticket.mapper.TTicketIdMapper">
+    
+    <resultMap type="TTicketId" id="TTicketIdResult">
+        <result property="id"    column="id"    />
+        <result property="ticketId"    column="ticket_id"    />
+        <result property="deptId"    column="dept_id"    />
+        <result property="plantCode"    column="plant_code"    />
+        <result property="ticketType"    column="ticket_type"    />
+        <result property="ticketFull"    column="ticket_full"    />
+        <result property="delFlag"    column="del_flag"    />
+        <result property="createrCode"    column="creater_code"    />
+        <result property="createdate"    column="createdate"    />
+        <result property="updaterCode"    column="updater_code"    />
+        <result property="updatedate"    column="updatedate"    />
+        <result property="remarks"    column="remarks"    />
+        <result property="deptName" column="dept_name" />
+    </resultMap>
+
+    <sql id="selectTTicketIdVo">
+        select d.id, d.ticket_id, d.dept_id, d.plant_code, d.ticket_type, d.ticket_full, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.remarks ,s.dept_name from t_ticket_id d
+      left join sys_dept s on s.dept_id = d.dept_id
+    </sql>
+
+    <select id="selectTTicketIdList" parameterType="TTicketId" resultMap="TTicketIdResult">
+        <include refid="selectTTicketIdVo"/>
+        <where>  
+            <if test="ticketId != null "> and ticket_id = #{ticketId}</if>
+            <if test="deptId != null "> and dept_id = #{deptId}</if>
+            <if test="plantCode != null "> and plant_code = #{plantCode}</if>
+            <if test="ticketType != null "> and ticket_type = #{ticketType}</if>
+            <if test="ticketFull != null  and ticketFull != ''"> and ticket_full = #{ticketFull}</if>
+            <if test="createrCode != null  and createrCode != ''"> and creater_code = #{createrCode}</if>
+            <if test="createdate != null "> and createdate = #{createdate}</if>
+            <if test="updaterCode != null  and updaterCode != ''"> and updater_code = #{updaterCode}</if>
+            <if test="updatedate != null "> and updatedate = #{updatedate}</if>
+            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
+            and d.del_flag = 0
+        </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+    </select>
+    
+    <select id="selectTTicketIdById" parameterType="Long" resultMap="TTicketIdResult">
+        <include refid="selectTTicketIdVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertTTicketId" parameterType="TTicketId">
+        <selectKey keyProperty="id" resultType="long" order="BEFORE">
+            SELECT seq_t_ticket_id.NEXTVAL as id FROM DUAL
+        </selectKey>
+        insert into t_ticket_id
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="ticketId != null">ticket_id,</if>
+            <if test="deptId != null">dept_id,</if>
+            <if test="plantCode != null">plant_code,</if>
+            <if test="ticketType != null">ticket_type,</if>
+            <if test="ticketFull != null">ticket_full,</if>
+            <if test="delFlag != null">del_flag,</if>
+            <if test="createrCode != null">creater_code,</if>
+            <if test="createdate != null">createdate,</if>
+            <if test="updaterCode != null">updater_code,</if>
+            <if test="updatedate != null">updatedate,</if>
+            <if test="remarks != null">remarks,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="ticketId != null">#{ticketId},</if>
+            <if test="deptId != null">#{deptId},</if>
+            <if test="plantCode != null">#{plantCode},</if>
+            <if test="ticketType != null">#{ticketType},</if>
+            <if test="ticketFull != null">#{ticketFull},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="createrCode != null">#{createrCode},</if>
+            <if test="createdate != null">#{createdate},</if>
+            <if test="updaterCode != null">#{updaterCode},</if>
+            <if test="updatedate != null">#{updatedate},</if>
+            <if test="remarks != null">#{remarks},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTTicketId" parameterType="TTicketId">
+        update t_ticket_id
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="ticketId != null">ticket_id = #{ticketId},</if>
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="plantCode != null">plant_code = #{plantCode},</if>
+            <if test="ticketType != null">ticket_type = #{ticketType},</if>
+            <if test="ticketFull != null">ticket_full = #{ticketFull},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+            <if test="createrCode != null">creater_code = #{createrCode},</if>
+            <if test="createdate != null">createdate = #{createdate},</if>
+            <if test="updaterCode != null">updater_code = #{updaterCode},</if>
+            <if test="updatedate != null">updatedate = #{updatedate},</if>
+            <if test="remarks != null">remarks = #{remarks},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <update id="deleteTTicketIdById" parameterType="Long">
+        update t_ticket_id set del_flag = 2 where id = #{id}
+    </update>
+
+    <update id="deleteTTicketIdByIds" parameterType="String">
+        update t_ticket_id set del_flag = 2 where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+    
+</mapper>