| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 | 
							- <?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.ym.mec.biz.dal.dao.FinancialExpenditureDao">
 
-     <resultMap type="com.ym.mec.biz.dal.entity.FinancialExpenditure" id="FinancialExpenditure">
 
-         <result column="id_" property="id"/>
 
-         <result column="batch_no_" property="batchNo"/>
 
-         <result column="financial_process_no_" property="financialProcessNo"/>
 
-         <result column="dingtalk_process_no_" property="dingtalkProcessNo"/>
 
-         <result column="organ_id_" property="organId"/>
 
-         <result column="cooperation_organ_id_" property="cooperationOrganId"/>
 
-         <result column="apply_user_id_" property="applyUserId"/>
 
-         <result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 
-         <result column="fee_project_" property="feeProject" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 
-         <result column="amount_" property="amount"/>
 
-         <result column="item_detail_" property="itemDetail"/>
 
-         <result column="payment_time_" property="paymentTime"/>
 
-         <result column="del_flag_" property="delFlag"/>
 
-         <result column="cause_" property="cause"/>
 
-         <result column="create_time_" property="createTime"/>
 
-         <result column="update_time_" property="updateTime"/>
 
-     </resultMap>
 
-     <!-- 根据主键查询一条记录 -->
 
-     <select id="get" resultMap="FinancialExpenditure">
 
- 		SELECT * FROM financial_expenditure WHERE id_ = #{id}
 
- 	</select>
 
-     <!-- 全查询 -->
 
-     <select id="findAll" resultMap="FinancialExpenditure">
 
- 		SELECT * FROM financial_expenditure WHERE del_flag_ = 0 ORDER BY id_
 
- 	</select>
 
-     <!-- 向数据库增加一条记录 -->
 
-     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.FinancialExpenditure" useGeneratedKeys="true" keyColumn="id"
 
-             keyProperty="id">
 
-         INSERT INTO financial_expenditure (batch_no_,financial_process_no_,dingtalk_process_no_,
 
-         organ_id_,cooperation_organ_id_,apply_user_id_,amount_,item_detail_,payment_time_,cause_,create_time_,update_time_,fee_project_,type_)
 
