puzhibing
2023-07-10 f95325fd2635a9af08c0acac70e70379978d128a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?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.dsh.competition.mapper.CompetitionMapper">
 
 
    <select id="queryCompetitionList" resultType="com.dsh.competition.model.CompetitionListVo">
        select * from (
            select
            a.id,
            a.`name`,
            a.coverDrawing,
            a.city as cityName,
            a.registerCondition,
            a.introduction,
            DATE_FORMAT(a.registerEndTime, '%Y-%m-%d %H:%i') as registerEndTime,
            CONCAT(a.startAge, '-', a.endAge) as age,
            a.baseNumber + a.applicantsNumber as heat
            from t_competition a
            where a.auditStatus = 2 and a.`status` = 2 and a.state = 1
            <if test="null != cityCode and '' != cityCode">
                and a.cityCode = #{cityCode}
            </if>
            <if test="null != content and '' != content">
                and a.name like CONCAT('%', #{content}, '%')
            </if>
            <if test="null != registerCondition">
                and a.registerCondition = #{registerCondition}
            </if>
            order by a.insertTime desc
        ) as aa
        <if test="null != heat 1 == heat">
            order by aa.heat
        </if>
        <if test="null != heat 2 == heat">
            order by aa.heat desc
        </if>
    </select>
</mapper>