Browse Source

优化代码处理,处理模板,修改启动接口

cxd 8 months ago
parent
commit
38270c43f2

+ 75 - 0
gqy-admin/src/main/java/com/gqy/web/controller/document/WorkController.java

@@ -0,0 +1,75 @@
+package com.gqy.web.controller.document;
+
+
+import com.gqy.common.core.controller.BaseController;
+import com.gqy.common.core.domain.AjaxResult;
+import com.gqy.common.core.page.TableDataInfo;
+import com.gqy.document.domain.Work;
+import com.gqy.document.service.IWorkService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/work")
+public class WorkController extends BaseController {
+
+    @Autowired
+    private IWorkService iWorkService;
+
+
+    /**
+     * 查询工程列表
+     *
+     * @param work 工程信息
+     * @return 工程集合
+     */
+    @PostMapping("/list")
+    public @ResponseBody TableDataInfo list(@RequestBody  Work work) {
+        // 开启分页
+        startPage();
+        // 获取工程列表
+        List<Work> list = iWorkService.selectWorkList(work);
+        // 返回分页数据
+        return getDataTable(list);
+    }
+
+
+    /**
+     * 新增工程
+     *
+     * @param work 工程信息
+     * @return 结果
+     */
+    @PostMapping(value = "/add")
+    public AjaxResult add(@Validated @RequestBody Work work) {
+        return toAjax(iWorkService.insertWork(work));
+    }
+
+
+    /**
+     * 修改工程
+     *
+     * @param work 工程信息
+     * @return 结果
+     */
+    @PostMapping(value = "/edit")
+    public AjaxResult edit(@Validated @RequestBody Work work) {
+        return toAjax(iWorkService.updateWork(work));
+    }
+
+
+    /**
+     * 删除工程
+     *
+     * @return 结果
+     */
+    @DeleteMapping("/dele/{wkId}")
+    public AjaxResult dele(@PathVariable Long wkId) {
+        return toAjax(iWorkService.deleWork(wkId));
+    }
+
+
+}

+ 1 - 1
gqy-admin/src/main/resources/application.yml

@@ -16,7 +16,7 @@ ruoyi:
 # 开发环境配置
 # 开发环境配置
 server:
 server:
   # 服务器的HTTP端口,默认为8080
   # 服务器的HTTP端口,默认为8080
-  port: 8080
+  port: 8885
   servlet:
   servlet:
     # 应用的访问路径
     # 应用的访问路径
     context-path: /
     context-path: /

+ 4 - 7
gqy-system/src/main/java/com/gqy/document/mapper/DcTemplateMapper.java

@@ -5,12 +5,9 @@ import org.apache.ibatis.annotations.Param;
 
 
 import java.util.List;
 import java.util.List;
 
 
+/**
+ * 模板查询接口
+ */
 public interface DcTemplateMapper {
 public interface DcTemplateMapper {
-
-    /**
-     * 查询模板列表
-     */
-    public List<DcTemplate> selectTemplateList(@Param("name") String name,
-                                               @Param("category_id") Integer category_id,
-                                               @Param("status") Integer status);
+    public List<DcTemplate> selectTemplateList(@Param("name") String name, @Param("category_id") Integer category_id,@Param("status") Integer status);
 }
 }

+ 31 - 0
gqy-system/src/main/java/com/gqy/document/mapper/WorkMapper.java

@@ -0,0 +1,31 @@
+package com.gqy.document.mapper;
+
+import com.gqy.document.domain.Work;
+import java.util.List;
+/**
+ * 工程Mapper接口
+ */
+public interface WorkMapper {
+    /**
+     * 查询工程列表
+     */
+    public List<Work> selectWorkList(Work work);
+
+    /**
+     * 新增工程
+     */
+    public int insertWork(Work work);
+
+    /**
+     * 修改工程
+     */
+    public int updateWork(Work work);
+
+    /**
+     * 查询工程详细信息
+     *
+     * @param wkId 工程主键
+     * @return 工程信息
+     */
+    public Work selectWorkById(Long wkId);
+}

