<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
<#import '/common/common.ftl' as commonMacro>
<@commonMacro.commonStyle />
</head>
<body class="page-content">
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<i class="fa fa-home"></i>
<a href="/welcome">首页</a>
<i class="iconfont iconiconfontjiantou4"></i>
</li>
<li>
<i class="fa fa-cube"></i>
<a href="index">赛季管理</a>
<i class="iconfont iconiconfontjiantou4"></i>
</li>
<li class=" active">
<i class="fa fa-plus "></i>
<a href="#">编辑</a>
</li>
</ul>
</div>
<div class="page-content">
<div class="tab-pane active" id="tab_0">
<div class="portlet box grey-cascade">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-adn"></i>编辑
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
<a href="javascript:;" class="reload">
</a>
<a href="javascript:;" class="remove" data-original-title="" title="" onclick="history.go(-1)">
</a>
</div>
</div>
<div class="portlet-body form">
<!-- BEGIN FORM-->
<form action="" class="form-horizontal" id="spuForm">
<input id="id" name="id" type="hidden" value="${data.id}"/>
<div class="form-body">
<!-- 另起一行 -->
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="col-md-3 control-label">
是否当前赛季
</label>
<div class="col-md-5">
<div class="input-icon margin-top-10">
<select id="isThis" name="isThis" class="form-control selectpicker show-tick"
validate="{required: true}">
<option value="0">赛季进行中</option>
<option value="1">赛季已经结束</option>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="col-md-4 control-label">
赛季名字<span class="required">* </span>
</label>
<div class="col-md-8">
<div class="input-icon margin-top-10">
<i class="fa fa-user "></i>
<input type="text" name="competitionSeasonName" id="competitionSeasonName" class="form-control"
placeholder="赛季名字"
validate='{required: true,maxlength:20,number:true}' maxlength="20">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-actions right">
<button type="button" class="btn default" onclick="history.go(-1)"><i
class="fa fa-rotate-left"></i> 取消
</button>
<button type="button" class="btn green" id="submitForm"><i class="fa fa-check"></i> 保存</button>
</div>
</form>
<!-- END FORM-->
</div>
</div>
</div>
</div>
<@commonMacro.commonScript />
</body>
<script>
var $submit = $('#submitForm');
$submit.click(function () {
$("#content").val($("#info").val());
$.propertyJson('property', 'primaryAttributes');
//表单ajax提交
$("#spuForm").ajaxSubmitForm({
url: "/billiards/seasonType/updateCompetitionSeasonType",
success: function (result) {
if (result.success) {
if (result.message) {
window.wxc.xcConfirm(result.message ? result.message : "提交成功", window.wxc.xcConfirm.typeEnum.success, {
title: '提示'
, onOk: function () {
if (!result || !result.backUrl) {
window.location.href = 'index';
} else {
window.location.href = contextPath + result.backUrl;
}
}
});
} else {
if (!result || !result.backUrl) {
window.location.href = 'index';
} else {
window.location.href = contextPath + result.backUrl;
}
}
window.wxc.xcConfirm("操作成功", window.wxc.xcConfirm.typeEnum.info);
window.location.href = "/billiards/seasonType/index";
} else {
window.wxc.xcConfirm(result.message, window.wxc.xcConfirm.typeEnum.error);
}
},
error: function (result) {
window.wxc.xcConfirm("网络异常", window.wxc.xcConfirm.typeEnum.error);
}
});
});
//初始化属性
$.initProperty("addGroup", "addProperty", "property", true);
</script>
</html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
<#import '/common/common.ftl' as commonMacro>
<@commonMacro.commonStyle />
</head>
<body class="page-content">
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<i class="fa fa-home"></i>
<a href="/welcome">首页</a>
<i class="iconfont iconiconfontjiantou4"></i>
</li>
<li>
<i class="fa fa-cube"></i>
<a href="index">赛季管理</a>
<i class="iconfont iconiconfontjiantou4"></i>
</li>
<li class=" active">
<i class="fa fa-plus "></i>
<a href="#">添加</a>
</li>
</ul>
</div>
<div class="page-content">
<div class="tab-pane active" id="tab_0">
<div class="portlet box grey-cascade">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-adn"></i>更新赛季信息
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
<a href="javascript:;" class="reload">
</a>
<a href="javascript:;" class="remove" data-original-title="" title="" onclick="history.go(-1)">
</a>
</div>
</div>
<div class="portlet-body form">
<!-- BEGIN FORM-->
<form action="" class="form-horizontal" id="spuForm">
<input type="text" name="categoryId" id="categoryId" hidden>
<input name="primaryAttributes" id="primaryAttributes" hidden>
<div class="form-body">
<!-- 另起一行 -->
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="col-md-3 control-label">
赛季情况
</label>
<div class="col-md-5">
<div class="input-icon margin-top-10">
<select id="isThis" name="isThis" class="form-control selectpicker show-tick"
validate="{required: true}">
<option value="0">赛季进行中</option>
<option value="1">赛季已经结束</option>
</select>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="col-md-4 control-label">
赛季名字<span class="required">* </span>
</label>
<div class="col-md-8">
<div class="input-icon margin-top-10">
<i class="fa fa-user "></i>
<input type="text" name="competitionSeasonName" class="form-control" placeholder="赛季名字"
validate='{required: true,maxlength:8,number:true}' maxlength="20">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-actions right">
<button type="button" class="btn default" onclick="history.go(-1)"><i
class="fa fa-rotate-left"></i> 取消
</button>
<button type="button" class="btn green" id="submitForm"><i class="fa fa-check"></i> 保存</button>
</div>
</form>
<!-- END FORM-->
</div>
</div>
</div>
</div>
<!-- 模态框(Modal) -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog " style="width:400px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">选择类目</h4>
</div>
<div class="modal-body">
<div id="categoryTree"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="modalSubmit">确定</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<@commonMacro.commonScript />
</body>
<script>
$(document).ready(function () {
$("#mainImgFile").fileinput({
language: 'zh',
showUpload: false, //是否显示上传按钮
required: true,
removeTitle: '删除文件',
removeLabel: '全部删除',
browseLabel: '选择文件',
msgPlaceholder: '请选中',
dropZoneTitle: '请将文件拖拽此区域...',
msgZoomModalHeading: '文件预览',
msgNoFilesSelected: '没有选择文件',
dropZoneEnabled: false,
previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
uploadUrl: '#', // you must set a valid URL here else you will get an error
allowedFileExtensions: ['jpg', 'png', 'gif'],
overwriteInitial: false,
maxFileSize: 1000,
maxFilesNum: 1,
//allowedFileTypes: ['image', 'video', 'flash'],
slugCallback: function (filename) {
return filename.replace('(', '_').replace(']', '_');
}
});
$("#carouselFigureImgFile").fileinput({
language: 'zh',
showUpload: false, //是否显示上传按钮
required: true,
removeTitle: '删除文件',
removeLabel: '全部删除',
browseLabel: '选择文件',
msgPlaceholder: '请选中',
dropZoneTitle: '请将文件拖拽此区域...',
msgZoomModalHeading: '文件预览',
msgNoFilesSelected: '没有选择文件',
uploadUrl: '#', // you must set a valid URL here else you will get an error
allowedFileExtensions: ['jpg', 'png', 'gif'],
overwriteInitial: false,
maxFileSize: 1000,
maxFilesNum: 10,
layoutTemplates: {
actionUpload: ''
},
fileActionSettings: {},
//allowedFileTypes: ['image', 'video', 'flash'],
slugCallback: function (filename) {
return filename.replace('(', '_').replace(']', '_');
},
uploadExtraData: function (previewId, index) { //额外参数的关键点
alert("不能独立提交!");
}
});
var carouselFigureImgFile = new Array();
$('#carouselFigureImgFile').on('filebatchselected', function (event, files) {
for (var i = 0; i < files.length; i++) {
var alread = false;
for (var a = 0; a < carouselFigureImgFile.length; a++) {
var objName = carouselFigureImgFile[a].name;
if (objName == undefined) {
continue;
}
if (objName == files[i].name)
alread = true;
}
if (alread == false) {
carouselFigureImgFile.push(files[i]);
}
}
});
$('#carouselFigureImgFile').on('fileremoved', function (event, id, index) {
carouselFigureImgFile.splice(index, 1);
alert(carouselFigureImgFile.length);
});
$('#carouselFigureImgFile').on('fileclear', function (event) {
carouselFigureImgFile.splice(0, carouselFigureImgFile.length);
});
$("#submitForm").click(function () {
$.propertyJson('property', 'primaryAttributes');
//表单ajax提交
$("#spuForm").ajaxSubmitForm({
url: "/billiards/seasonType/addCompetitionSeasonType",
success: function (result) {
if (result.success) {
if (result.message) {
window.wxc.xcConfirm(result.message ? result.message : "提交成功", window.wxc.xcConfirm.typeEnum.success, {
title: '提示'
, onOk: function () {
if (!result || !result.backUrl) {
window.location.href = 'index';
} else {
window.location.href = contextPath + result.backUrl;
}
}
});
} else {
if (!result || !result.backUrl) {
window.location.href = 'index';
} else {
window.location.href = contextPath + result.backUrl;
}
}
window.wxc.xcConfirm("操作成功", window.wxc.xcConfirm.typeEnum.info);
window.location.href = "/billiards/seasonType/index";
} else {
window.wxc.xcConfirm(result.message, window.wxc.xcConfirm.typeEnum.error);
}
},
error: function (result) {
window.wxc.xcConfirm("网络异常", window.wxc.xcConfirm.typeEnum.error);
}
});
});
//初始化属性
$.initProperty("addGroup", "addProperty", "property", true);
// 广告选择
$.ajax({
url: contextPath + '/billiards/seasonType/listSeasonConfig',
type: 'get',
dataType: 'json',
success: function (data) {
if (data.success != true) {
alert("获取赛季信息失败!");
return false;
}
var select2 = document.getElementById("id");
select2.options.add(new Option("请选择类型", ""));
var obj = eval('(' + data.data + ')');
for (var i = 0; i < obj.length; i++) {
var id = obj[i].id;
select2.options.add(new Option(id));
}
}
});
});
</script>
$("#spuForm").ajaxSubmitForm({
url: "/billiards/SeasonType/addCompetitionSeasonType",
success: function (result) {
if (result.success) {
</html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
<#import '/common/common.ftl' as commonMacro>
<@commonMacro.commonStyle />
</head>
<body class="page-content">
<!-- BEGIN PAGE HEADER-->
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<i class="fa fa-home"></i>
<a href="/welcome">首页</a>
<i class="iconfont iconiconfontjiantou4"></i>
</li>
<li>
<a href="#">赛季管理</a>
<i class="fa fa-cube"></i>
</li>
</ul>
</div>
<div class="page-content">
<!-- END PAGE HEADER-->
<!-- BEGIN PAGE CONTENT-->
<div class="row">
<div class="col-md-12">
<!-- BEGIN EXAMPLE TABLE PORTLET-->
<div class="portlet box grey-cascade">
<div class="portlet-title">
<div class="caption">
<i class="icon-user"></i>赛季管理
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
<a href="javascript:;" class="reload" onclick="init()">
</a>
</div>
</div>
<div class="portlet-body" id="spuInfoTable">
<div class="table-toolbar">
<div class="row">
<div class="col-md-10">
<div class="btn-group">
<button id="newSpuInfoButton" class="btn green" onclick="location.href = 'add';">
添加赛季 <i class="fa fa-plus"></i>
</button>
</div>
</div>
</div>
</div>
<table class="table table-striped table-bordered table-hover ">
<thead>
<tr>
<th column="id">赛季ID</th>
<th column="competitionSeasonName">赛季名字</th>
<th column="isThis" type="enum" enum-v="{0:'当前赛季进行中',1:'当前赛季结束'}">是否当前赛季</th>
<th type="action">操作</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="table-toolbar pagination-toolbar">
</div>
</div>
</div>
<!-- END EXAMPLE TABLE PORTLET-->
</div>
</div>
</div>
<@commonMacro.commonScript />
<script>
function init() {
$("#spuInfoTable").pagingGrid(
{
dataUrl: '/billiards/seasonType/listSeasonConfig'
, pageSize: 10
, scroll: false
, dockedItems: [{
name: '编辑'
, iconClass: 'iconfont iconshangjia'
, action: '/billiards/seasonType/editView'
, confirm: true
, parmaName: 'id'
, column: 'id'
}],
pagingtoolbar: {
displayInfo: true
}
}
);
}
//初始化
init();
</script>
</body>
</html>
package com.yuyuka.billiards.admin.controller;
import com.apus.common.page.PageVo;
import com.yuyuka.billiards.api.BilliardsSeasonTypeApi;
import com.yuyuka.billiards.api.dto.*;
import com.yuyuka.billiards.common.JsonResult;
import com.yuyuka.billiards.common.JsonUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
@Slf4j
@Controller
@RequestMapping("billiards/seasonType")
public class SeasonTypeController extends AbstractController{
@Resource
private BilliardsSeasonTypeApi billiardsSeasonTypeApi;
/**
* 查询赛季列表
* @param billiardsCompetitionSeasonDto
* @return
*/
@RequestMapping(value ="/listSeasonConfig" ,method = RequestMethod.POST)
@ResponseBody
public JsonResult listSeasonConfig(BilliardsCompetitionSeasonDto billiardsCompetitionSeasonDto){
JsonResult jsonResult = new JsonResult();
try{
PageVo<BilliardsCompetitionSeasonDto> datas = billiardsSeasonTypeApi.listSeasonConfig(billiardsCompetitionSeasonDto);
jsonResult.put("list",datas.getDataList());
jsonResult.put("rowCount",datas.getTotalCount());
jsonResult.setMessage("成功");
jsonResult.setSuccess(true);
}catch (Exception e) {
log.error("查询赛季异常", e);
jsonResult.setMessage(e.getMessage());
jsonResult.setSuccess(false);
}
return jsonResult;
}
/**
* 添加赛季类型
* @param billiardsCompetitionSeasonDto
* @return
* @throws Exception
*/
@RequestMapping(value ="/addCompetitionSeasonType",method = RequestMethod.POST)
@ResponseBody
public JsonResult addCompetitionSeasonType(BilliardsCompetitionSeasonDto billiardsCompetitionSeasonDto) throws Exception{
JsonResult jsonResult = new JsonResult();
try {
Boolean data = billiardsSeasonTypeApi.addCompetitionSeasonType(billiardsCompetitionSeasonDto);
jsonResult.put("data", data);
jsonResult.setMessage("成功");
jsonResult.setSuccess(true);
} catch (Exception e) {
log.error("查询设施配置后台异常", e);
jsonResult.setMessage(e.getMessage());
jsonResult.setSuccess(false);
}
return jsonResult;
}
/**
* 修改比赛类型
* @param billiardsCompetitionSeasonDto
* @return
* @throws Exception
*/
@RequestMapping(value ="/updateCompetitionSeasonType", method = RequestMethod.POST)
@ResponseBody
public JsonResult updateCompetitionSeasonType(BilliardsCompetitionSeasonDto billiardsCompetitionSeasonDto) throws Exception{
JsonResult jsonResult = new JsonResult();
try {
Boolean data = billiardsSeasonTypeApi.updateCompetitionSeasonType(billiardsCompetitionSeasonDto);
jsonResult.put("data", data);
jsonResult.setMessage("成功");
jsonResult.setSuccess(true);
} catch (Exception e) {
log.error("查询设施配置后台异常", e);
jsonResult.setMessage(e.getMessage());
jsonResult.setSuccess(false);
}
return jsonResult;
}
/**
* 获取比赛类型
* @param id
* @return
*/
@RequestMapping(value = "/getSeasonType",method = RequestMethod.POST)
@ResponseBody
public JsonResult getSeasonType(Long id){
JsonResult jsonResult = new JsonResult();
try {
BilliardsCompetitionSeasonDto data = billiardsSeasonTypeApi.getSeasonType(id);
jsonResult.put("data", data);
jsonResult.setMessage("成功");
jsonResult.setSuccess(true);
} catch (Exception e) {
log.error("查询设施配置后台异常", e);
jsonResult.setMessage(e.getMessage());
jsonResult.setSuccess(false);
}
return jsonResult;
}
/**
* 跳转列表页面
*
* @return
*/
@RequestMapping("/index")
public String index() {
return "/seasonType/index";
}
/**
* 跳转添加页面
* @return
*/
@RequestMapping("/add")
public String addCost() {
return "/seasonType/add";
}
/**
* 编辑展示页面
* @param id
* @return
*/
@RequestMapping("/editView")
public ModelAndView add(@RequestParam("id") Long id) throws Exception {
BilliardsCompetitionSeasonDto billiardsCompetitionSeasonDto = billiardsSeasonTypeApi.getSeasonType(id);
ModelAndView returnValue = new ModelAndView("/seasonType/edit");
returnValue.addObject("data", billiardsCompetitionSeasonDto);
return returnValue;
}
}
package com.yuyuka.billiards.api.dto;
import java.io.Serializable;
public class BilliardsCompetitionSeasonDto implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.ID
*
* @mbg.generated Wed Nov 06 17:12:54 CST 2019
*/
private Long id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.COMPETITION_SEASON_NAME
*
* @mbg.generated Wed Nov 06 17:12:54 CST 2019
*/
private String competitionSeasonName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.IS_THIS
*
* @mbg.generated Wed Nov 06 17:12:54 CST 2019
*/
private Integer isThis;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table BILLIARDS_USER_COMPETITION_SEASON_CONFIG
*
* @mbg.generated Wed Nov 06 17:12:54 CST 2019
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.ID
*
* @return the value of BILLIARDS_USER_COMPETITION_SEASON_CONFIG.ID
*
* @mbg.generated Wed Nov 06 17:12:54 CST 2019
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.ID
*
* @param id the value for BILLIARDS_USER_COMPETITION_SEASON_CONFIG.ID
*
* @mbg.generated Wed Nov 06 17:12:54 CST 2019
*/
public void setId(Long id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.COMPETITION_SEASON_NAME
*
* @return the value of BILLIARDS_USER_COMPETITION_SEASON_CONFIG.COMPETITION_SEASON_NAME
*
* @mbg.generated Wed Nov 06 17:12:54 CST 2019
*/
public String getCompetitionSeasonName() {
return competitionSeasonName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.COMPETITION_SEASON_NAME
*
* @param competitionSeasonName the value for BILLIARDS_USER_COMPETITION_SEASON_CONFIG.COMPETITION_SEASON_NAME
*
* @mbg.generated Wed Nov 06 17:12:54 CST 2019
*/
public void setCompetitionSeasonName(String competitionSeasonName) {
this.competitionSeasonName = competitionSeasonName == null ? null : competitionSeasonName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.IS_THIS
*
* @return the value of BILLIARDS_USER_COMPETITION_SEASON_CONFIG.IS_THIS
*
* @mbg.generated Wed Nov 06 17:12:54 CST 2019
*/
public Integer getIsThis() {
return isThis;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.IS_THIS
*
* @param isThis the value for BILLIARDS_USER_COMPETITION_SEASON_CONFIG.IS_THIS
*
* @mbg.generated Wed Nov 06 17:12:54 CST 2019
*/
public void setIsThis(Integer isThis) {
this.isThis = isThis;
}
private Integer start;
private Integer limit;
public Integer getStart(){ return start; }
public void setStart(Integer start){ this.start = start;}
public Integer getLimit(){ return limit; }
public void setLimit(Integer limit){this.limit = limit;}
}
package com.yuyuka.billiards.api;
import com.apus.common.page.PageVo;
import com.yuyuka.billiards.api.dto.BilliardsCompetitionSeasonDto;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.io.Serializable;
@FeignClient("billiards-server-center")
public interface BilliardsSeasonTypeApi {
/**
* 查询赛季列表
* @param billiardsCompetitionSeasonDto
* @return
*/
@RequestMapping("/billiards/SeasonType/listSeasonConfig")
public PageVo<BilliardsCompetitionSeasonDto> listSeasonConfig(@RequestBody BilliardsCompetitionSeasonDto billiardsCompetitionSeasonDto);
/**
* 添加赛季类型
* @param billiardsCompetitionSeasonDto
* @return
* @throws Exception
*/
@RequestMapping("/billiards/SeasonType/addCompetitionSeasonType")
public Boolean addCompetitionSeasonType(@RequestBody BilliardsCompetitionSeasonDto billiardsCompetitionSeasonDto) throws Exception;
/**
* 修改比赛类型
* @param billiardsCompetitionSeasonDto
* @return
* @throws Exception
*/
@RequestMapping("/billiards/SeasonType/updateCompetitionSeasonType")
public Boolean updateCompetitionSeasonType(@RequestBody BilliardsCompetitionSeasonDto billiardsCompetitionSeasonDto) throws Exception;
/**
* 获取比赛类型
* @param id
* @return
*/
@RequestMapping("/billiards/SeasonType/getSeasonType")
public BilliardsCompetitionSeasonDto getSeasonType(@RequestParam("id") Long id);
}
package com.yuyuka.billiards.service.service.impl;
import com.apus.common.page.PageVo;
import com.yuyuka.billiards.common.JsonUtils;
import com.yuyuka.billiards.service.cache.CacheKeyEnum;
import com.yuyuka.billiards.service.domain.BilliardsUserCompetitionSeasonConfig;
import com.yuyuka.billiards.service.domain.BilliardsUserCompetitionSeasonConfig;
import com.yuyuka.billiards.service.manager.BilliardsUserCompetitionConfigManager;
import com.yuyuka.billiards.service.service.AbstractbServiceProvider;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@Slf4j
@RestController
@RequestMapping("/billiards/SeasonType")
public class BilliardsSeasonTypeServiceProvide extends AbstractbServiceProvider {
@Resource
private BilliardsUserCompetitionConfigManager billiardsUserCompetitionConfigManager;
/**
* 查询赛季列表
* @param billiardsUserCompetitionSeasonConfig
* @return
*/
@RequestMapping("/listSeasonConfig")
public PageVo<BilliardsUserCompetitionSeasonConfig> listSeasonConfig(@RequestBody BilliardsUserCompetitionSeasonConfig billiardsUserCompetitionSeasonConfig){
logInstanceInfo();
return billiardsUserCompetitionConfigManager.listSeasonConfig(billiardsUserCompetitionSeasonConfig);
}
/**
* 添加赛季类型
* @param billiardsUserCompetitionSeasonConfig
* @return
* @throws Exception
*/
@RequestMapping("/addCompetitionSeasonType")
public Boolean addCompetitionSeasonType(@RequestBody BilliardsUserCompetitionSeasonConfig billiardsUserCompetitionSeasonConfig) throws Exception{
logInstanceInfo();
return billiardsUserCompetitionConfigManager.addCompetitionSeasonType(billiardsUserCompetitionSeasonConfig);
}
/**
* 修改比赛类型
* @param billiardsUserCompetitionSeasonConfig
* @return
* @throws Exception
*/
@RequestMapping("/updateCompetitionSeasonType")
public Boolean updateCompetitionSeasonType(@RequestBody BilliardsUserCompetitionSeasonConfig billiardsUserCompetitionSeasonConfig) throws Exception{
logInstanceInfo();
boolean isSuccess = billiardsUserCompetitionConfigManager.updateCompetitionSeasonType(billiardsUserCompetitionSeasonConfig);
if(!isSuccess){
throw new Exception("更改数据失败");
}
jedisCluster.hset(CacheKeyEnum.BILLIARDS_SEASON_TYPE.getKey(),billiardsUserCompetitionSeasonConfig.getId().toString(), JsonUtils.toJSON(billiardsUserCompetitionSeasonConfig));
return isSuccess;
}
/**
* 获取比赛类型
* @param id
* @return
*/
@RequestMapping("/getSeasonType")
public BilliardsUserCompetitionSeasonConfig getSeasonType(@RequestParam("id") Long id){
logInstanceInfo();
return billiardsUserCompetitionConfigManager.getSeasonType(id);
}
}
package com.yuyuka.billiards.service.manager;
import com.apus.common.page.PageVo;
import com.yuyuka.billiards.service.domain.BilliardsUserCompetitionSeasonConfig;
public interface BilliardsUserCompetitionConfigManager {
/**
* 查询赛季列表
* @param billiardsUserCompetitionSeasonConfig
* @return
*/
public PageVo<BilliardsUserCompetitionSeasonConfig> listSeasonConfig(BilliardsUserCompetitionSeasonConfig billiardsUserCompetitionSeasonConfig);
/**
* 添加赛季类型
* @param billiardsUserCompetitionSeasonConfig
* @return
* @throws Exception
*/
public Boolean addCompetitionSeasonType(BilliardsUserCompetitionSeasonConfig billiardsUserCompetitionSeasonConfig) throws Exception;
/**
* 修改比赛类型
* @param billiardsUserCompetitionSeasonConfig
* @return
* @throws Exception
*/
public Boolean updateCompetitionSeasonType(BilliardsUserCompetitionSeasonConfig billiardsUserCompetitionSeasonConfig) throws Exception;
/**
* 获取比赛类型
* @param id
* @return
*/
public BilliardsUserCompetitionSeasonConfig getSeasonType(Long id);
}
package com.yuyuka.billiards.service.manager.impl;
import com.apus.common.page.PageVo;
import com.google.common.reflect.TypeToken;
import com.yuyuka.billiards.api.dto.BilliardsCompetitionSeasonDto;
import com.yuyuka.billiards.common.JsonUtils;
import com.yuyuka.billiards.external.pay.wx.util.StringUtils;
import com.yuyuka.billiards.service.cache.CacheDataHanlder;
import com.yuyuka.billiards.service.cache.CacheKeyEnum;
import com.yuyuka.billiards.service.cache.CacheProxy;
import com.yuyuka.billiards.service.dao.BilliardsUserCompetitionSeasonConfigMapper;
import com.yuyuka.billiards.service.domain.BilliardsUserCompetitionSeasonConfig;
import com.yuyuka.billiards.service.domain.BilliardsUserCompetitionSeasonConfigExample;
import com.yuyuka.billiards.service.manager.AbstractbManager;
import com.yuyuka.billiards.service.manager.BilliardsUserCompetitionConfigManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import redis.clients.jedis.JedisCluster;
import javax.annotation.Resource;
@Slf4j
@Component("billiardsUserCompetitionConfigManager")
public class BilliardsUserCompetitionConfigManagerImpl extends AbstractbManager implements BilliardsUserCompetitionConfigManager {
@Resource
private BilliardsUserCompetitionSeasonConfigMapper billiardsUserCompetitionSeasonConfigMapper;
@Override
public PageVo<BilliardsUserCompetitionSeasonConfig> listSeasonConfig(BilliardsUserCompetitionSeasonConfig billiardsUserCompetitionSeasonConfig) {
PageVo<BilliardsUserCompetitionSeasonConfig> returnValue = new PageVo<>();
BilliardsUserCompetitionSeasonConfigExample billiardsUserCompetitionSeasonConfigExample = new BilliardsUserCompetitionSeasonConfigExample();
BilliardsUserCompetitionSeasonConfigExample.Criteria c = billiardsUserCompetitionSeasonConfigExample.createCriteria();
billiardsUserCompetitionSeasonConfigExample.setOffset(billiardsUserCompetitionSeasonConfig.getStart());
billiardsUserCompetitionSeasonConfigExample.setLimit(billiardsUserCompetitionSeasonConfig.getLimit());
returnValue.setDataList(billiardsUserCompetitionSeasonConfigMapper.selectByExample(billiardsUserCompetitionSeasonConfigExample));
returnValue.setTotalCount(billiardsUserCompetitionSeasonConfigMapper.countByExample(billiardsUserCompetitionSeasonConfigExample));
return returnValue;
}
@Override
public Boolean addCompetitionSeasonType(BilliardsUserCompetitionSeasonConfig billiardsUserCompetitionSeasonConfig) throws Exception {
BilliardsUserCompetitionSeasonConfigExample billiardsUserCompetitionSeasonConfigExample = new BilliardsUserCompetitionSeasonConfigExample();
BilliardsUserCompetitionSeasonConfigExample.Criteria c = billiardsUserCompetitionSeasonConfigExample.createCriteria();
c.andCompetitionSeasonNameEqualTo(billiardsUserCompetitionSeasonConfig.getCompetitionSeasonName());
Long num = billiardsUserCompetitionSeasonConfigMapper.countByExample(billiardsUserCompetitionSeasonConfigExample);
if (num == 0) {
int count = new CacheDataHanlder<BilliardsUserCompetitionSeasonConfigMapper>(billiardsUserCompetitionSeasonConfigMapper, new CacheProxy() {
@Override
public Object doBegin(Object[] args, JedisCluster jedisClusterCommon) { return null; }
@Override
public Object doEnd(Object[] args, Object result, JedisCluster jedisClusterCommon) throws Exception {
if (((Integer) result) != null && ((Integer) result) <= 0) {
return result;
}
jedisClusterCommon.hset(CacheKeyEnum.BILLIARDS_SEASON_TYPE.getKey(), billiardsUserCompetitionSeasonConfig.getId().toString(), JsonUtils.toJSON(billiardsUserCompetitionSeasonConfig));
return result;
}
}, jedisCluster).getProxy().insert(billiardsUserCompetitionSeasonConfig);
if (count > 0) {
return true;
}
throw new Exception("数据插入失败");
}
throw new Exception("赛季已经存在");
}
@Transactional
@Override
public Boolean updateCompetitionSeasonType(BilliardsUserCompetitionSeasonConfig billiardsUserCompetitionSeasonConfig) throws Exception {
if(billiardsUserCompetitionSeasonConfig == null || billiardsUserCompetitionSeasonConfig.getId() == null){
throw new Exception("赛季的参数不能为空");
}
int count = billiardsUserCompetitionSeasonConfigMapper.updateByPrimaryKeySelective(billiardsUserCompetitionSeasonConfig);
if(count >0){
return true;
}
throw new Exception("赛季类型更新失败");
}
@Override
public BilliardsUserCompetitionSeasonConfig getSeasonType(Long id) {
return new CacheDataHanlder<BilliardsUserCompetitionSeasonConfigMapper>(billiardsUserCompetitionSeasonConfigMapper, new CacheProxy() {
@Override
public Object doBegin(Object[] args, JedisCluster jedisClusterCommon) {
String json = jedisClusterCommon.hget(CacheKeyEnum.BILLIARDS_SEASON_TYPE.getKey(),id.toString());
if(StringUtils.isEmpty(json)){
return null;
}
return com.apus.util.JsonUtils.fromJson(json,new TypeToken<BilliardsUserCompetitionSeasonConfig>(){}.getType());
}
@Override
public Object doEnd(Object[] args, Object result, JedisCluster jedisClusterCommon) throws Exception {
if(result ==null && ((BilliardsUserCompetitionSeasonConfig)result).getId()==null){
return result;
}
BilliardsUserCompetitionSeasonConfig billiardsUserCompetitionSeasonConfig = (BilliardsUserCompetitionSeasonConfig) result;
jedisClusterCommon.hset(CacheKeyEnum.BILLIARDS_SEASON_TYPE.getKey(),billiardsUserCompetitionSeasonConfig.getId().toString(),JsonUtils.toJSON(result));
return result;
}
},jedisCluster).getProxy().selectByPrimaryKey(id);
}
}
package com.yuyuka.billiards.service.domain;
import java.io.Serializable;
public class BilliardsUserCompetitionSeasonConfig implements Serializable {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.ID
*
* @mbg.generated Sat Jul 06 17:45:02 CST 2019
*/
private Long id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.COMPETITION_SEASON_NAME
*
* @mbg.generated Sat Jul 06 17:45:02 CST 2019
*/
private String competitionSeasonName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.IS_THIS
*
* @mbg.generated Sat Jul 06 17:45:02 CST 2019
*/
private Integer isThis;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table BILLIARDS_USER_COMPETITION_SEASON_CONFIG
*
* @mbg.generated Sat Jul 06 17:45:02 CST 2019
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.ID
*
* @return the value of BILLIARDS_USER_COMPETITION_SEASON_CONFIG.ID
*
* @mbg.generated Sat Jul 06 17:45:02 CST 2019
*/
public Long getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.ID
*
* @param id the value for BILLIARDS_USER_COMPETITION_SEASON_CONFIG.ID
*
* @mbg.generated Sat Jul 06 17:45:02 CST 2019
*/
public void setId(Long id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.COMPETITION_SEASON_NAME
*
* @return the value of BILLIARDS_USER_COMPETITION_SEASON_CONFIG.COMPETITION_SEASON_NAME
*
* @mbg.generated Sat Jul 06 17:45:02 CST 2019
*/
public String getCompetitionSeasonName() {
return competitionSeasonName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.COMPETITION_SEASON_NAME
*
* @param competitionSeasonName the value for BILLIARDS_USER_COMPETITION_SEASON_CONFIG.COMPETITION_SEASON_NAME
*
* @mbg.generated Sat Jul 06 17:45:02 CST 2019
*/
public void setCompetitionSeasonName(String competitionSeasonName) {
this.competitionSeasonName = competitionSeasonName == null ? null : competitionSeasonName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.IS_THIS
*
* @return the value of BILLIARDS_USER_COMPETITION_SEASON_CONFIG.IS_THIS
*
* @mbg.generated Sat Jul 06 17:45:02 CST 2019
*/
public Integer getIsThis() {
return isThis;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column BILLIARDS_USER_COMPETITION_SEASON_CONFIG.IS_THIS
*
* @param isThis the value for BILLIARDS_USER_COMPETITION_SEASON_CONFIG.IS_THIS
*
* @mbg.generated Sat Jul 06 17:45:02 CST 2019
*/
public void setIsThis(Integer isThis) {
this.isThis = isThis;
}
private Integer start;
private Integer limit;
public Integer getStart(){ return start; }
public void setStart(Integer start){ this.start = start;}
public Integer getLimit(){ return limit; }
public void setLimit(Integer limit){this.limit = limit;}
}
对外开放的时候会封闭住8081 8888 等端口,通过webapp的getaway来调用端口的,所以我们要对每一个接口进行校验,比如下面的addMatchInfo写一个getaway进行调用,判断表的数据结构是否为空,结束时间是否小于开始时间,进行精准校验。