瀏覽代碼

育儿孕周内容管理

huan.wang 6 年之前
父節點
當前提交
ab4a849369

+ 55 - 0
src/main/java/com/ygj/yuemum/controller/wxmini/WXContentController.java

@@ -0,0 +1,55 @@
+package com.ygj.yuemum.controller.wxmini;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.ygj.yuemum.domain.wxmini.WXContent;
+import com.ygj.yuemum.domain.wxmini.WXDianPing;
+import com.ygj.yuemum.domain.wxmini.WXDianPingImages;
+import com.ygj.yuemum.service.wxmini.WXContentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+public class WXContentController {
+
+    @Autowired
+    private WXContentService wxContentService;
+
+    @GetMapping("/getWXContents")
+    public List<WXContent> getWXContents() {
+        return wxContentService.getWXContents();
+    }
+
+
+    @PostMapping("/queryWXContents")
+    public String queryWXContents(@ModelAttribute WXContent wxContent) {
+        Map<String, Object> orderTemps = wxContentService.queryWXContents(wxContent);
+        String jso = JSONObject.toJSONString(orderTemps);
+        return jso;
+    }
+
+    @PostMapping("/insertWXContent")
+    public int insertWXContent(@ModelAttribute WXContent wxContent) {
+        return wxContentService.insertWXContent(wxContent);
+    }
+
+    @PostMapping("/updateWXContent")
+    public int updateWXContent(@ModelAttribute WXContent wxContent) {
+        return wxContentService.updateWXContent(wxContent);
+    }
+    @PostMapping("/deleteWXContent")
+    public int deleteWXContent(@RequestParam("id") Integer id) {
+        return wxContentService.deleteWXContent(id);
+    }
+    @PostMapping("/getWXContentByID")
+    public WXContent getWXContentByID(@RequestParam("id") Integer id) {
+        return wxContentService.getWXContentByID(id);
+    }
+
+
+
+}

+ 24 - 0
src/main/java/com/ygj/yuemum/controller/wxmini/WXContentTypeController.java

@@ -0,0 +1,24 @@
+package com.ygj.yuemum.controller.wxmini;
+
+
+import com.ygj.yuemum.domain.wxmini.WXContentType;
+import com.ygj.yuemum.service.wxmini.WXContentTypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+public class WXContentTypeController {
+
+    @Autowired
+    private WXContentTypeService wxContentTypeService;
+
+    @PostMapping("/getWXContentTypes")
+    public List<WXContentType> getWXContentTypes() {
+        return wxContentTypeService.getWXContentTypes();
+    }
+
+
+}

+ 17 - 0
src/main/java/com/ygj/yuemum/dao/wxmini/WXContentDao.java

@@ -0,0 +1,17 @@
+package com.ygj.yuemum.dao.wxmini;
+
+import com.ygj.yuemum.domain.wxmini.WXContent;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface WXContentDao {
+
+    List<WXContent> getWXContents();
+    int insertWXContent(WXContent wxContent);
+    int updateWXContent(WXContent wxContent);
+    int deleteWXContent(Integer id);
+    List<WXContent> queryWXContents(WXContent wxContent);
+    WXContent getWXContentByID(Integer id);
+}

+ 12 - 0
src/main/java/com/ygj/yuemum/dao/wxmini/WXContentTypeDao.java

@@ -0,0 +1,12 @@
+package com.ygj.yuemum.dao.wxmini;
+
+import com.ygj.yuemum.domain.wxmini.WXContentType;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface WXContentTypeDao {
+
+    List<WXContentType> getWXContentTypes();
+}

+ 121 - 0
src/main/java/com/ygj/yuemum/domain/wxmini/WXContent.java

