This commit is contained in:
2025-11-24 16:01:45 +08:00
parent aa160793e7
commit 46c975591b
45 changed files with 1311 additions and 559 deletions

View File

@@ -77,6 +77,7 @@ public class ScoreRoomDetailController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody ScoreRoomDetail scoreRoomDetail)
{
System.out.println(scoreRoomDetail);
return toAjax(scoreRoomDetailService.insertScoreRoomDetail(scoreRoomDetail));
}
@@ -88,6 +89,8 @@ public class ScoreRoomDetailController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody ScoreRoomDetail scoreRoomDetail)
{
System.out.println(scoreRoomDetail);
return toAjax(scoreRoomDetailService.updateScoreRoomDetail(scoreRoomDetail));
}

View File

@@ -1,4 +1,4 @@
package com.ruoyi.system.controller;
package com.ruoyi.web.controller.scoring;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
@@ -77,6 +77,7 @@ public class ScoreUserController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody ScoreUser scoreUser)
{
System.out.println(scoreUser);
return toAjax(scoreUserService.insertScoreUser(scoreUser));
}

View File

@@ -0,0 +1,104 @@
package com.ruoyi.web.controller.scoring;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.ScoringAdomain;
import com.ruoyi.system.service.IScoringAdomainService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 测试Controller
*
* @author ruoyi
* @date 2025-11-24
*/
@RestController
@RequestMapping("/system/adomain")
public class ScoringAdomainController extends BaseController
{
@Autowired
private IScoringAdomainService scoringAdomainService;
/**
* 查询测试列表
*/
@PreAuthorize("@ss.hasPermi('system:adomain:list')")
@GetMapping("/list")
public TableDataInfo list(ScoringAdomain scoringAdomain)
{
startPage();
List<ScoringAdomain> list = scoringAdomainService.selectScoringAdomainList(scoringAdomain);
return getDataTable(list);
}
/**
* 导出测试列表
*/
@PreAuthorize("@ss.hasPermi('system:adomain:export')")
@Log(title = "测试", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ScoringAdomain scoringAdomain)
{
List<ScoringAdomain> list = scoringAdomainService.selectScoringAdomainList(scoringAdomain);
ExcelUtil<ScoringAdomain> util = new ExcelUtil<ScoringAdomain>(ScoringAdomain.class);
util.exportExcel(response, list, "测试数据");
}
/**
* 获取测试详细信息
*/
@PreAuthorize("@ss.hasPermi('system:adomain:query')")
@GetMapping(value = "/{name}")
public AjaxResult getInfo(@PathVariable("name") String name)
{
return success(scoringAdomainService.selectScoringAdomainByName(name));
}
/**
* 新增测试
*/
@PreAuthorize("@ss.hasPermi('system:adomain:add')")
@Log(title = "测试", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ScoringAdomain scoringAdomain)
{
return toAjax(scoringAdomainService.insertScoringAdomain(scoringAdomain));
}
/**
* 修改测试
*/
@PreAuthorize("@ss.hasPermi('system:adomain:edit')")
@Log(title = "测试", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ScoringAdomain scoringAdomain)
{
return toAjax(scoringAdomainService.updateScoringAdomain(scoringAdomain));
}
/**
* 删除测试
*/
@PreAuthorize("@ss.hasPermi('system:adomain:remove')")
@Log(title = "测试", businessType = BusinessType.DELETE)
@DeleteMapping("/{names}")
public AjaxResult remove(@PathVariable String[] names)
{
return toAjax(scoringAdomainService.deleteScoringAdomainByNames(names));
}
}

View File

@@ -0,0 +1,14 @@
-- 创建scoring_adomain表
CREATE TABLE IF NOT EXISTS scoring_adomain (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '主键ID',
name VARCHAR(255) DEFAULT NULL COMMENT '名称',
age INT DEFAULT NULL COMMENT '年龄',
create_by VARCHAR(64) DEFAULT '' COMMENT '创建者',
create_time DATETIME DEFAULT NULL COMMENT '创建时间',
update_by VARCHAR(64) DEFAULT '' COMMENT '更新者',
update_time DATETIME DEFAULT NULL COMMENT '更新时间',
remark VARCHAR(500) DEFAULT NULL COMMENT '备注'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='计分系统域名表';
-- 插入示例数据
INSERT INTO scoring_adomain (name, age) VALUES ('测试名称', 25) ON DUPLICATE KEY UPDATE name='测试名称', age=25;

View File

@@ -0,0 +1,53 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 测试对象 scoring_adomain
*
* @author ruoyi
* @date 2025-11-24
*/
public class ScoringAdomain extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 名字 */
@Excel(name = "名字")
private String name;
/** 年龄 */
@Excel(name = "年龄")
private Long age;
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setAge(Long age)
{
this.age = age;
}
public Long getAge()
{
return age;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("name", getName())
.append("age", getAge())
.toString();
}
}

