cxd 8 сар өмнө
parent
commit
a6f1f27e38

+ 62 - 0
gqy-admin/src/main/java/com/gqy/web/controller/document/FormulaController.java

@@ -0,0 +1,62 @@
+package com.gqy.web.controller.document;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.gqy.common.core.domain.AjaxResult;
+import com.gqy.common.core.domain.AjaxResultCQY;
+import com.gqy.common.utils.StringUtils;
+import com.gqy.document.domain.DocumentCategory;
+import com.gqy.document.domain.Formula;
+import com.gqy.document.domain.vo.PageResult;
+import com.gqy.document.service.IFormulaService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+/**
+ * 公式管理Controller
+ *
+ */
+@RestController
+@RequestMapping("/formula")
+public class FormulaController {
+
+    @Autowired
+    private IFormulaService iFormulaService;
+
+    /**
+     * 查询公式列表
+     */
+    @PostMapping("/search")
+    public @ResponseBody  AjaxResultCQY search(HttpServletRequest request) {
+        // 获取表单参数
+        String page = request.getParameter("page");
+        String page_size = request.getParameter("pageSize");
+
+        Integer pageNum = StringUtils.isNotEmpty(page) ? Integer.valueOf(page) : 1;
+        Integer pageSize = StringUtils.isNotEmpty(page_size) ? Integer.valueOf(page_size) : 10;
+
+        // 分页查询
+        PageHelper.startPage(pageNum, pageSize);
+        Formula formulaQuery = new Formula();
+        List<Formula> listFormula = iFormulaService.search(formulaQuery);
+
+        PageInfo<Formula> pageInfo = new PageInfo<>(listFormula);
+
+        // 4. 封装并返回结果
+        PageResult PageResult=  new PageResult(
+                pageInfo.getPageNum(),
+                pageInfo.getPageSize(),
+                pageInfo.getPages(),
+                pageInfo.getTotal(),
+                pageInfo.getList());
+
+        return AjaxResultCQY.success("查询成功", PageResult);
+    }
+
+}

+ 1 - 7
gqy-system/src/main/java/com/gqy/document/domain/DcTemplate.java

