Explorar o código

工程分类代码提交

cxd hai 7 meses
pai
achega
3c3bd571a9

+ 2 - 0
gqy-admin/src/main/java/com/gqy/web/controller/document/DcDocumentController.java

@@ -160,4 +160,6 @@ public class DcDocumentController extends BaseController
         return AjaxResultCQY.success(document);
         return AjaxResultCQY.success(document);
     }
     }
 
 
+
+
 }
 }

+ 44 - 1
gqy-admin/src/main/java/com/gqy/web/controller/document/DcTemplateController.java

@@ -7,8 +7,10 @@ import com.gqy.common.core.domain.AjaxResult;
 import com.gqy.common.core.domain.AjaxResultCQY;
 import com.gqy.common.core.domain.AjaxResultCQY;
 import com.gqy.common.utils.StringUtils;
 import com.gqy.common.utils.StringUtils;
 import com.gqy.document.domain.DcTemplate;
 import com.gqy.document.domain.DcTemplate;
+import com.gqy.document.domain.Document;
 import com.gqy.document.domain.vo.PageResult;
 import com.gqy.document.domain.vo.PageResult;
 import com.gqy.document.service.IDcTemplateService;
 import com.gqy.document.service.IDcTemplateService;
+import com.gqy.document.service.IDocumentService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
@@ -25,6 +27,44 @@ public class DcTemplateController extends BaseController {
     @Autowired
     @Autowired
     private IDcTemplateService templateService;
     private IDcTemplateService templateService;
 
 
+    @Autowired
+    private IDocumentService iDocumentService;
+
+
+    /**
+     *
+     * @param request
+     * @return
+     */
+    @PostMapping("/searchList")
+    public @ResponseBody  AjaxResultCQY searchList(@RequestBody  Map request) {
+        String page = request.get("page").toString();
+        String pageSizeStr = request.get("pageSize").toString();
+        Integer pageNum = StringUtils.isNotEmpty(page) ? Integer.valueOf(page) : 1;
+        Integer pageSize = StringUtils.isNotEmpty(pageSizeStr) ? Integer.valueOf(pageSizeStr) : 10;
+        String category_id = request.get("category_id").toString();
+        Document dcTemplateQuery = new Document();
+        if(StringUtils.isNotEmpty(category_id)){
+            dcTemplateQuery.setCategory_id(Long.valueOf(category_id));
+
+        }
+        PageHelper.startPage(pageNum, pageSize);
+
+        List<Document> list = iDocumentService.searchList(dcTemplateQuery);
+        // 3. 获取分页信息
+        PageInfo<Document> pageInfo = new PageInfo<>(list);
+
+        // 4. 封装并返回结果
+        PageResult PageResult=  new PageResult(
+                pageInfo.getPageNum(),
+                pageInfo.getPageSize(),
+                pageInfo.getPages(),
+                pageInfo.getTotal(),
+                pageInfo.getList());
+
+        return AjaxResultCQY.success("查询成功", PageResult);
+    }
+
 
 
     /**
     /**
      * 分页查询模板列表
      * 分页查询模板列表
@@ -115,7 +155,7 @@ public class DcTemplateController extends BaseController {
      */
      */
     @PostMapping("/info")
     @PostMapping("/info")
     public AjaxResultCQY info(@RequestBody Map map) {
     public AjaxResultCQY info(@RequestBody Map map) {
-        Integer id = (Integer) map.get("id");
+        Integer id = Integer.valueOf(map.get("id").toString()) ;
         return  templateService.getInfo(id.longValue());
         return  templateService.getInfo(id.longValue());
     }
     }
 
 
@@ -138,4 +178,7 @@ public class DcTemplateController extends BaseController {
         return templateService.update(template);
         return templateService.update(template);
     }
     }
 
 
+
+
+
 }
 }

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

@@ -72,7 +72,7 @@ spring:
     # 端口,默认为6379
     # 端口,默认为6379
     port: 6379
     port: 6379
     # 数据库索引
     # 数据库索引
