于紫祥_1901
2020-08-13 72bfd6cfe47b48a183ea3795054dabdcffb543d7
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
41
42
43
44
45
46
47
48
49
50
51
52
<?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.moral.mapper.AccountRoleMapper">
 
    <resultMap id="ResultMap" type="com.moral.entity.AccountRole" >
        <id column="id" property="id" jdbcType="INTEGER" />
        <result column="account_id" property="accountId" jdbcType="INTEGER" />
        <result column="role_id" property="roleId" jdbcType="INTEGER" />
    </resultMap>
 
    <resultMap id="BaseResultMap" type="com.moral.entity.AccountRole" extends="ResultMap">
        <association property="account" javaType="com.moral.entity.Account">
            <result column="account_id" jdbcType="INTEGER" property="id" />
            <result column="account_name" jdbcType="VARCHAR" property="accountName" />
        </association>
        <association property="role" javaType="com.moral.entity.Role">
            <result column="role_id" property="id" jdbcType="INTEGER" />
            <result column="role_name" property="roleName" jdbcType="VARCHAR" />
        </association>
    </resultMap>
 
    <sql id="Example_Where_Clause" >
        <where >
            <foreach collection="oredCriteria" item="criteria" separator="or" >
                <if test="criteria.valid" >
                    <trim prefix="(" suffix=")" prefixOverrides="and" >
                        <foreach collection="criteria.criteria" item="criterion" >
                            <choose >
                                <when test="criterion.noValue" >
                                    and ${criterion.condition}
                                </when>
                                <when test="criterion.singleValue" >
                                    and ${criterion.condition} #{criterion.value}
                                </when>
                                <when test="criterion.betweenValue" >
                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                                </when>
                                <when test="criterion.listValue" >
                                    and ${criterion.condition}
                                    <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                                        #{listItem}
                                    </foreach>
                                </when>
                            </choose>
                        </foreach>
                    </trim>
                </if>
            </foreach>
        </where>
    </sql>
 
</mapper>