<?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.content AS "content",
		a.old_salary AS "oldSalray",
		a.new_salary AS "newSalary",
		a.exe_date AS "exeDate",
		a.create_by_id AS "createBy.id",
		a.create_time AS "createTime",
		a.update_by_id AS "updateBy.id",
		a.update_time AS "updateTime",
		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>