-    database: 0
+    database: 14
     # 密码
     # 密码
     password: Iayq@742295
     password: Iayq@742295
     # 连接超时时间
     # 连接超时时间

+ 10 - 0
gqy-system/src/main/java/com/gqy/document/domain/Document.java

@@ -75,6 +75,16 @@ public class Document extends BaseEntity
     private String user_name;
     private String user_name;
 
 
 
 
+    /** 分类名称 */
+    private String type_name;
+
+    public String getType_name() {
+        return type_name;
+    }
+
+    public void setType_name(String type_name) {
+        this.type_name = type_name;
+    }
 
 
     public Long getCurrent_user_id() {
     public Long getCurrent_user_id() {
         return current_user_id;
         return current_user_id;

+ 0 - 2
gqy-system/src/main/java/com/gqy/document/mapper/DcTemplateMapper.java

@@ -67,6 +67,4 @@ public interface DcTemplateMapper {
     public int updateTemplateCode(DcTemplate template);
     public int updateTemplateCode(DcTemplate template);
 
 
 
 
-
-
 }
 }

+ 9 - 0
gqy-system/src/main/java/com/gqy/document/mapper/DocumentMapper.java

@@ -1,6 +1,7 @@
 package com.gqy.document.mapper;
 package com.gqy.document.mapper;
 
 
 
 
+import com.gqy.document.domain.DcTemplate;
 import com.gqy.document.domain.Document;
 import com.gqy.document.domain.Document;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
@@ -62,4 +63,12 @@ public interface DocumentMapper
      */
      */
     List<Long> selectProjectDocumentsByDocId(Long documentId);
     List<Long> selectProjectDocumentsByDocId(Long documentId);
 
 
+    /**
+     * 查询模板列表
+     *
+     * @param template 模板信息
+     * @return 模板集合
+     */
+    public List<Document> searchList(Document template);
+
 }
 }

+ 1 - 0
gqy-system/src/main/java/com/gqy/document/service/IDcTemplateService.java

@@ -42,4 +42,5 @@ public interface IDcTemplateService {
      */
      */
     public AjaxResultCQY update(DcTemplate template);
     public AjaxResultCQY update(DcTemplate template);
 
 
+
 }
 }

+ 7 - 0
gqy-system/src/main/java/com/gqy/document/service/IDocumentService.java

@@ -48,4 +48,11 @@ public interface IDocumentService
      */
      */
     public Map<String, Object>  info(Long id);
     public Map<String, Object>  info(Long id);
 
 
+    /**
+     * 查询文档列表
+     *
+     * @param document 文档信息
+     * @return 文档集合
+     */
+    public List<Document> searchList(Document document);
 }
 }

+ 11 - 0
gqy-system/src/main/java/com/gqy/document/service/impl/DcDocumentServiceImpl.java

@@ -223,5 +223,16 @@ public class DcDocumentServiceImpl implements IDocumentService
         return result;
         return result;
     }
     }
 
 
+    /**
+     * 查询文档列表
+     *
+     * @param document 文档信息
+     * @return 文档集合
+     */
+    public List<Document> searchList(Document document){
+        return documentMapper.searchList(document);
+    }
+
+
 
 
 }
 }

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

@@ -22,7 +22,6 @@ import java.util.Map;
  * 模板服务实现
  * 模板服务实现
  */
  */
 @Service
 @Service
-
 public class DcTemplateServiceImpl implements IDcTemplateService {
 public class DcTemplateServiceImpl implements IDcTemplateService {
 
 
     private static final Logger log = LoggerFactory.getLogger(DcTemplateServiceImpl.class);
     private static final Logger log = LoggerFactory.getLogger(DcTemplateServiceImpl.class);
@@ -180,4 +179,8 @@ public class DcTemplateServiceImpl implements IDcTemplateService {
         }
         }
     }
     }
 
 
+
+
+
+
 }
 }

+ 67 - 12
gqy-system/src/main/resources/mapper/document/DcDocumentMapper.xml

