<?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.jeeplus.test.mobile.mapper.TestMobileMapper">

	<sql id="testMobileColumns">
		a.id AS "id",
		a.name AS "name",
		a.age AS "age",
		a.area AS "area",
		a.company_id AS "company.id",
		a.office_id AS "office.id",
		a.sex AS "sex",
		a.te_image AS "teImage",
		a.is_single AS "isSingle",
		a.cks AS "cks",
		a.text_area AS "textArea",
		a.text_number AS "textNumber",
		a.te_date AS "teDate",
		a.email AS "email",
		a.phone AS "phone",
		a.tel AS "tel",
		a.create_by_id AS "createBy",
		a.create_time AS "createDate",
		a.update_by_id AS "updateBy",
		a.update_time AS "updateDate",
		a.del_flag AS "delFlag",
		a.tenant_id AS "tenantId",
		company.name AS "company.name",
		office.name AS "office.name"
	</sql>

	<sql id="testMobileJoins">

		LEFT JOIN sys_office company ON company.id = a.company_id
		LEFT JOIN sys_office office ON office.id = a.office_id
	</sql>



	<select id="findById" resultType="com.jeeplus.test.mobile.service.dto.TestMobileDTO">
		SELECT
			<include refid="testMobileColumns"/>
		FROM test_mobile a
		<include refid="testMobileJoins"/>
		WHERE a.id = #{id} and a.del_flag = 0
	</select>

	<select id="findList" resultType="com.jeeplus.test.mobile.service.dto.TestMobileDTO">
		SELECT
			<include refid="testMobileColumns"/>
		FROM test_mobile a
		<include refid="testMobileJoins"/>
	    ${ew.customSqlSegment}
	</select>

</mapper>