View File

@@ -0,0 +1,45 @@
package com.ruoyi.system.domain.vo;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 分数房间详情VO类用于接收前端提交的复杂数据结构
*
* @author ruoyi
* @date 2025-10-30
*/
@Data
public class ScoreRoomDetailVO {
/** 房间id */
private Long roomId;
/** 玩家列表 */
private List<PlayerScoreVO> players;
/** 局数 */
private Integer roundCount;
/** 创建时间 */
private Date createTime;
/** 玩家分数VO类 */
@Data
public static class PlayerScoreVO {
/** 玩家id */
private String playerId;
/** 玩家名称 */
private String playerName;
/** 玩家头像 */
private String avatar;
/** 总分 */
private Integer totalScore;
/** 每局分数 */
private List<Integer> roundScores;
}
}

View File

@@ -58,4 +58,12 @@ public interface ScoreRoomDetailMapper
* @return 结果
*/
public int deleteScoreRoomDetailByDetailIds(Long[] detailIds);
/**
* 批量新增分数记录
*
* @param scoreRoomDetails 分数记录集合
* @return 结果
*/
public int batchInsertScoreRoomDetail(List<ScoreRoomDetail> scoreRoomDetails);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.ScoringAdomain;
/**
* 测试Mapper接口
*
* @author ruoyi
* @date 2025-11-24
*/
public interface ScoringAdomainMapper
{
/**
* 查询测试
*
* @param name 测试主键
* @return 测试
*/
public ScoringAdomain selectScoringAdomainByName(String name);
/**
* 查询测试列表
*
* @param scoringAdomain 测试
* @return 测试集合
*/
public List<ScoringAdomain> selectScoringAdomainList(ScoringAdomain scoringAdomain);
/**
* 新增测试
*
* @param scoringAdomain 测试
* @return 结果
*/
public int insertScoringAdomain(ScoringAdomain scoringAdomain);
/**
* 修改测试
*
* @param scoringAdomain 测试
* @return 结果
*/
public int updateScoringAdomain(ScoringAdomain scoringAdomain);
/**
* 删除测试
*
* @param name 测试主键
* @return 结果
*/
public int deleteScoringAdomainByName(String name);
/**
* 批量删除测试
*
* @param names 需要删除的数据主键集合
* @return 结果
*/
public int deleteScoringAdomainByNames(String[] names);
}

View File

@@ -58,4 +58,12 @@ public interface IScoreRoomDetailService
* @return 结果
*/
public int deleteScoreRoomDetailByDetailId(Long detailId);
/**
* 批量新增分数记录
*
* @param scoreRoomDetails 分数记录集合
* @return 结果
*/
public int batchInsertScoreRoomDetail(List<ScoreRoomDetail> scoreRoomDetails);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.ScoringAdomain;
/**
* 测试Service接口
*
* @author ruoyi
* @date 2025-11-24
*/
public interface IScoringAdomainService
{
/**
* 查询测试
*
* @param name 测试主键
* @return 测试
*/
public ScoringAdomain selectScoringAdomainByName(String name);
/**
* 查询测试列表
*
* @param scoringAdomain 测试
* @return 测试集合
*/
public List<ScoringAdomain> selectScoringAdomainList(ScoringAdomain scoringAdomain);
/**
* 新增测试
*
* @param scoringAdomain 测试
* @return 结果
*/
public int insertScoringAdomain(ScoringAdomain scoringAdomain);
/**
* 修改测试
*
* @param scoringAdomain 测试
* @return 结果
*/
public int updateScoringAdomain(ScoringAdomain scoringAdomain);
/**
* 批量删除测试
*
* @param names 需要删除的测试主键集合
* @return 结果
*/
public int deleteScoringAdomainByNames(String[] names);
/**
* 删除测试信息
*
* @param name 测试主键
* @return 结果
*/
public int deleteScoringAdomainByName(String name);
}

View File