@@ -21,7 +21,7 @@ public class DcTemplate {
     private Date create_time;
     private Integer status;
 
-    private DcTemplateCategory category;
+    private TemplateCategory category;
 
 
     public Integer getId() {
@@ -120,11 +120,5 @@ public class DcTemplate {
         this.status = status;
     }
 
-    public DcTemplateCategory getCategory() {
-        return category;
-    }
 
-    public void setCategory(DcTemplateCategory category) {
-        this.category = category;
-    }
 }

+ 0 - 64
gqy-system/src/main/java/com/gqy/document/domain/DcTemplateCategory.java

@@ -1,64 +0,0 @@
-package com.gqy.document.domain;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-import java.util.Date;
-
-public class DcTemplateCategory {
-    private Integer id;
-    private String name;
-    private Integer parent_id;
-    private String intro;
-
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date create_time;
-    private Integer status;
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public Integer getParent_id() {
-        return parent_id;
-    }
-
-    public void setParent_id(Integer parent_id) {
-        this.parent_id = parent_id;
-    }
-
-    public String getIntro() {
-        return intro;
-    }
-
-    public void setIntro(String intro) {
-        this.intro = intro;
-    }
-
-    public Date getCreate_time() {
-        return create_time;
-    }
-
-    public void setCreate_time(Date create_time) {
-        this.create_time = create_time;
-    }
-
-    public Integer getStatus() {
-        return status;
-    }
-
-    public void setStatus(Integer status) {
-        this.status = status;
-    }
-}

+ 107 - 0
gqy-system/src/main/java/com/gqy/document/domain/Formula.java

@@ -0,0 +1,107 @@
+package com.gqy.document.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+public class Formula {
+    /** 主键ID */
+    private Long id;
+
+    /** 公式名称 */
+    private String name;
+
+    /** 公式内容 */
+    private String formula;
+
+    /** 公式介绍 */
+    private String intro;
+
+    /** 使用状态 (5-已用中 6-未使用) */
+    private Integer use_status;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date create_time;
+
+    /** 公式参数 */
+    private String params;
+
+    /** 小数点标识 */
+    private Integer point;
+
+    /** 状态 (5-使用中 4-已删除) */
+    private Integer status;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getFormula() {
+        return formula;
+    }
+
+    public void setFormula(String formula) {
+        this.formula = formula;
+    }
+
+    public String getIntro() {
+        return intro;
+    }
+
+    public void setIntro(String intro) {
+        this.intro = intro;
+    }
+
+    public Integer getUse_status() {
+        return use_status;
+    }
+
+    public void setUse_status(Integer use_status) {
+        this.use_status = use_status;
+    }
+
+    public Date getCreate_time() {
+        return create_time;
+    }
+
+    public void setCreate_time(Date create_time) {
+        this.create_time = create_time;
+    }
+
+    public String getParams() {
+        return params;
+    }
+
+    public void setParams(String params) {
+        this.params = params;
+    }
+
+    public Integer getPoint() {
+        return point;
+    }
+
+    public void setPoint(Integer point) {
+        this.point = point;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+}

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

@@ -1,7 +1,6 @@
 package com.gqy.document.mapper;
 
 import com.gqy.document.domain.DcTemplate;
-import com.gqy.document.domain.DcTemplateCategory;
 import com.gqy.document.domain.TemplateCategory;
 import org.apache.ibatis.annotations.Param;
 
@@ -34,6 +33,6 @@ public interface DcTemplateMapper {
      * @param categoryId 分类ID
      * @return 分类信息
      */
-    DcTemplateCategory selectTemplateCategoryById(Long categoryId);
+    TemplateCategory selectTemplateCategoryById(Long categoryId);
 
 }

+ 20 - 0
gqy-system/src/main/java/com/gqy/document/mapper/FormulaMapper.java

@@ -0,0 +1,20 @@
+package com.gqy.document.mapper;
+
+import com.gqy.document.domain.Formula;
+
+import java.util.List;
+
+/**
+ * 公式管理Mapper接口
+ *
+ */
+public interface FormulaMapper {
+    /**
+     * 查询公式列表
+     *
+     * @param formula 公式信息
+     * @return 公式集合
+     */
+    public List<Formula> selectFormulaList(Formula formula);
+
+}

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

@@ -3,7 +3,6 @@ package com.gqy.document.service.impl;
 import com.gqy.common.core.domain.AjaxResult;
 import com.gqy.common.core.domain.AjaxResultCQY;
 import com.gqy.document.domain.DcTemplate;
-import com.gqy.document.domain.DcTemplateCategory;
 import com.gqy.document.domain.TemplateCategory;
 import com.gqy.document.mapper.DcTemplateMapper;
 import com.gqy.document.service.IDcTemplateService;
@@ -44,7 +43,7 @@ public class DcTemplateServiceImpl implements IDcTemplateService {
             return AjaxResultCQY.error("模板不存在");
         }
         // 2. 查询关联的分类信息
-        DcTemplateCategory category = null;
+        TemplateCategory category = null;
         if (template.getCategory_id() != null) {
             category = dcTemplateMapper.selectTemplateCategoryById(Long.valueOf(template.getCategory_id()));
         }

+ 23 - 0
gqy-system/src/main/java/com/gqy/document/service/impl/FormulaServiceImpl.java

@@ -0,0 +1,23 @@
+package com.gqy.document.service.impl;
+
+import com.gqy.document.domain.Formula;
+import com.gqy.document.mapper.FormulaMapper;
+import com.gqy.document.service.IFormulaService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class FormulaServiceImpl implements IFormulaService {
+
+    @Autowired
+    private FormulaMapper formulaMapper;
+
+    /**
+     * 查询公式列表
+     */
+    public List<Formula> search(Formula formula) {
+        return formulaMapper.selectFormulaList(formula);
+    }
+}

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

@@ -21,7 +21,7 @@
         <result property="status"      column="status"      />
 
         <!-- 分类关联映射 -->
-        <association property="category" javaType="DcTemplateCategory">
+        <association property="category" javaType="TemplateCategory">
             <id     property="id"          column="c_id"          />
             <result property="name"        column="c_name"        />
             <result property="parent_id"   column="c_parent_id"   />

+ 36 - 0
gqy-system/src/main/resources/mapper/document/FormulaMapper.xml

@@ -0,0 +1,36 @@
+<?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.FormulaMapper">
+
+    <resultMap type="Formula" id="FormulaResult">
+        <id     property="id"         column="id"        />
+        <result property="name"       column="name"      />
+        <result property="formula"    column="formula"   />
+        <result property="intro"      column="intro"     />
+        <result property="use_status" column="use_status"/>
+        <result property="create_time" column="create_time"/>
+        <result property="params"     column="params"    />
+        <result property="point"      column="point"     />
+        <result property="status"     column="status"    />
+    </resultMap>
+
+    <sql id="selectFormulaVo">
+        select id, name, formula, intro, use_status, create_time, params, point, status
+        from dc_formula
+    </sql>
+
+    <!-- 查询公式列表 -->
+    <select id="selectFormulaList" parameterType="Formula" resultMap="FormulaResult">
+        <include refid="selectFormulaVo"/>
+        <where>
+            <if test="name != null and name != ''">
+                AND name like concat('%', #{name}, '%')
+            </if>
+            <if test="status != null">
+                AND status = #{status}
+            </if>
+            AND status != 4
+        </where>
+        order by id desc
+    </select>
+</mapper>

+ 0 - 0
gqy-system/src/main/resources/mapper/document/Product.xml → gqy-system/src/main/resources/mapper/document/ProductMapper.xml