Przeglądaj źródła

购买超级会员套餐

zhijiezhao 3 lat temu
rodzic
commit
d2765b61c6

+ 15 - 0
src/main/java/com/caimei/modules/supers/dao/CmSvipPackageDao.java

@@ -0,0 +1,15 @@
+package com.caimei.modules.supers.dao;
+
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import com.caimei.modules.supers.entity.CmSvipPackage;
+
+/**
+ * 超级会员套餐配置DAO接口
+ * @author zzj
+ * @version 2021-10-09
+ */
+@MyBatisDao
+public interface CmSvipPackageDao extends CrudDao<CmSvipPackage> {
+	
+}

+ 63 - 0
src/main/java/com/caimei/modules/supers/entity/CmSvipPackage.java

@@ -0,0 +1,63 @@
+package com.caimei.modules.supers.entity;
+
+import org.hibernate.validator.constraints.Length;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+
+/**
+ * 超级会员套餐配置Entity
+ * @author zzj
+ * @version 2021-10-09
+ */
+public class CmSvipPackage extends DataEntity<CmSvipPackage> {
+	
+	private static final long serialVersionUID = 1L;
+	private String name;		// 套餐名称
+	private String price;		// 套餐价格
+	private String duration;		// 套餐时长(月)
+	private String proportion;		// 采美豆现金兑换比例
+
+	public CmSvipPackage() {
+		super();
+	}
+
+	public CmSvipPackage(String id){
+		super(id);
+	}
+
+	@Length(min=0, max=50, message="套餐名称长度必须介于 0 和 50 之间")
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	public String getPrice() {
+		return price;
+	}
+
+	public void setPrice(String price) {
+		this.price = price;
+	}
+	
+	public String getDuration() {
+		return duration;
+	}
+
+	public void setDuration(String duration) {
+		this.duration = duration;
+	}
+
+	public String getProportion() {
+		return proportion;
+	}
+
+	public void setProportion(String proportion) {
+		this.proportion = proportion;
+	}
+	
+}

+ 46 - 0
src/main/java/com/caimei/modules/supers/service/CmSvipPackageService.java

@@ -0,0 +1,46 @@
+package com.caimei.modules.supers.service;
+
+import java.util.List;
+
+import com.caimei.modules.supers.dao.CmSvipPackageDao;
+import com.caimei.modules.supers.entity.CmSvipPackage;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.service.CrudService;
+import com.caimei.modules.supers.entity.CmSvipPackage;
+import com.caimei.modules.supers.dao.CmSvipPackageDao;
+
+/**
+ * 超级会员套餐配置Service
+ * @author zzj
+ * @version 2021-10-09
+ */
+@Service
+@Transactional(readOnly = true)
+public class CmSvipPackageService extends CrudService<CmSvipPackageDao, CmSvipPackage> {
+
+	public CmSvipPackage get(String id) {
+		return super.get(id);
+	}
+	
+	public List<CmSvipPackage> findList(CmSvipPackage cmSvipPackage) {
+		return super.findList(cmSvipPackage);
+	}
+	
+	public Page<CmSvipPackage> findPage(Page<CmSvipPackage> page, CmSvipPackage cmSvipPackage) {
+		return super.findPage(page, cmSvipPackage);
+	}
+	
+	@Transactional(readOnly = false)
+	public void save(CmSvipPackage cmSvipPackage) {
+		super.save(cmSvipPackage);
+	}
+	
+	@Transactional(readOnly = false)
+	public void delete(CmSvipPackage cmSvipPackage) {
+		super.delete(cmSvipPackage);
+	}
+	
+}

+ 80 - 0
src/main/java/com/caimei/modules/supers/web/CmSvipPackageController.java