+ 52 - 0
gqy-system/src/main/java/com/gqy/document/service/IWorkService.java

@@ -0,0 +1,52 @@
+package com.gqy.document.service;
+
+import com.gqy.document.domain.Work;
+
+import java.util.List;
+
+/**
+ * 工程服务接口
+ *
+ * @author raycos
+ */
+public interface IWorkService {
+    /**
+     * 查询工程列表
+     *
+     * @param work 工程信息
+     * @return 工程集合
+     */
+    public List<Work> selectWorkList(Work work);
+
+    /**
+     * 查询工程详细信息
+     *
+     * @param wkId 工程主键
+     * @return 工程信息
+     */
+    public Work selectWorkById(Long wkId);
+
+    /**
+     * 新增工程
+     *
+     * @param work 工程信息
+     * @return 结果
+     */
+    public int insertWork(Work work);
+
+    /**
+     * 修改工程
+     *
+     * @param work 工程信息
+     * @return 结果
+     */
+    public int updateWork(Work work);
+
+    /**
+     * 删除工程
+     * @param id
+     * @return
+     */
+    public int deleWork(Long id);
+
+}

+ 2 - 2
gqy-system/src/main/java/com/gqy/document/service/impl/DcTemplateServiceImpl.java

@@ -15,10 +15,10 @@ import java.util.List;
 public class DcTemplateServiceImpl implements IDcTemplateService {
 public class DcTemplateServiceImpl implements IDcTemplateService {
 
 
     @Autowired
     @Autowired
-    private DcTemplateMapper templateMapper;
+    private DcTemplateMapper dcTemplateMapper;
 
 
     @Override
     @Override
     public List<DcTemplate> selectTemplateList(String name, Integer category_id, Integer status) {
     public List<DcTemplate> selectTemplateList(String name, Integer category_id, Integer status) {
-        return templateMapper.selectTemplateList(name, category_id, status);
+        return dcTemplateMapper.selectTemplateList(name, category_id, status);
     }
     }
 }
 }

+ 93 - 0
gqy-system/src/main/java/com/gqy/document/service/impl/WorkServiceImpl.java

@@ -0,0 +1,93 @@
+package com.gqy.document.service.impl;
+
+import com.gqy.common.enums.UserStatus;
+import com.gqy.common.utils.DateUtils;
+import com.gqy.document.domain.Work;
+import com.gqy.document.mapper.WorkMapper;
+import com.gqy.document.service.IWorkService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class WorkServiceImpl implements IWorkService {
+
+    @Autowired
+    private WorkMapper workMapper;
+
+    /**
+     * 查询工程列表
+     *
+     * @param work 工程信息查询条件
+     * @return 工程信息集合
+     */
+    @Override
+    public List<Work> selectWorkList(Work work) {
+        return workMapper.selectWorkList(work);
+    }
+
+    /**
+     * 查询工程详细信息
+     *
+     * @param wkId 工程主键
+     * @return 工程信息
+     */
+    @Override
+    public Work selectWorkById(Long wkId) {
+        return workMapper.selectWorkById(wkId);
+    }
+
+    /**
+     * 新增工程
+     *
+     * @param work 工程信息
+     * @return 结果
+     */
+    @Override
+    public int insertWork(Work work) {
+        // 如果状态为空,设置默认值为0(显示)
+        if (work.getWkStaus() == null) {
+            work.setWkStaus(0);
+        }
+
+        // 如果产品数为空,设置默认值为0
+        if (work.getWkProductCount() == null) {
+            work.setWkProductCount(0);
+        }
+
+        // 设置创建时间
+       // work.setCreateTime(DateUtils.getNowDate());
+
+        return workMapper.insertWork(work);
+    }
+
+    /**
+     * 修改工程
+     *
+     * @param work 工程信息
+     * @return 结果
+     */
+    @Override
+    public int updateWork(Work work) {
+        // 设置更新时间
+        //work.setUpdateTime(DateUtils.getNowDate());
+
+        return workMapper.updateWork(work);
+    }
+
+    /**
+     * 删除工程id
+     * @param id
+     * @return
+     */
+    @Override
+    public int deleWork(Long id) {
+        Work work = workMapper.selectWorkById(id);
+        if(work != null){
+            work.setWkStaus(Integer.valueOf(UserStatus.DELETED.getCode()));
+        }
+        return updateWork(work);
+    }
+
+}