@@ -0,0 +1,121 @@
+package com.ygj.yuemum.domain.wxmini;
+
+public class WXContent {
+    private Integer id;
+    private String wc_title;
+    private String wc_content;
+    private String wc_type;
+    private String wct_name;
+    private String wct_frequency;
+    private Integer wc_showtime;
+    private Integer wc_create_user;
+    private String wc_create_user_name;
+    private String wc_create_date;
+    private Integer wct_step;
+    private Integer limit;
+    private  Integer page;
+
+    public Integer getWct_step() {
+        return wct_step;
+    }
+
+    public void setWct_step(Integer wct_step) {
+        this.wct_step = wct_step;
+    }
+
+    public String getWct_name() {
+        return wct_name;
+    }
+
+    public void setWct_name(String wct_name) {
+        this.wct_name = wct_name;
+    }
+
+    public String getWct_frequency() {
+        return wct_frequency;
+    }
+
+    public void setWct_frequency(String wct_frequency) {
+        this.wct_frequency = wct_frequency;
+    }
+
+    public String getWc_create_user_name() {
+        return wc_create_user_name;
+    }
+
+    public void setWc_create_user_name(String wc_create_user_name) {
+        this.wc_create_user_name = wc_create_user_name;
+    }
+
+    public Integer getLimit() {
+        return limit;
+    }
+
+    public void setLimit(Integer limit) {
+        this.limit = limit;
+    }
+
+    public Integer getPage() {
+        return page;
+    }
+
+    public void setPage(Integer page) {
+        this.page = page;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getWc_title() {
+        return wc_title;
+    }
+
+    public void setWc_title(String wc_title) {
+        this.wc_title = wc_title;
+    }
+
+    public String getWc_content() {
+        return wc_content;
+    }
+
+    public void setWc_content(String wc_content) {
+        this.wc_content = wc_content;
+    }
+
+    public String getWc_type() {
+        return wc_type;
+    }
+
+    public void setWc_type(String wc_type) {
+        this.wc_type = wc_type;
+    }
+
+    public Integer getWc_showtime() {
+        return wc_showtime;
+    }
+
+    public void setWc_showtime(Integer wc_showtime) {
+        this.wc_showtime = wc_showtime;
+    }
+
+    public Integer getWc_create_user() {
+        return wc_create_user;
+    }
+
+    public void setWc_create_user(Integer wc_create_user) {
+        this.wc_create_user = wc_create_user;
+    }
+
+    public String getWc_create_date() {
+        return wc_create_date;
+    }
+
+    public void setWc_create_date(String wc_create_date) {
+        this.wc_create_date = wc_create_date;
+    }
+}

+ 49 - 0
src/main/java/com/ygj/yuemum/domain/wxmini/WXContentType.java

@@ -0,0 +1,49 @@
+package com.ygj.yuemum.domain.wxmini;
+
+public class WXContentType {
+    private Integer id;
+    private String wct_code;
+    private String wct_name;
+    private String wct_frequency;
+    private Integer wct_step;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getWct_code() {
+        return wct_code;
+    }
+
+    public void setWct_code(String wct_code) {
+        this.wct_code = wct_code;
+    }
+
+    public String getWct_name() {
+        return wct_name;
+    }
+
+    public void setWct_name(String wct_name) {
+        this.wct_name = wct_name;
+    }
+
+    public String getWct_frequency() {
+        return wct_frequency;
+    }
+
+    public void setWct_frequency(String wct_frequency) {
+        this.wct_frequency = wct_frequency;
+    }
+
+    public Integer getWct_step() {
+        return wct_step;
+    }
+
+    public void setWct_step(Integer wct_step) {
+        this.wct_step = wct_step;
+    }
+}

+ 52 - 0
src/main/java/com/ygj/yuemum/service/wxmini/WXContentService.java

@@ -0,0 +1,52 @@
+package com.ygj.yuemum.service.wxmini;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ygj.yuemum.dao.wxmini.WXContentDao;
+import com.ygj.yuemum.domain.wxmini.WXContent;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class WXContentService {
+
+    @Autowired
+
+    private WXContentDao wxContentDao;
+
+    public List<WXContent> getWXContents() {
+        return wxContentDao.getWXContents();
+    }
+
+    public Map<String, Object> queryWXContents(WXContent wxContent) {
+        PageHelper.startPage(wxContent.getPage(), wxContent.getLimit());
+        List<WXContent> wxDianPings = wxContentDao.queryWXContents(wxContent);
+        PageInfo<WXContent> pageInfo = new PageInfo<WXContent>(wxDianPings);
+        long count = pageInfo.getTotal(); //获取总记录数
+        Map<String, Object> tableData = new HashMap<>();
+        tableData.put("items", wxDianPings);
+        tableData.put("total", count);
+        return tableData;
+    }
+
+    public int insertWXContent(WXContent wxContent) {
+        return wxContentDao.insertWXContent(wxContent);
+    }
+
+    public int updateWXContent(WXContent wxContent) {
+        return wxContentDao.updateWXContent(wxContent);
+    }
+
+    public int deleteWXContent(Integer id) {
+        return wxContentDao.deleteWXContent(id);
+    }
+
+    public WXContent getWXContentByID(Integer id) {
+        return wxContentDao.getWXContentByID(id);
+    }
+
+}

+ 21 - 0
src/main/java/com/ygj/yuemum/service/wxmini/WXContentTypeService.java

@@ -0,0 +1,21 @@
+package com.ygj.yuemum.service.wxmini;
+
+import com.ygj.yuemum.dao.wxmini.WXContentTypeDao;
+import com.ygj.yuemum.domain.wxmini.WXContentType;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class WXContentTypeService {
+
+    @Autowired
+
+    private WXContentTypeDao wxContentTypeDao;
+
+    public List<WXContentType> getWXContentTypes() {
+        return wxContentTypeDao.getWXContentTypes();
+    }
+
+}

+ 4 - 4
src/main/resources/application.yml

@@ -59,14 +59,14 @@ file:
   promotionvoucher : "C:/apache-tomcat-9.0.14/webapps/MiniProgram/promotion/offline"
   httppromotionvoucher : "http://localhost:8080/MiniProgram/promotion/offline"
   qrcode: "C:/apache-tomcat-9.0.14/webapps/MiniProgram/mgm"
-  httpqrcode: "http://localhost:8080/MiniProgram/mgm"
+  httpqrcode: "http://127.0.0.1:8080/MiniProgram/mgm"
   IMGBANKCARD: "C:/apache-tomcat-9.0.14/webapps/MiniProgram/mgm/bankCard/"
-  HTTPIMGBANKCARD: "http://localhost:8080/MiniProgram/mgm/bankCard/"
+  HTTPIMGBANKCARD: "http://127.0.0.1:8080/MiniProgram/mgm/bankCard/"
   LOCALQRCODE: "C:/apache-tomcat-9.0.14/webapps/MiniProgram/mgm"
   DEMOQRCODE: "C:/apache-tomcat-9.0.14/webapps/MiniProgram/mgm/pop"
-  HTTPOPPQRCODE: "http://192.168.8.14:8080/MiniProgram/mgm/pop"
+  HTTPOPPQRCODE: "http://127.0.0.1:8080/MiniProgram/mgm/pop"
   TESTQRCODE: "C:/apache-tomcat-9.0.14/webapps/MiniProgram/promotion/test"
-  HTTTESTQRCODE: "http://192.168.8.14:8080/MiniProgram/promotion/test/dc"
+  HTTTESTQRCODE: "http://127.0.0.1:8080/MiniProgram/promotion/test/dc"
   BANNERIMGURL: "C:/apache-tomcat-9.0.14/webapps/MiniProgram/index/banner/"
   HTTPBANNERIMGURL: "http://127.0.0.1:8080/MiniProgram/index/banner/"
   DIANPINGIMGURL: "C:/apache-tomcat-9.0.14/webapps/MiniProgram/dianping/"

+ 148 - 0
src/main/resources/mybatis/mapper/wxmini/WXContentMapper.xml

@@ -0,0 +1,148 @@
+<?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.ygj.yuemum.dao.wxmini.WXContentDao" >
+
+    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.wxmini.WXContent" >
+        <id column="id" property="id" jdbcType="INTEGER" />
+        <result column="wc_title" property="wc_title" jdbcType="VARCHAR" />
+        <result column="wc_content" property="wc_content" jdbcType="VARCHAR" />
+        <result column="wc_type" property="wc_type" jdbcType="VARCHAR" />
+        <result column="wc_showtime" property="wc_showtime" jdbcType="INTEGER" />
+        <result column="wc_create_user" property="wc_create_user" jdbcType="INTEGER" />
+        <result column="wc_create_date" property="wc_create_date" jdbcType="DATE" />
+    </resultMap>
+
+    <!--获取所有数据-->
+    <select id="getWXContents" resultType="com.ygj.yuemum.domain.wxmini.WXContent" >
+        select
+        *
+        from wx_content
+        order by id desc
+    </select>
+
+
+    <select id="getWXContentByID" resultType="com.ygj.yuemum.domain.wxmini.WXContent" parameterType="java.lang.Integer">
+        SELECT
+            wx_content.id,
+            wx_content.wc_title,
+            wx_content.wc_content,
+            wx_content.wc_type,
+            wx_content.wc_showtime,
+            wx_content_type.wct_step
+        FROM
+            wx_content
+        LEFT JOIN wx_content_type ON wx_content.wc_type = wx_content_type.wct_code
+        where
+          wx_content.id = #{id,jdbcType=VARCHAR}
+        order by id desc
+    </select>
+
+
+    <select id="queryWXContents" resultType="com.ygj.yuemum.domain.wxmini.WXContent" parameterType="com.ygj.yuemum.domain.wxmini.WXContent">
+        SELECT
+        wx_content.id,
+        wc_title,
+        wc_content,
+        wc_type,
+        wct_name,
+        wc_showtime,
+        wct_frequency,
+        wc_create_user,
+        fgetuser_name (wc_create_user) wc_create_user_name,
+        wc_create_date
+        FROM
+        wx_content
+        LEFT JOIN wx_content_type ON wx_content.wc_type = wx_content_type.wct_code
+        where 1=1
+        <if test="wc_title != null and wc_title != ''">
+            and wc_title  like "%"#{wc_title,jdbcType=VARCHAR}"%"
+        </if>
+        <if test="wc_content != null and wc_content != ''">
+            and wc_content  like "%"#{wc_content,jdbcType=VARCHAR}"%"
+        </if>
+        <if test="wc_type != null and wc_type != ''">
+            and wc_type = #{wc_type,jdbcType=VARCHAR}
+        </if>
+        <if test="wc_showtime != null and wc_showtime != ''">
+            and wc_showtime = #{wc_showtime,jdbcType=INTEGER}
+        </if>
+        order by id  desc
+    </select>
+
+    <insert id="insertWXContent" parameterType="com.ygj.yuemum.domain.wxmini.WXContent" >
+        insert into wx_content
+        <trim prefix="(" suffix=")" suffixOverrides="," >
+            <if test="wc_title != null" >
+                wc_title,
+            </if>
+            <if test="wc_content != null" >
+                wc_content,
+            </if>
+            <if test="wc_type != null" >
+                wc_type,
+            </if>
+            <if test="wc_showtime != null" >
+                wc_showtime,
+            </if>
+            <if test="wc_create_user != null" >
+                wc_create_user,
+            </if>
+            <if test="wc_create_date != null" >
+                wc_create_date
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides="," >
+            <if test="wc_title != null" >
+                #{wc_title,jdbcType=VARCHAR},
+            </if>
+            <if test="wc_content != null" >
+                #{wc_content,jdbcType=VARCHAR},
+            </if>
+            <if test="wc_type != null" >
+                #{wc_type,jdbcType=VARCHAR},
+            </if>
+            <if test="wc_showtime != null" >
+                #{wc_showtime,jdbcType=INTEGER},
+            </if>
+            <if test="wc_create_user != null" >
+                #{wc_create_user,jdbcType=VARCHAR},
+            </if>
+            <if test="wc_create_date != null" >
+                #{wc_create_date,jdbcType=DATE}
+            </if>
+        </trim>
+    </insert>
+
+    <delete id="deleteWXContent" parameterType="java.lang.Integer"  >
+        delete from wx_content
+        where id = #{id,jdbcType=INTEGER}
+    </delete>
+
+    <update id="updateWXContent" parameterType="com.ygj.yuemum.domain.wxmini.WXContent" >
+        update wx_content
+        <set >
+            <if test="wc_title != null" >
+                wc_title = #{wc_title,jdbcType=VARCHAR},
+            </if>
+            <if test="wc_content != null" >
+                wc_content = #{wc_content,jdbcType=VARCHAR},
+            </if>
+            <if test="wc_type != null" >
+                wc_type = #{wc_type,jdbcType=VARCHAR},
+            </if>
+            <if test="wc_showtime != null" >
+                wc_showtime = #{wc_showtime,jdbcType=INTEGER},
+            </if>
+            <if test="wc_create_user != null" >
+                wc_create_user = #{wc_create_user,jdbcType=INTEGER},
+            </if>
+            <if test="wc_create_date != null" >
+                wc_create_date = #{wc_create_date,jdbcType=DATE}
+            </if>
+        </set>
+        where id = #{id,jdbcType=INTEGER}
+    </update>
+
+
+
+</mapper>

+ 21 - 0
src/main/resources/mybatis/mapper/wxmini/WXContentTypeMapper.xml

@@ -0,0 +1,21 @@
+<?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.ygj.yuemum.dao.wxmini.WXContentTypeDao" >
+
+    <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.wxmini.WXContentType" >
+        <id column="id" property="id" jdbcType="INTEGER" />
+        <result column="wct_code" property="wct_code" jdbcType="VARCHAR" />
+        <result column="wct_name" property="wct_name" jdbcType="VARCHAR" />
+        <result column="wct_frequency" property="wct_frequency" jdbcType="VARCHAR" />
+        <result column="wct_step" property="wct_step" jdbcType="INTEGER" />
+    </resultMap>
+
+    <!--获取所有数据-->
+    <select id="getWXContentTypes" resultType="com.ygj.yuemum.domain.wxmini.WXContentType" >
+        select
+        *
+        from wx_content_type
+        order by id desc
+    </select>
+
+</mapper>