@@ -0,0 +1,80 @@
+package com.caimei.modules.supers.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.web.BaseController;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import com.caimei.modules.supers.entity.CmSvipPackage;
+import com.caimei.modules.supers.service.CmSvipPackageService;
+
+/**
+ * 超级会员套餐配置Controller
+ * @author zzj
+ * @version 2021-10-09
+ */
+@Controller
+@RequestMapping(value = "${adminPath}/super/cmSvipPackage")
+public class CmSvipPackageController extends BaseController {
+
+	@Autowired
+	private CmSvipPackageService cmSvipPackageService;
+	
+	@ModelAttribute
+	public CmSvipPackage get(@RequestParam(required=false) String id) {
+		CmSvipPackage entity = null;
+		if (StringUtils.isNotBlank(id)){
+			entity = cmSvipPackageService.get(id);
+		}
+		if (entity == null){
+			entity = new CmSvipPackage();
+		}
+		return entity;
+	}
+	
+
+	@RequestMapping(value = {"list", ""})
+	public String list(CmSvipPackage cmSvipPackage, HttpServletRequest request, HttpServletResponse response, Model model) {
+		Page<CmSvipPackage> page = cmSvipPackageService.findPage(new Page<CmSvipPackage>(request, response), cmSvipPackage); 
+		model.addAttribute("page", page);
+		return "modules/super/cmSvipPackageList";
+	}
+
+
+	@RequestMapping(value = "form")
+	public String form(CmSvipPackage cmSvipPackage, Model model) {
+		model.addAttribute("cmSvipPackage", cmSvipPackage);
+		return "modules/super/cmSvipPackageForm";
+	}
+
+
+	@RequestMapping(value = "save")
+	public String save(CmSvipPackage cmSvipPackage, Model model, RedirectAttributes redirectAttributes) {
+		if (!beanValidator(model, cmSvipPackage)){
+			return form(cmSvipPackage, model);
+		}
+		cmSvipPackageService.save(cmSvipPackage);
+		addMessage(redirectAttributes, "保存超级会员套餐配置成功");
+		return "redirect:"+Global.getAdminPath()+"/super/cmSvipPackage/?repage";
+	}
+	
+
+	@RequestMapping(value = "delete")
+	public String delete(CmSvipPackage cmSvipPackage, RedirectAttributes redirectAttributes) {
+		cmSvipPackageService.delete(cmSvipPackage);
+		addMessage(redirectAttributes, "删除超级会员套餐配置成功");
+		return "redirect:"+Global.getAdminPath()+"/super/cmSvipPackage/?repage";
+	}
+
+}

+ 96 - 0
src/main/resources/mappings/modules/super/CmSvipPackageMapper.xml

@@ -0,0 +1,96 @@
+<?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.caimei.modules.supers.dao.CmSvipPackageDao">
+    
+	<sql id="cmSvipPackageColumns">
+		a.id AS "id",
+		a.name AS "name",
+		a.price AS "price",
+		a.duration AS "duration",
+		a.proportion AS "proportion"
+	</sql>
+	
+	<sql id="cmSvipPackageJoins">
+	</sql>
+    
+	<select id="get" resultType="CmSvipPackage">
+		SELECT 
+			<include refid="cmSvipPackageColumns"/>
+		FROM cm_svip_package a
+		<include refid="cmSvipPackageJoins"/>
+		WHERE a.id = #{id}
+	</select>
+	
+	<select id="findList" resultType="CmSvipPackage">
+		SELECT 
+			<include refid="cmSvipPackageColumns"/>
+		FROM cm_svip_package a
+		<include refid="cmSvipPackageJoins"/>
+		<where>
+			
+			<if test="name != null and name != ''">
+				AND a.name LIKE 
+					<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
+					<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
+					<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+			</otherwise>
+		</choose>
+	</select>
+	
+	<select id="findAllList" resultType="CmSvipPackage">
+		SELECT 
+			<include refid="cmSvipPackageColumns"/>
+		FROM cm_svip_package a
+		<include refid="cmSvipPackageJoins"/>
+		<where>
+			
+		</where>		
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+			</otherwise>
+		</choose>
+	</select>
+	
+	<insert id="insert" parameterType="CmSvipPackage"  keyProperty="id" useGeneratedKeys="true">
+		INSERT INTO cm_svip_package(
+			id,
+			name,
+			price,
+			duration,
+			delFlag,
+			proportion
+		) VALUES (
+			#{id},
+			#{name},
+			#{price},
+			#{duration},
+			0,
+			#{proportion}
+		)
+	</insert>
+	
+	<update id="update">
+		UPDATE cm_svip_package SET 	
+			name = #{name},
+			price = #{price},
+			duration = #{duration},
+			proportion = #{proportion}
+		WHERE id = #{id}
+	</update>
+	
+	<delete id="delete">
+		DELETE FROM cm_svip_package
+		WHERE id = #{id}
+	</delete>
+	
+</mapper>

