puzhibing
2024-03-04 7e7f901b2172281dc294dfbc67e6ad00625f09f4
合并代码
5个文件已修改
1个文件已添加
145 ■■■■■ 已修改文件
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupListAll.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java
@@ -508,4 +508,16 @@
        return worldCupCompetitorService.count(new QueryWrapper<WorldCupCompetitor>()
                .eq("participantId", studentId).eq("participantType", 1).eq("matchResult", 1));
    }
    /**
     * 获取比赛管理列表数据
     * @param worldCupListAll
     * @return
     */
    @ResponseBody
    @PostMapping("/worldCup/getWorldCupListAll")
    public Map<String, Object> getWorldCupListAll(@RequestBody WorldCupListAll worldCupListAll){
        return worldCupService.getWorldCupListAll(worldCupListAll);
    }
}
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupMapper.java
@@ -6,6 +6,7 @@
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
 * @author zhibing.pu
@@ -37,4 +38,16 @@
     */
    WorldCupInfo getWorldCupInfo(@Param("id") Integer id);
    /**
     * 获取比赛管理列表数据
     * @param worldCupListAll
     * @return
     */
    List<Map<String, Object>> getWorldCupListAll(@Param("item") WorldCupListAll worldCupListAll);
    Integer getWorldCupListAllCount(@Param("item") WorldCupListAll worldCupListAll);
}
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupListAll.java
New file
@@ -0,0 +1,35 @@
package com.dsh.communityWorldCup.model;
import lombok.Data;
/**
 * @author zhibing.pu
 * @date 2024/3/2 11:01
 */
@Data
public class WorldCupListAll {
    /**
     * 比赛名称
     */
    private String name;
    /**
     * 开始时间
     */
    private String startTime;
    /**
     * 结束时间
     */
    private String endTime;
    /**
     * 比赛状态(1=未开始,2=已开始,3=已结束,4=已取消)
     */
    private Integer status;
    /**
     * 页码
     */
    private Integer offset;
    /**
     * 页条数
     */
    private Integer limit;
}
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupService.java
@@ -7,6 +7,7 @@
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.Map;
/**
 * @author zhibing.pu
@@ -77,4 +78,12 @@
     * @return
     */
    ResultUtil paymentWorldCupCallback(String code, String outTradeNo);
    /**
     * 获取比赛管理列表数据
     * @param worldCupListAll
     * @return
     */
    Map<String, Object> getWorldCupListAll(WorldCupListAll worldCupListAll);
}
cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java
@@ -547,4 +547,31 @@
        }
        return ResultUtil.success();
    }
    /**
     * 获取比赛管理列表数据
     * @param worldCupListAll
     * @return
     */
    @Override
    public Map<String, Object> getWorldCupListAll(WorldCupListAll worldCupListAll) {
        Map<String, Object> map = new HashMap<>();
        List<Map<String, Object>> list = this.baseMapper.getWorldCupListAll(worldCupListAll);
        for (Map<String, Object> map1 : list) {
            String maxPeople = map1.get("maxPeople").toString();
            Integer id = Integer.valueOf(map1.get("id").toString());
            List<WorldCupPayment> lists = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", id).eq("payStatus", 2).eq("state", 1));
            List<Long> collect = lists.stream().map(WorldCupPayment::getId).collect(Collectors.toList());
            Integer count = 0;
            if(collect.size() > 0){
                count = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>().in("worldCupPaymentId", collect));
            }
            map1.put("maxPeople", maxPeople + " - " + count);
        }
        Integer count = this.baseMapper.getWorldCupListAllCount(worldCupListAll);
        map.put("rows", list);
        map.put("total", count);
        return map;
    }
}
cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml
@@ -71,4 +71,53 @@
        from t_world_cup  a
        where a.id = #{id}
    </select>
    <select id="getWorldCupListAll" resultType="map">
        select
        id,
        `name`,
        DATE_FORMAT(startTime, '%Y.%m.%d %H:%i') as startTime,
        DATE_FORMAT(endTime, '%Y.%m.%d %H:%i') as endTime,
        CONCAT(startAge, '至', endAge) as age,
        gender,
        maxPeople,
        status
        from t_world_cup
        where 1 = 1
        <if test="null != item.name and '' != item.name">
            and `name` like CONCAT('%', #{item.name}, '%')
        </if>
        <if test="null != item.startTime and '' != item.startTime">
            and DATE_FORMAT(startTime, '%Y-%m-%d') &gt;= #{item.startTime}
        </if>
        <if test="null != item.endTime and '' != item.endTime">
            and DATE_FORMAT(endTime, '%Y-%m-%d') &lt;= #{item.endTime}
        </if>
        <if test="null != item.status">
            and status= #{item.status}
        </if>
        order by createTime desc limit #{item.offset}, #{item.limit}
    </select>
    <select id="getWorldCupListAllCount" resultType="int">
        select
        count(*)
        from t_world_cup
        where 1 = 1
        <if test="null != item.name and '' != item.name">
            and `name` like CONCAT('%', #{item.name}, '%')
        </if>
        <if test="null != item.startTime and '' != item.startTime">
            and DATE_FORMAT(startTime, '%Y-%m-%d') &gt;= #{item.startTime}
        </if>
        <if test="null != item.endTime and '' != item.endTime">
            and DATE_FORMAT(endTime, '%Y-%m-%d') &lt;= #{item.endTime}
        </if>
        <if test="null != item.status">
            and status= #{item.status}
        </if>
    </select>
</mapper>