updates 抖音新增体育小程序
This commit is contained in:
parent
32aca1b426
commit
29288b22b2
|
|
@ -0,0 +1,178 @@
|
|||
package org.jeecg.modules.yx.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.yx.entity.YxSportsScore;
|
||||
import org.jeecg.modules.yx.service.IYxSportsScoreService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* @Description: 体育成绩表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-07-22
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="体育成绩表")
|
||||
@RestController
|
||||
@RequestMapping("/yx/yxSportsScore")
|
||||
@Slf4j
|
||||
public class YxSportsScoreController extends JeecgController<YxSportsScore, IYxSportsScoreService> {
|
||||
@Autowired
|
||||
private IYxSportsScoreService yxSportsScoreService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param yxSportsScore
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "体育成绩表-分页列表查询")
|
||||
@ApiOperation(value="体育成绩表-分页列表查询", notes="体育成绩表-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<YxSportsScore>> queryPageList(YxSportsScore yxSportsScore,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<YxSportsScore> queryWrapper = QueryGenerator.initQueryWrapper(yxSportsScore, req.getParameterMap());
|
||||
Page<YxSportsScore> page = new Page<YxSportsScore>(pageNo, pageSize);
|
||||
IPage<YxSportsScore> pageList = yxSportsScoreService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param yxSportsScore
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "体育成绩表-添加")
|
||||
@ApiOperation(value="体育成绩表-添加", notes="体育成绩表-添加")
|
||||
@RequiresPermissions("yx:yx_sports_score:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody YxSportsScore yxSportsScore) {
|
||||
yxSportsScoreService.save(yxSportsScore);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param yxSportsScore
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "体育成绩表-编辑")
|
||||
@ApiOperation(value="体育成绩表-编辑", notes="体育成绩表-编辑")
|
||||
@RequiresPermissions("yx:yx_sports_score:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody YxSportsScore yxSportsScore) {
|
||||
yxSportsScoreService.updateById(yxSportsScore);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "体育成绩表-通过id删除")
|
||||
@ApiOperation(value="体育成绩表-通过id删除", notes="体育成绩表-通过id删除")
|
||||
@RequiresPermissions("yx:yx_sports_score:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
yxSportsScoreService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "体育成绩表-批量删除")
|
||||
@ApiOperation(value="体育成绩表-批量删除", notes="体育成绩表-批量删除")
|
||||
@RequiresPermissions("yx:yx_sports_score:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.yxSportsScoreService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "体育成绩表-通过id查询")
|
||||
@ApiOperation(value="体育成绩表-通过id查询", notes="体育成绩表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<YxSportsScore> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
YxSportsScore yxSportsScore = yxSportsScoreService.getById(id);
|
||||
if(yxSportsScore==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(yxSportsScore);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param yxSportsScore
|
||||
*/
|
||||
@RequiresPermissions("yx:yx_sports_score:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, YxSportsScore yxSportsScore) {
|
||||
return super.exportXls(request, yxSportsScore, YxSportsScore.class, "体育成绩表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("yx:yx_sports_score:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, YxSportsScore.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package org.jeecg.modules.yx.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 体育成绩表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-07-22
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("yx_sports_score")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="yx_sports_score对象", description="体育成绩表")
|
||||
public class YxSportsScore implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**年份*/
|
||||
@Excel(name = "年份", width = 15)
|
||||
@ApiModelProperty(value = "年份")
|
||||
private java.lang.Integer year;
|
||||
/**省份*/
|
||||
@Excel(name = "省份", width = 15)
|
||||
@ApiModelProperty(value = "省份")
|
||||
private java.lang.String province;
|
||||
/**性别*/
|
||||
@Excel(name = "性别", width = 15)
|
||||
@ApiModelProperty(value = "性别")
|
||||
private java.lang.String sex;
|
||||
/**分值*/
|
||||
@Excel(name = "分值", width = 15)
|
||||
@ApiModelProperty(value = "分值")
|
||||
private java.math.BigDecimal points;
|
||||
/**100米跑*/
|
||||
@Excel(name = "100米跑", width = 15)
|
||||
@ApiModelProperty(value = "100米跑")
|
||||
private java.math.BigDecimal sprint;
|
||||
/**立定跳远*/
|
||||
@Excel(name = "立定跳远", width = 15)
|
||||
@ApiModelProperty(value = "立定跳远")
|
||||
private java.math.BigDecimal jump;
|
||||
/**推铅球*/
|
||||
@Excel(name = "推铅球", width = 15)
|
||||
@ApiModelProperty(value = "推铅球")
|
||||
private java.math.BigDecimal shotPut;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package org.jeecg.modules.yx.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.yx.entity.YxSportsScore;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 体育成绩表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-07-22
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface YxSportsScoreMapper extends BaseMapper<YxSportsScore> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?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="org.jeecg.modules.yx.mapper.YxSportsScoreMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package org.jeecg.modules.yx.service;
|
||||
|
||||
import org.jeecg.modules.yx.entity.YxSportsScore;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Description: 体育成绩表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-07-22
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IYxSportsScoreService extends IService<YxSportsScore> {
|
||||
|
||||
/**
|
||||
* 获取100米跑分值
|
||||
* @param year 年份
|
||||
* @param sex 性别
|
||||
* @param sprint 100米成绩
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getSprintPoints(Integer year, String sex, BigDecimal sprint);
|
||||
|
||||
/**
|
||||
* 获取立定跳远分值
|
||||
* @param year 年份
|
||||
* @param sex 性别
|
||||
* @param jump 立定跳远
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getJumpPoints(Integer year, String sex, BigDecimal jump);
|
||||
|
||||
/**
|
||||
* 获取推铅球分值
|
||||
* @param year 年份
|
||||
* @param sex 性别
|
||||
* @param shotPut 推铅球成绩
|
||||
* @return
|
||||
*/
|
||||
BigDecimal getShotPutPoints(Integer year, String sex, BigDecimal shotPut);
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package org.jeecg.modules.yx.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.jeecg.modules.yx.constant.YxConstant;
|
||||
import org.jeecg.modules.yx.entity.YxSportsScore;
|
||||
import org.jeecg.modules.yx.mapper.YxSportsScoreMapper;
|
||||
import org.jeecg.modules.yx.service.IYxSportsScoreService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Description: 体育成绩表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-07-22
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class YxSportsScoreServiceImpl extends ServiceImpl<YxSportsScoreMapper, YxSportsScore> implements IYxSportsScoreService {
|
||||
|
||||
@Override
|
||||
public BigDecimal getSprintPoints(Integer year, String sex, BigDecimal sprint) {
|
||||
LambdaQueryWrapper<YxSportsScore> scoreLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
scoreLambdaQueryWrapper.eq(YxSportsScore::getYear,year);
|
||||
scoreLambdaQueryWrapper.eq(YxSportsScore::getSex,sex);
|
||||
scoreLambdaQueryWrapper.ge(YxSportsScore::getSprint,sprint);
|
||||
scoreLambdaQueryWrapper.orderByAsc(YxSportsScore::getSprint);
|
||||
scoreLambdaQueryWrapper.last("limit 0,1");
|
||||
YxSportsScore sportsScore = this.getOne(scoreLambdaQueryWrapper);
|
||||
if (sportsScore != null) {
|
||||
return sportsScore.getPoints();
|
||||
}
|
||||
return YxConstant.bigDecimal0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getJumpPoints(Integer year, String sex, BigDecimal jump) {
|
||||
LambdaQueryWrapper<YxSportsScore> scoreLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
scoreLambdaQueryWrapper.eq(YxSportsScore::getYear,year);
|
||||
scoreLambdaQueryWrapper.eq(YxSportsScore::getSex,sex);
|
||||
scoreLambdaQueryWrapper.le(YxSportsScore::getJump,jump);
|
||||
scoreLambdaQueryWrapper.orderByDesc(YxSportsScore::getJump);
|
||||
scoreLambdaQueryWrapper.last("limit 1");
|
||||
YxSportsScore sportsScore = this.getOne(scoreLambdaQueryWrapper);
|
||||
if (sportsScore != null) {
|
||||
return sportsScore.getPoints();
|
||||
}
|
||||
return YxConstant.bigDecimal0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getShotPutPoints(Integer year, String sex, BigDecimal shotPut) {
|
||||
LambdaQueryWrapper<YxSportsScore> scoreLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
scoreLambdaQueryWrapper.eq(YxSportsScore::getYear,year);
|
||||
scoreLambdaQueryWrapper.eq(YxSportsScore::getSex,sex);
|
||||
scoreLambdaQueryWrapper.le(YxSportsScore::getShotPut,shotPut);
|
||||
scoreLambdaQueryWrapper.orderByDesc(YxSportsScore::getShotPut);
|
||||
scoreLambdaQueryWrapper.last("limit 1");
|
||||
YxSportsScore sportsScore = this.getOne(scoreLambdaQueryWrapper);
|
||||
if (sportsScore != null) {
|
||||
return sportsScore.getPoints();
|
||||
}
|
||||
return YxConstant.bigDecimal0;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue