<?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.CompanyFundFlowMapper">
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.CompanyFundFlow">
|
<id column="id" property="id"/>
|
<result column="type" property="type"/>
|
<result column="objectType" property="objectType"/>
|
<result column="objectId" property="objectId"/>
|
<result column="balance" property="balance"/>
|
<result column="money" property="money"/>
|
<result column="createTime" property="createTime"/>
|
</resultMap>
|
|
|
|
<select id="queryCompanyFundFlow" resultType="map">
|
select
|
a.id,
|
DATE_FORMAT(a.createTime, '%Y-%m-%d %H:%i') as createTime,
|
a.type,
|
b.`name` as driverName,
|
a.money,
|
a.money + a.balance as balance
|
from t_company_fund_flow a
|
left join t_driver b on (a.driverId = b.id)
|
where 1 = 1
|
<if test="null != role and 1 == role">
|
and a.objectType = 1
|
</if>
|
<if test="null != role and 2 == role">
|
and a.objectType = 2 and a.objectId = #{id}
|
</if>
|
<if test="null != type">
|
and a.type = #{type}
|
</if>
|
<if test="null != startTime and '' != startTime and null != endTime and '' != endTime">
|
and DATE_FORMAT(a.createTime, '%Y-%m-%d %H:%i') between #{startTime} and #{endTime}
|
</if>
|
order by a.createTime desc
|
</select>
|
</mapper>
|