+ 78 - 0
src/main/webapp/WEB-INF/views/modules/super/cmSvipPackageForm.jsp

@@ -0,0 +1,78 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>超级会员套餐配置管理</title>
+    <meta name="decorator" content="default"/>
+    <script type="text/javascript">
+        $(document).ready(function () {
+
+            //$("#name").focus();
+            $("#inputForm").validate({
+                submitHandler: function (form) {
+                    var places = $(".input-xlarge").val();
+                    if (!(/(^[1-9]\d*$)/.test(places))) {
+                        alert("金额应为正整数");
+                        return false;
+                    }
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function (error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+        });
+
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/super/cmSvipPackage/">超级会员套餐配置列表</a></li>
+    <li class="active"><a
+            href="${ctx}/super/cmSvipPackage/form?id=${cmSvipPackage.id}">超级会员套餐配置${not empty cmSvipPackage.id?'编辑':'添加'}查看</a>
+    </li>
+</ul>
+<br/>
+<form:form id="inputForm" modelAttribute="cmSvipPackage" action="${ctx}/super/cmSvipPackage/save" method="post"
+           class="form-horizontal">
+    <form:hidden path="id"/>
+    <sys:message content="${message}"/>
+    <div class="control-group">
+        <label class="control-label">套餐名称:</label>
+        <div class="controls">
+            <form:input path="name" htmlEscape="false" maxlength="50" class="input-lab"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>套餐价格:</label>
+        <div class="controls">
+            <form:input path="price" htmlEscape="false" class="input-xlarge"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>套餐时长(月):</label>
+        <div class="controls">
+            <form:input path="duration" htmlEscape="false" class="input-xlarge"/>
+        </div>
+    </div>
+
+    <div class="control-group">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>采美豆现金兑换比例:</label>
+        <div class="controls">
+            <form:input path="proportion" htmlEscape="false" class="input-xlarge"/>
+        </div>
+    </div>
+    <div class="form-actions">
+        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+    </div>
+</form:form>
+</body>
+</html>

+ 64 - 0
src/main/webapp/WEB-INF/views/modules/super/cmSvipPackageList.jsp

@@ -0,0 +1,64 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>超级会员套餐配置管理</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th{text-align: center;}
+		.table td{text-align: center;}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			
+		});
+		function page(n,s){
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+        	return false;
+        }
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li class="active"><a href="${ctx}/super/cmSvipPackage/">超级会员套餐配置列表</a></li>
+<%--		<li><a href="${ctx}/super/cmSvipPackage/form">超级会员套餐配置添加</a></li>--%>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmSvipPackage" action="${ctx}/super/cmSvipPackage/" method="post" class="breadcrumb form-search">
+		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+		<div class="ul-form">
+			 <label>套餐名称:</label>
+				<form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
+			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+			<div class="clearfix"></div>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<table id="contentTable" class="table table-striped table-bordered table-condensed">
+		<thead>
+			<tr>
+				<th>套餐名称</th>
+				<th>操作</th>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="cmSvipPackage">
+			<tr>
+				<td><a href="${ctx}/super/cmSvipPackage/form?id=${cmSvipPackage.id}">
+					${cmSvipPackage.name}
+				</a></td>
+				<td>
+    				<a href="${ctx}/super/cmSvipPackage/form?id=${cmSvipPackage.id}">编辑</a>
+
+<%--					<a href="${ctx}/super/cmSvipPackage/delete?id=${cmSvipPackage.id}" onclick="return confirmx('确认要删除该超级会员套餐配置吗?', this.href)">删除</a>--%>
+
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+</body>
+</html>