puzhibing
2024-03-04 7e7f901b2172281dc294dfbc67e6ad00625f09f4
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>