@@ -90,4 +90,10 @@ public class ScoreRoomDetailServiceImpl implements IScoreRoomDetailService
{
return scoreRoomDetailMapper.deleteScoreRoomDetailByDetailId(detailId);
}
@Override
public int batchInsertScoreRoomDetail(List<ScoreRoomDetail> scoreRoomDetails)
{
return scoreRoomDetailMapper.batchInsertScoreRoomDetail(scoreRoomDetails);
}
}

View File

@@ -0,0 +1,93 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ScoringAdomainMapper;
import com.ruoyi.system.domain.ScoringAdomain;
import com.ruoyi.system.service.IScoringAdomainService;
/**
* 测试Service业务层处理
*
* @author ruoyi
* @date 2025-11-24
*/
@Service
public class ScoringAdomainServiceImpl implements IScoringAdomainService
{
@Autowired
private ScoringAdomainMapper scoringAdomainMapper;
/**
* 查询测试
*
* @param name 测试主键
* @return 测试
*/
@Override
public ScoringAdomain selectScoringAdomainByName(String name)
{
return scoringAdomainMapper.selectScoringAdomainByName(name);
}
/**
* 查询测试列表
*
* @param scoringAdomain 测试
* @return 测试
*/
@Override
public List<ScoringAdomain> selectScoringAdomainList(ScoringAdomain scoringAdomain)
{
return scoringAdomainMapper.selectScoringAdomainList(scoringAdomain);
}
/**
* 新增测试
*
* @param scoringAdomain 测试
* @return 结果
*/
@Override
public int insertScoringAdomain(ScoringAdomain scoringAdomain)
{
return scoringAdomainMapper.insertScoringAdomain(scoringAdomain);
}
/**
* 修改测试
*
* @param scoringAdomain 测试
* @return 结果
*/
@Override
public int updateScoringAdomain(ScoringAdomain scoringAdomain)
{
return scoringAdomainMapper.updateScoringAdomain(scoringAdomain);
}
/**
* 批量删除测试
*
* @param names 需要删除的测试主键
* @return 结果
*/
@Override
public int deleteScoringAdomainByNames(String[] names)
{
return scoringAdomainMapper.deleteScoringAdomainByNames(names);
}
/**
* 删除测试信息
*
* @param name 测试主键
* @return 结果
*/
@Override
public int deleteScoringAdomainByName(String name)
{
return scoringAdomainMapper.deleteScoringAdomainByName(name);
}
}

View File

@@ -78,4 +78,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{detailId}
</foreach>
</delete>
<insert id="batchInsertScoreRoomDetail" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="detailId">
insert into score_room_detail (room_id, user_id, score, created_time, detail_type, getter_id)
values
<foreach item="detail" collection="list" separator=",">
(#{detail.roomId}, #{detail.userId}, #{detail.score}, #{detail.createdTime}, #{detail.detailType}, #{detail.getterId})
</foreach>
</insert>
</mapper>

View File

@@ -0,0 +1,59 @@
<?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.ruoyi.system.mapper.ScoringAdomainMapper">
<resultMap type="ScoringAdomain" id="ScoringAdomainResult">
<result property="name" column="name" />
<result property="age" column="age" />
</resultMap>
<sql id="selectScoringAdomainVo">
select name, age from scoring_adomain
</sql>
<select id="selectScoringAdomainList" parameterType="ScoringAdomain" resultMap="ScoringAdomainResult">
<include refid="selectScoringAdomainVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="age != null "> and age = #{age}</if>
</where>
</select>
<select id="selectScoringAdomainByName" parameterType="String" resultMap="ScoringAdomainResult">
<include refid="selectScoringAdomainVo"/>
where name = #{name}
</select>
<insert id="insertScoringAdomain" parameterType="ScoringAdomain">
insert into scoring_adomain
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="age != null">age,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="age != null">#{age},</if>
</trim>
</insert>
<update id="updateScoringAdomain" parameterType="ScoringAdomain">
update scoring_adomain
<trim prefix="SET" suffixOverrides=",">
<if test="age != null">age = #{age},</if>
</trim>
where name = #{name}
</update>
<delete id="deleteScoringAdomainByName" parameterType="String">
delete from scoring_adomain where name = #{name}
</delete>
<delete id="deleteScoringAdomainByNames" parameterType="String">
delete from scoring_adomain where name in
<foreach item="name" collection="array" open="(" separator="," close=")">
#{name}
</foreach>
</delete>
</mapper>