@@ -16,6 +16,10 @@
         <result property="update_time"  column="update_time"   />
         <result property="update_time"  column="update_time"   />
         <result property="create_by"    column="create_by"     />
         <result property="create_by"    column="create_by"     />
         <result property="update_by"    column="update_by"     />
         <result property="update_by"    column="update_by"     />
+
+        <result property="type_name"    column="type_name"     />
+
+
     </resultMap>
     </resultMap>
 
 
     <insert id="insertDocument" parameterType="Document" useGeneratedKeys="true" keyProperty="id">
     <insert id="insertDocument" parameterType="Document" useGeneratedKeys="true" keyProperty="id">
@@ -115,18 +119,18 @@
             <if test="user_id != null">
             <if test="user_id != null">
                 AND d.user_id = #{user_id}
                 AND d.user_id = #{user_id}
             </if>
             </if>
-            <if test="current_user_id != null">
-                AND (
-                d.user_id = #{current_user_id}
-                OR (
-                d.is_template = 1
-                AND d.user_id IN (
-                SELECT user_id FROM sys_user
-                WHERE is_admin = 1
-                )
-                )
-                )
-            </if>
+<!--            <if test="current_user_id != null">-->
+<!--                AND (-->
+<!--                d.user_id = #{current_user_id}-->
+<!--                OR (-->
+<!--                d.is_template = 1-->
+<!--                AND d.user_id IN (-->
+<!--                SELECT user_id FROM sys_user-->
+<!--                WHERE is_admin = 1-->
+<!--                )-->
+<!--                )-->
+<!--                )-->
+<!--            </if>-->
         </where>
         </where>
         ORDER BY d.create_time DESC
         ORDER BY d.create_time DESC
     </select>
     </select>
@@ -183,5 +187,56 @@
     </select>
     </select>
     <!-- 获取文档关联的项目ID列表 -->
     <!-- 获取文档关联的项目ID列表 -->
 
 
+    <!-- 查询文档列表 -->
+    <select id="searchList" parameterType="Document" resultMap="DocumentResult">
+        SELECT d.id,
+        d.title,
+        d.category_id,
+        d.create_time,
+        d.status,
+        d.is_template,
+        d.user_id,
+        dc.name as type_name
+        <!--
+         su.user_name,
+                ar.is_admin
+                -->
+        FROM dc_document d
+        LEFT JOIN dc_document_category dc ON d.category_id = dc.id
+        <where>
+            d.status = 5
+            AND d.is_template = 1
+<!--            <choose>-->
+<!--                <when test="is_admin != null and is_admin == 1">-->
+<!--                    &lt;!&ndash; 管理员可以看到所有模板 &ndash;&gt;-->
+<!--                </when>-->
+<!--                <otherwise>-->
+<!--                    &lt;!&ndash; 普通用户只能看到自己的和管理员的模板 &ndash;&gt;-->
+<!--                    AND (-->
+<!--                    d.user_id = #{user_id}-->
+<!--                    OR d.user_id IN (-->
+<!--                    SELECT u.user_id-->
+<!--                    FROM sys_user u-->
+<!--                    INNER JOIN sys_admin_role ar ON u.role_id = ar.id-->
+<!--                    WHERE ar.is_admin = 1-->
+<!--                    )-->
+<!--                    )-->
+<!--                </otherwise>-->
+<!--            </choose>-->
+            <!-- 按标题模糊查询 -->
+            <if test="title != null and title != ''">
+                AND d.title like concat('%', #{title}, '%')
+            </if>
+            <!-- 按分类查询 -->
+            <if test="category_id != null">
+                AND d.category_id = #{category_id}
+            </if>
+            <!-- 按用户查询 -->
+            <if test="user_id != null">
+                AND d.user_id = #{user_id}
+            </if>
+        </where>
+        ORDER BY d.id DESC
+    </select>
 
 
 </mapper>
 </mapper>

+ 1 - 0
gqy-system/src/main/resources/mapper/document/DcTemplateMapper.xml

@@ -187,4 +187,5 @@
 
 
 
 
 
 
+
 </mapper>
 </mapper>