律所系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.8 KiB

<?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="net.lab1024.sa.admin.module.cost.dao.FirmReportsDao">
<!-- 查询结果列 -->
<sql id="base_columns">
t_firm_reports.id,
t_firm_reports.firm_id as firmId,
t_firm_reports.user_id as userId,
t_firm_reports.declare_year as declareYear,
t_firm_reports.declare_quarter as declareQuarter,
t_firm_reports.revenue as revenue,
t_firm_reports.total_cost as totalCost,
t_firm_reports.public_welfare_cost as publicWelfareCost,
t_firm_reports.cost_income_ratio as costIncomeRatio,
t_firm_reports.approval_status as approvalStatus,
t_firm_reports.submission_time as submissionTime,
t_firm_reports.approver_id as approverId,
t_firm_reports.create_time as createTime,
t_firm_reports.update_time as updateTime,
t_firm_reports.del_flag as delFlag
</sql>
3 months ago
<update id="commit">
UPDATE t_firm_reports
SET approval_status = 3
WHERE id IN
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item}
</foreach>
</update>
<!-- 分页查询 -->
<select id="queryPage" resultType="net.lab1024.sa.admin.module.cost.domain.vo.FirmReportsVO">
SELECT
<include refid="base_columns"/>
FROM t_firm_reports
<where>
del_flag = 0
<if test="queryForm.firmId != null and queryForm.firmId != ''">
AND t_firm_reports.firm_id = #{queryForm.firmId}
</if>
3 months ago
<if test="queryForm.includeSubmitted != null and queryForm.includeSubmitted">
<!-- 如果包含已提交的数据,则查询审批状态>=3的数据(已提交)或用户自己的数据,此时忽略queryForm.userId的单独筛选条件-->
AND (t_firm_reports.approval_status >= 3 OR t_firm_reports.user_id = #{queryForm.userId})
</if>
<if test="queryForm.userId != null and (queryForm.includeSubmitted == null or queryForm.includeSubmitted == false)">
<!-- 只有在未设置includeSubmitted时才使用userId作为过滤条件 -->
AND t_firm_reports.user_id = #{queryForm.userId}
</if>
<if test="queryForm.declareYear != null">
AND t_firm_reports.declare_year = #{queryForm.declareYear}
</if>
<if test="queryForm.declareQuarter != null">
AND t_firm_reports.declare_quarter = #{queryForm.declareQuarter}
</if>
<if test="queryForm.approvalStatus != null">
AND t_firm_reports.approval_status = #{queryForm.approvalStatus}
</if>
</where>
</select>
</mapper>