12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?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.management.platform.mapper.ExpenseItemMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.management.platform.entity.ExpenseItem">
- <id column="id" property="id" />
- <result column="expense_id" property="expenseId" />
- <result column="project_id" property="projectId" />
- <result column="happen_date" property="happenDate" />
- <result column="invoice_type" property="invoiceType" />
- <result column="invoice_no" property="invoiceNo" />
- <result column="tax_percent" property="taxPercent" />
- <result column="tax_value" property="taxValue" />
- <result column="amount" property="amount" />
- <result column="remark" property="remark" />
- <result column="expense_type" property="expenseType" />
- <result column="pic" property="pic" />
- <result column="status" property="status" />
- </resultMap>
- <resultMap id="UserBaseResultMap" type="com.management.platform.entity.vo.ExpenseItemVO">
- <id column="id" property="id" />
- <result column="expense_id" property="expenseId" />
- <result column="project_id" property="projectId" />
- <result column="happen_date" property="happenDate" />
- <result column="invoice_type" property="invoiceType" />
- <result column="invoice_no" property="invoiceNo" />
- <result column="tax_percent" property="taxPercent" />
- <result column="tax_value" property="taxValue" />
- <result column="amount" property="amount" />
- <result column="remark" property="remark" />
- <result column="expense_type" property="expenseType" />
- <result column="pic" property="pic" />
- <result column="status" property="status" />
- <result column="username" property="username" />
- <result column="department_name" property="departmentName" />
- <result column="corpwxUserId" property="corpwxUserId" />
- <result column="corpwxDeptId" property="corpwxDeptId" />
- <result column="corpDdDeptId" property="corpDdDeptId" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, expense_id, project_id, happen_date, invoice_type, invoice_no, tax_percent, tax_value, amount, remark, expense_type, pic, status
- </sql>
- <select id="getUserExpenseDetail" resultMap="UserBaseResultMap">
- select a.id, a.expense_id, a.project_id, a.happen_date, a.invoice_type, a.tax_percent, a.tax_value, a.amount, a.remark, a.expense_type, a.pic,a.status,
- user.name as username,user.corpwx_userid as corpwxUserId, department.department_name,department.corpwx_deptid as corpwxDeptId,department.dd_deptid as corpDdDeptId
- from expense_item a
- left join expense_sheet b on a.expense_id = b.id
- left join user on user.id = b.owner_id
- left join department on department.department_id = user.department_id
- where a.project_id = #{projectId} and b.status=0 order by a.happen_date desc
- </select>
- <select id="selectExpenseByProject" resultType="java.lang.Double">
- select IFNULL(sum(expense_item.amount),0)
- from expense_item
- left join expense_sheet on expense_sheet.id = expense_item.expense_id
- where expense_item.project_id = #{projectId}
- <if test="startDate!=null and endDate!=null">
- and happen_date between #{startDate} and #{endDate}
- </if>
- and expense_item.amount is not null
- and expense_sheet.status = 0
- <if test="type!=null">
- and expense_sheet.type = #{type}
- </if>
- </select>
- <select id="selectSumAmountByProjectAndType" resultType="java.lang.Double">
- select IFNULL(sum(expense_item.amount),0)
- from expense_item
- left join expense_sheet on expense_sheet.id = expense_item.expense_id
- where expense_item.project_id = #{projectId}
- and expense_item.amount is not null
- and expense_sheet.status <= 1
- and expense_sheet.type = #{type}
- </select>
- </mapper>
|