|
@@ -27,22 +27,31 @@
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
|
<select id="get" resultMap="FinancialExpenditure">
|
|
|
- SELECT * FROM financial_expenditure WHERE id_ = #{id}
|
|
|
- </select>
|
|
|
+ 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>
|
|
|
+ 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"
|
|
|
+ <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_,amount_,item_detail_,payment_time_,cause_,create_time_,update_time_,fee_project_,type_)
|
|
|
- VALUES(#{batchNo},#{financialProcessNo},#{dingtalkProcessNo},#{organId},#{cooperationOrganId},#{applyUser},#{amount},
|
|
|
- #{itemDetail},#{paymentTime},#{cause},now(),now(),#{feeProject,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
|
- #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
|
|
|
+ INSERT INTO financial_expenditure (batch_no_, financial_process_no_, dingtalk_process_no_,
|
|
|
+ organ_id_, cooperation_organ_id_, apply_user_, amount_, item_detail_,
|
|
|
+ payment_time_, cause_, create_time_, update_time_, fee_project_, type_)
|
|
|
+ VALUES (#{batchNo}, #{financialProcessNo}, #{dingtalkProcessNo}, #{organId}, #{cooperationOrganId},
|
|
|
+ #{applyUser}, #{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">
|
|
@@ -105,10 +114,14 @@
|
|
|
|
|
|
<!-- 根据主键删除一条记录 -->
|
|
|
<update id="delete">
|
|
|
- UPDATE financial_expenditure SET del_flag_ = 1 WHERE id_ = #{id}
|
|
|
- </update>
|
|
|
+ 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 financial_expenditure
|
|
|
+ SET del_flag_ = 1
|
|
|
+ WHERE FIND_IN_SET(id_, #{ids})
|
|
|
</update>
|
|
|
|
|
|
<sql id="queryPageSql">
|
|
@@ -131,7 +144,8 @@
|
|
|
</if>
|
|
|
<if test="search != null and search != ''">
|
|
|
AND (fe.id_ LIKE CONCAT('%',#{search},'%') OR fe.financial_process_no_ LIKE CONCAT('%',#{search},'%')
|
|
|
- OR fe.dingtalk_process_no_ LIKE CONCAT('%',#{search},'%') OR fe.apply_user_ LIKE CONCAT('%',#{search},'%'))
|
|
|
+ OR fe.dingtalk_process_no_ LIKE CONCAT('%',#{search},'%') OR fe.apply_user_ LIKE
|
|
|
+ CONCAT('%',#{search},'%'))
|
|
|
</if>
|
|
|
<if test="organId != null and organId != ''">
|
|
|
AND FIND_IN_SET(fe.organ_id_,#{organId})
|
|
@@ -160,11 +174,12 @@
|
|
|
|
|
|
<!-- 查询当前表的总记录数 -->
|
|
|
<select id="queryCount" resultType="int">
|
|
|
- SELECT COUNT(DISTINCT fe.id_) FROM financial_expenditure fe
|
|
|
+ SELECT COUNT(DISTINCT fe.id_) FROM financial_expenditure fe
|
|
|
<include refid="queryPageSql"/>
|
|
|
- </select>
|
|
|
+ </select>
|
|
|
|
|
|
- <resultMap type="com.ym.mec.biz.dal.dto.FinancialExpenditureDto" id="FinancialExpenditureDto" extends="FinancialExpenditure">
|
|
|
+ <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"/>
|
|
|
</resultMap>
|
|
@@ -183,10 +198,14 @@
|
|
|
</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="getCooperationExpenditure" resultMap="FinancialExpenditure"><![CDATA[
|
|
|
+ SELECT organ_id_, cooperation_organ_id_, type_, SUM(amount_) amount_
|
|
|
+ FROM financial_expenditure
|
|
|
+ WHERE payment_time_ >= #{startTime}
|
|
|
+ AND payment_time_ <= #{endTime}
|
|
|
+ AND 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 del_flag_ = 0 AND dingtalk_process_no_ IN
|
|
|
<foreach collection="collect" separator="," open="(" close=")" item="item">
|