-         VALUES(#{batchNo},#{financialProcessNo},#{dingtalkProcessNo},#{organId},#{cooperationOrganId},#{applyUserId},#{amount},
 
-         #{itemDetail},#{paymentTime},#{cause},now(),now(),#{feeProject,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 
-         #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
 
-     </insert>
 
-     <insert id="batchInsert">
 
-         INSERT INTO financial_expenditure (batch_no_,financial_process_no_,dingtalk_process_no_,
 
-         organ_id_,cooperation_organ_id_,apply_user_id_,amount_,item_detail_,payment_time_,cause_,create_time_,update_time_,fee_project_,type_)
 
-         VALUES
 
-         <foreach collection="financialExpenditures" item="item" separator=",">
 
-             (#{item.batchNo},#{item.financialProcessNo},#{item.dingtalkProcessNo},#{item.organId},
 
-             #{item.cooperationOrganId},#{item.applyUserId},#{item.amount},
 
-             #{item.itemDetail},#{item.paymentTime},#{item.cause},now(),now(),
 
-             #{item.feeProject,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 
-             #{item.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
 
-         </foreach>
 
-     </insert>
 
-     <!-- 根据主键查询一条记录 -->
 
-     <update id="update" parameterType="com.ym.mec.biz.dal.entity.FinancialExpenditure">
 
-         UPDATE financial_expenditure
 
-         <set>
 
-             <if test="feeProject != null">
 
-                 fee_project_ = #{feeProject,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 
-             </if>
 
-             <if test="type != null">
 
-                 type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 
-             </if>
 
-             <if test="batchNo != null">
 
-                 batch_no_ = #{batchNo},
 
-             </if>
 
-             <if test="financialProcessNo != null">
 
-                 financial_process_no_ = #{financialProcessNo},
 
-             </if>
 
-             <if test="dingtalkProcessNo != null">
 
-                 dingtalk_process_no_ = #{dingtalkProcessNo},
 
-             </if>
 
-             <if test="organId != null">
 
-                 organ_id_ = #{organId},
 
-             </if>
 
-             <if test="cooperationOrganId != null">
 
-                 cooperation_organ_id_ = #{cooperationOrganId},
 
-             </if>
 
-             <if test="applyUserId != null">
 
-                 apply_user_id_ = #{applyUserId},
 
-             </if>
 
-             <if test="amount != null">
 
-                 amount_ = #{amount},
 
-             </if>
 
-             <if test="itemDetail != null">
 
-                 item_detail_ = #{itemDetail},
 
-             </if>
 
-             <if test="paymentTime != null">
 
-                 payment_time_ = #{paymentTime},
 
-             </if>
 
-             <if test="cause != null">
 
-                 cause_ = #{cause},
 
-             </if>
 
-             update_time_ = NOW()
 
-         </set>
 
-         WHERE id_ = #{id}
 
-     </update>
 
-     <!-- 根据主键删除一条记录 -->
 
-     <update id="delete">
 
- 		UPDATE financial_expenditure SET del_flag_ = 1 WHERE id_ = #{id}
 
- 	</update>
 
-     <update id="batchDel">
 
-         UPDATE financial_expenditure SET del_flag_ = 1 WHERE FIND_IN_SET(id_,#{ids})
 
-     </update>
 
-     <sql id="queryPageSql">
 
-         <where>
 
-             fe.del_flag_ = 0
 
-             <if test="batchNo != null and batchNo != ''">
 
-                 AND fe.batch_no_ = #{batchNo}
 
-             </if>
 
-             <if test="feeProject != null">
 
-                 AND fe.fee_project_ = #{feeProject}
 
-             </if>
 
-             <if test="type != null">
 
-                 AND fe.type_ = #{type}
 
-             </if>
 
-             <if test="financialProcessNo != null and financialProcessNo != ''">
 
-                 AND fe.financial_process_no_ = #{financialProcessNo}
 
-             </if>
 
-             <if test="dingtalkProcessNo != null and dingtalkProcessNo != ''">
 
-                 AND fe.dingtalk_process_no_ = #{dingtalkProcessNo}
 
-             </if>
 
-             <if test="search != null and search != ''">
 
-                 AND (fe.batch_no_ LIKE CONCAT('%',#{search},'%') OR fe.financial_process_no_ LIKE CONCAT('%',#{search},'%')
 
-                 OR fe.dingtalk_process_no_ LIKE CONCAT('%',#{search},'%') OR su.real_name_ LIKE CONCAT('%',#{search},'%'))
 
-             </if>
 
-             <if test="organId != null">
 
-                 AND fe.organ_id_ = #{organId}
 
-             </if>
 
-             <if test="cooperationOrganId != null">
 
-                 AND fe.cooperation_organ_id_ = #{cooperationOrganId}
 
-             </if>
 
-             <if test="applyUserId != null">
 
-                 AND fe.apply_user_id_ = #{applyUserId}
 
-             </if>
 
-             <if test="startTime != null and startTime != ''">
 
-                 AND DATE_FORMAT(fe.payment_time_,'%Y%m%d') >= #{startTime}
 
-             </if>
 
-             <if test="endTime != null and endTime != ''">
 
-                 AND DATE_FORMAT(fe.payment_time_,'%Y%m%d') <= #{endTime}
 
-             </if>
 
-         </where>
 
-     </sql>
 
-     <!-- 分页查询 -->
 
-     <select id="queryPage" resultMap="FinancialExpenditure" parameterType="map">
 
-         SELECT fe.*,o.name_ organ_name_,co.name_ cooperation_name_,su.real_name_
 
-         FROM financial_expenditure fe
 
-         LEFT JOIN organization o ON o.id_ = fe.organ_id_
 
-         LEFT JOIN sys_user su ON su.id_ = fe.apply_user_id_
 
-         LEFT JOIN cooperation_organ co ON co.id_ = fe.cooperation_organ_id_
 
-         <include refid="queryPageSql"/>
 
-         <include refid="global.limit"/>
 
-     </select>
 
-     <!-- 查询当前表的总记录数 -->
 
-     <select id="queryCount" resultType="int">
 
- 		SELECT COUNT(DISTINCT fe.id_) FROM financial_expenditure fe
 
-         LEFT JOIN sys_user su ON su.id_ = fe.apply_user_id_
 
-         <include refid="queryPageSql"/>
 
- 	</select>
 
-     <resultMap type="com.ym.mec.biz.dal.dto.FinancialExpenditureDto" id="FinancialExpenditureDto" extends="FinancialExpenditure">
 
-         <result column="organ_name_" property="organName"/>
 
-         <result column="cooperation_name_" property="cooperationName"/>
 
-         <result column="real_name_" property="realName"/>
 
-     </resultMap>
 
-     <select id="findFinancialExpenditureCount" resultType="java.lang.Integer">
 
-         SELECT COUNT(DISTINCT fe.id_) FROM financial_expenditure fe
 
-         LEFT JOIN sys_user su ON su.id_ = fe.apply_user_id_
 
-         <include refid="queryPageSql"/>
 
-     </select>
 
-     <select id="queryFinancialExpenditurePage" resultMap="FinancialExpenditureDto">
 
-         SELECT fe.*,o.name_ organ_name_,co.name_ cooperation_name_,su.real_name_
 
-         FROM financial_expenditure fe
 
-         LEFT JOIN organization o ON o.id_ = fe.organ_id_
 
-         LEFT JOIN sys_user su ON su.id_ = fe.apply_user_id_
 
-         LEFT JOIN cooperation_organ co ON co.id_ = fe.cooperation_organ_id_
 
-         <include refid="queryPageSql"/>
 
-         <include refid="global.limit"/>
 
-     </select>
 
-     <!-- 统计合作单位的支出 -->
 
-     <select id="getCooperationExpenditure" resultMap="FinancialExpenditure">
 
-         SELECT organ_id_,cooperation_organ_id_, type_, SUM(amount_) amount_ FROM financial_expenditure WHERE del_flag_ =0
 
-         GROUP BY organ_id_,cooperation_organ_id_,type_
 
-     </select>
 
-     <select id="countBydingTalk" resultType="java.lang.String">
 
-         SELECT dingtalk_process_no_ FROM financial_expenditure WHERE dingtalk_process_no_ IN
 
-         <foreach collection="collect" separator="," open="(" close=")" item="item">
 
-             #{item}
 
-         </foreach>
 
-         GROUP BY dingtalk_process_no_
 
-     </select>
 
- </mapper>
 
 
  |