AddressMapper.xml
2.24 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
<?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.lframework.xingyun.basedata.mappers.AddressMapper">
  <sql id="Address_sql">
    SELECT
        tb.*
    FROM base_data_address AS tb
  </sql>
  <select id="query" resultType="com.lframework.xingyun.basedata.entity.Address">
    <include refid="Address_sql" />
    <where>
      <if test="vo != null">
        <if test="vo.entityType != null">
          AND tb.entity_type = #{vo.entityType}
        </if>
        <if test="vo.addressType != null">
          AND tb.address_type = #{vo.addressType}
        </if>
        <if test="vo.name != null and vo.name != ''">
          AND tb.name LIKE CONCAT('%', #{vo.name}, '%')
        </if>
        <if test="vo.telephone != null and vo.telephone != ''">
          AND tb.telephone = #{vo.telephone}
        </if>
        <if test="vo.address != null and vo.address != ''">
          AND tb.address LIKE CONCAT('%', #{vo.address}, '%')
        </if>
        <if test="vo.isDefault != null">
          AND tb.is_default = #{vo.isDefault}
        </if>
      </if>
    </where>
    ORDER BY tb.create_time DESC
  </select>
  <select id="selector" resultType="com.lframework.xingyun.basedata.entity.Address">
    <include refid="Address_sql" />
    <where>
      <if test="vo != null">
        <if test="vo.entityId != null and vo.entityId != ''">
          AND tb.entity_id = #{vo.entityId}
        </if>
        <if test="vo.entityType != null">
          AND tb.entity_type = #{vo.entityType}
        </if>
        <if test="vo.addressType != null">
          AND tb.address_type = #{vo.addressType}
        </if>
        <if test="vo.name != null and vo.name != ''">
          AND tb.name LIKE CONCAT('%', #{vo.name}, '%')
        </if>
        <if test="vo.telephone != null and vo.telephone != ''">
          AND tb.telephone = #{vo.telephone}
        </if>
        <if test="vo.address != null and vo.address != ''">
          AND tb.address LIKE CONCAT('%', #{vo.address}, '%')
        </if>
        <if test="vo.isDefault != null">
          AND tb.is_default = #{vo.isDefault}
        </if>
      </if>
    </where>
    ORDER BY tb.create_time DESC
  </select>
</mapper>