<?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.stylefeng.guns.modular.system.dao.PhoneMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Phone">
|
<id column="id" property="id" />
|
<result column="type" property="type" />
|
<result column="platform" property="platform"/>
|
<result column="phone" property="phone" />
|
<result column="companyId" property="companyId"/>
|
</resultMap>
|
|
|
|
<select id="queryPhones" resultType="Phone">
|
select
|
id as id,
|
type as type,
|
platform as platform,
|
phone as phone,
|
companyId as companyId
|
from t_phone where companyId in (
|
select companyId from t_company_city where state = 1
|
<if test="null != province">
|
and provinceCode = #{province}
|
</if>
|
<if test="null != city">
|
and cityCode = #{city}
|
</if>
|
<if test="null != code">
|
and areaCode = #{code}
|
</if>
|
)
|
</select>
|
|
|
<select id="query" resultType="Phone">
|
select
|
id as id,
|
type as type,
|
platform as platform,
|
phone as phone,
|
companyId as companyId
|
from t_phone where 1 = 1
|
<if test="null != type">
|
and type = #{type}
|
</if>
|
<if test="null != platform">
|
and platform = #{platform}
|
</if>
|
<if test="platform != 1">
|
and companyId in (
|
select companyId from t_company_city where state = 1
|
<if test="null != province">
|
and provinceCode = #{province}
|
</if>
|
<if test="null != city">
|
and cityCode = #{city}
|
</if>
|
<if test="null != code">
|
and areaCode = #{code}
|
</if>
|
)
|
</if>
|
</select>
|
|
</mapper>
|