| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?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.ydtech.modules.admin.dao.SysDeptAccountHistoryMapper">
- <resultMap id="BaseResultMap" type="com.ydtech.modules.admin.model.dto.SysDeptAccountHistoryDto">
- <id column="id" jdbcType="VARCHAR" property="id"/>
- <result column="dept_id" jdbcType="VARCHAR" property="deptId"/>
- <result column="name" jdbcType="VARCHAR" property="deptName"/>
- <result column="amount" jdbcType="DECIMAL" property="amount"/>
- <result column="surplus_amount" jdbcType="DECIMAL" property="surplusAmount"/>
- <result column="documentary" jdbcType="VARCHAR" property="documentary"/>
- <result column="suborder" jdbcType="VARCHAR" property="suborder"/>
- <result column="user_id" jdbcType="VARCHAR" property="userId"/>
- <result column="remark" jdbcType="VARCHAR" property="remark"/>
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
- <result property="createTimeStart" column="createTimeStart" jdbcType="VARCHAR"/>
- <result property="createTimeEnd" column="createTimeEnd" jdbcType="VARCHAR"/>
- </resultMap>
- <select id="getDeptHistory" resultMap="BaseResultMap">
- SELECT
- a.id,
- a.dept_id,
- b.NAME,
- a.amount,
- a.surplus_amount,
- a.documentary,
- a.suborder,
- a.user_id,
- a.remark,
- a.create_time
- FROM
- sys_dept_account_history a
- LEFT JOIN sys_dept b ON a.dept_id = b.id
- where
- b.del_flag = 0
- <if test="sysDeptAccountHistoryDto.deptId != null and sysDeptAccountHistoryDto.deptId != ''">
- AND a.dept_id like concat(#{sysDeptAccountHistoryDto.deptId},'%')
- </if>
- <if test="sysDeptAccountHistoryDto.deptName != null and sysDeptAccountHistoryDto.deptName != ''">
- AND b.name = #{sysDeptAccountHistoryDto.deptName}
- </if>
- <if test="sysDeptAccountHistoryDto.suborder != null and sysDeptAccountHistoryDto.suborder != ''">
- AND a.suborder = #{sysDeptAccountHistoryDto.suborder}
- </if>
- <if test="sysDeptAccountHistoryDto.documentary != null and sysDeptAccountHistoryDto.documentary != ''">
- AND a.documentary = #{sysDeptAccountHistoryDto.documentary}
- </if>
- <if test="sysDeptAccountHistoryDto.createTimeStart != null and sysDeptAccountHistoryDto.createTimeStart != ''">
- and a.create_time >= #{sysDeptAccountHistoryDto.createTimeStart}
- </if>
- <if test="sysDeptAccountHistoryDto.createTimeEnd != null and sysDeptAccountHistoryDto.createTimeEnd != ''">
- and a.create_time <= #{sysDeptAccountHistoryDto.createTimeEnd}
- </if>
- </select>
- <select id="queryAdvanceAndActualDeptDataPage"
- resultType="com.ydtech.modules.admin.model.report.financeData.RevenueAndExpenditureDeptDataDto">
- SELECT
- his.id as id,
- his.amount as "amount",
- DATE_FORMAT(his.create_time, '%Y-%m-%d %H:%i:%s') as "createTime",
- his.dept_id as deptId,
- dept.name as deptName,
- his.auditing_id as auditiingId,
- CASE sda.status
- WHEN '0' THEN '提现中'
- WHEN '1' THEN '已提现'
- WHEN '2' THEN '已驳回'
- ELSE ''
- END AS auditingStatus,
- sda.auditing_time as auditingTime
- FROM
- sys_dept_account_history his
- LEFT JOIN ins_area_company ins ON his.suborder = ins.id
- left join sys_dept dept on dept.id =his.dept_id
- left join sys_dept_account_withdraw sda on sda.id =his.auditing_id
- WHERE
- his.documentary =1
- <if test="vo.deptId !=null and vo.deptId != '' ">
- and his.dept_id = #{vo.deptId}
- </if>
- <if test="vo.startDate !=null and vo.startDate != '' and vo.endDate !=null and vo.endDate != '' ">
- AND his.create_time BETWEEN #{vo.startDate} AND #{vo.endDate}
- </if>
- order by his.create_time desc
- </select>
- </mapper>
|