洪城义警-正式版后台
zengh
2022-05-26 4310c19a73f960dfd79c90cfe960cf564b068f72
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
39
40
<?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.springblade.modules.vote.mapper.VoteMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="voteResultMap" type="org.springblade.modules.vote.entity.Vote">
        <id column="id" property="id"/>
        <result column="votename" property="votename"/>
        <result column="introduce" property="introduce"/>
        <result column="uid" property="uid"/>
        <result column="time" property="time"/>
        <result column="type" property="type"/>
        <result column="npeople" property="npeople"/>
    </resultMap>
 
 
    <select id="selectVotePage" resultMap="voteResultMap">
        select * from sys_vote
    </select>
 
    <select id="selectList"  resultType="java.util.HashMap">
        SELECT v.votename,
               v.introduce,
               v.npeople,
               v.time,
               v.type,
               v.uid,
               GROUP_CONCAT(o.optionname) as optionname,
               GROUP_CONCAT(o.num)        as num
        FROM sys_vote v
                 INNER JOIN sys_option o ON v.id = o.voteid
        GROUP BY v.votename,
                 v.introduce,
                 v.npeople,
                 v.time,
                 v.type,
                 v.uid
    </select>
 
</mapper>