<?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.activiti.mapper.TestActivitiAuditMapper">

	<sql id="testActivitiAuditColumns">
		a.id AS "id",
		a.proc_ins_id AS "procInsId",
		a.user_id AS "user.id",
		a.office_id AS "office.id",
		a.post AS "post",
		a.sex AS "sex",
		a.edu AS "edu",
		a.content AS "content",
		a.olda AS "olda",
		a.oldb AS "oldb",
		a.oldc AS "oldc",
		a.newa AS "newa",
		a.newb AS "newb",
		a.newc AS "newc",
		a.add_num AS "addNum",
		a.exe_date AS "exeDate",
		a.create_by AS "createBy.id",
		a.create_date AS "createDate",
		a.update_by AS "updateBy.id",
		a.update_date AS "updateDate",
		a.remarks AS "remarks",
		a.del_flag AS "delFlag",


		user.name AS "user.name",

		office.name AS "office.name"
	</sql>

	<sql id="testActivitiAuditJoins">

		LEFT JOIN sys_user user ON user.id = a.user_id
		LEFT JOIN sys_office office ON office.id = a.office_id
	</sql>



	<select id="findById" resultType="com.jeeplus.test.activiti.service.dto.TestActivitiAuditDTO">
		SELECT
			<include refid="testActivitiAuditColumns"/>
		FROM test_activiti_audit a
		<include refid="testActivitiAuditJoins"/>
		WHERE a.id = #{id} and a.del_flag = 0
	</select>

	<select id="findList" resultType="com.jeeplus.test.activiti.service.dto.TestActivitiAuditDTO" >
		SELECT
			<include refid="testActivitiAuditColumns"/>
		FROM test_activiti_audit a
		<include refid="testActivitiAuditJoins"/>
	    ${ew.customSqlSegment}
	</select>

</mapper>