+ 0 - 35
gqy-system/src/main/resources/mapper/document/TemplateMapper.xml

@@ -1,35 +0,0 @@
-<?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.gqy.project.system.mapper.DcTemplateMapper">
-
-    <select id="selectTemplateList" resultType="DcTemplate">
-        SELECT
-        id,
-        code,
-        name,
-        intro,
-        content,
-        attrs,
-        category_id,
-        lay_id,
-        type,
-        user_id,
-        status,
-        create_time
-        FROM dc_template
-        <where>
-            AND status != 4
-            <if test="name != null and name != ''">
-                AND name LIKE CONCAT('%', #{name}, '%')
-            </if>
-            <if test="categoryId != null">
-                AND category_id = #{categoryId}
-            </if>
-            <if test="status != null">
-                AND status = #{status}
-            </if>
-        </where>
-        ORDER BY id DESC
-    </select>
-
-</mapper>

+ 64 - 0
gqy-system/src/main/resources/mapper/document/WorkMapper.xml

@@ -0,0 +1,64 @@
+<?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.gqy.document.mapper.WorkMapper">
+
+    <resultMap type="Work" id="WorkResult">
+        <id     property="wkId"           column="wk_id"           />
+        <result property="wkNo"           column="wk_no"           />
+        <result property="wkName"         column="wk_name"         />
+        <result property="wkSysId"        column="wk_sys_id"       />
+        <result property="wkRemark"       column="wk_remark"       />
+        <result property="wkStaus"        column="wk_staus"        />
+        <result property="wkProductCount" column="wk_product_count"/>
+    </resultMap>
+
+    <sql id="selectWorkVo">
+        select wk_id, wk_no, wk_name, wk_sys_id, wk_remark, wk_staus, wk_product_count
+        from work
+    </sql>
+
+    <select id="selectWorkList" parameterType="Work" resultMap="WorkResult">
+        <include refid="selectWorkVo"/>
+        <where>
+            <if test="wkNo != null and wkNo != ''">
+                AND wk_no like concat('%', #{wkNo}, '%')
+            </if>
+            <if test="wkName != null and wkName != ''">
+                AND wk_name like concat('%', #{wkName}, '%')
+            </if>
+            <if test="wkSysId != null">
+                AND wk_sys_id = #{wkSysId}
+            </if>
+            <if test="wkStaus != null">
+                AND wk_staus = #{wkStaus}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectWorkById" parameterType="Long" resultMap="WorkResult">
+        <include refid="selectWorkVo"/>
+        where wk_id = #{wkId}
+    </select>
+
+    <insert id="insertWork" parameterType="Work" useGeneratedKeys="true" keyProperty="wkId">
+        insert into work (
+            wk_no, wk_name, wk_sys_id, wk_remark, wk_staus, wk_product_count
+        ) values (
+                     #{wkNo}, #{wkName}, #{wkSysId}, #{wkRemark}, #{wkStaus}, #{wkProductCount}
+                 )
+    </insert>
+
+    <update id="updateWork" parameterType="Work">
+        update work
+        <set>
+            <if test="wkNo != null">wk_no = #{wkNo},</if>
+            <if test="wkName != null">wk_name = #{wkName},</if>
+            <if test="wkSysId != null">wk_sys_id = #{wkSysId},</if>
+            <if test="wkRemark != null">wk_remark = #{wkRemark},</if>
+            <if test="wkStaus != null">wk_staus = #{wkStaus},</if>
+        </set>
+        where wk_id = #{wkId}
+    </update>
+
+
+</mapper>

+ 72 - 0
创建表语句.txt

@@ -172,3 +172,75 @@ CREATE TABLE dc_template_category_user (
     is_main varchar(255) DEFAULT '0' COMMENT '是否主要',
     is_main varchar(255) DEFAULT '0' COMMENT '是否主要',
     PRIMARY KEY (id)
     PRIMARY KEY (id)
 ) ENGINE=InnoDB AUTO_INCREMENT=100 COMMENT='模板分类用户关联';
 ) ENGINE=InnoDB AUTO_INCREMENT=100 COMMENT='模板分类用户关联';
+
+
+
+-- 系统表
+CREATE TABLE `system` (
+    `sys_id` int NOT NULL AUTO_INCREMENT COMMENT '系统id',
+    `sys_name` varchar(50) NOT NULL COMMENT '系统名称',
+    `sys_remark` varchar(200) COMMENT '系统备注',
+    `sys_products` int DEFAULT 0 COMMENT '产品数',
+    PRIMARY KEY (`sys_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统表';
+
+-- 工程表
+CREATE TABLE `work` (
+    `wk_id` int NOT NULL AUTO_INCREMENT COMMENT '工程主键',
+    `wk_no` varchar(50) NOT NULL COMMENT '工程编码',
+    `wk_name` varchar(100) NOT NULL COMMENT '工程名称',
+    `wk_sys_id` int NOT NULL COMMENT '系统主键',
+    `wk_remark` varchar(200) COMMENT '工程备注',
+    `wk_staus` tinyint DEFAULT 0 COMMENT '状态 1不显示 0显示',
+    `wk_product_count` int DEFAULT 0 COMMENT '产品数',
+    PRIMARY KEY (`wk_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工程表';
+
+-- 工程系统表
+CREATE TABLE `work_system` (
+    `wr_sys_id` int NOT NULL AUTO_INCREMENT COMMENT '工程系统表id',
+    `wr_id` int NOT NULL COMMENT '工程主键',
+    `sys_id` int NOT NULL COMMENT '系统',
+    PRIMARY KEY (`wr_sys_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工程系统表';
+
+-- 系统产品表
+CREATE TABLE `system_product` (
+    `sys_id` int NOT NULL COMMENT '系统主键',
+    `sys_name` varchar(50) NOT NULL COMMENT '系统名称 音视频',
+    `sys_remark` varchar(200) COMMENT '系统备注',
+    `sys_p_id` varchar(50) NOT NULL COMMENT '产品主键 H300',
+    `sys_status` tinyint DEFAULT 0 COMMENT '状态 1不显示 0显示',
+    PRIMARY KEY (`sys_id`, `sys_p_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统产品表';
+
+-- 产品表
+CREATE TABLE `product` (
+    `p_id` varchar(50) NOT NULL COMMENT '产品主键',
+    `p_no` varchar(50) NOT NULL COMMENT '产品编号',
+    `p_name` varchar(100) NOT NULL COMMENT '产品名称',
+    `p_remark` varchar(200) COMMENT '产品备注',
+    `p_sort` int COMMENT '产品排序',
+    `p_status` tinyint DEFAULT 0 COMMENT '状态 1不显示 0显示',
+    PRIMARY KEY (`p_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品表';
+
+-- 产品规格表
+CREATE TABLE `p_spec` (
+    `ps_id` int NOT NULL AUTO_INCREMENT COMMENT '产品规格主键',
+    `ps_p_id` varchar(50) NOT NULL COMMENT '产品表主键',
+    `pa_no` varchar(50) NOT NULL COMMENT '规格编号(编码)box xt',
+    `ps_name` varchar(100) NOT NULL COMMENT '规格名 箱体',
+    `ps_dck_id` int COMMENT '文档块id',
+    PRIMARY KEY (`ps_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品规格表';
+
+-- 产品参数表
+CREATE TABLE `ps_param` (
+    `psp_id` int NOT NULL AUTO_INCREMENT COMMENT '参数主键',
+    `psp_mode` varchar(50) NOT NULL COMMENT '参数编码(代码)',
+    `psp_name` varchar(100) NOT NULL COMMENT '参数名',
+    `psp_value` varchar(200) COMMENT '参数值',
+    `psp_dck_id` int COMMENT '文档块id',
+    PRIMARY KEY (`psp_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品参数表';