|
|
@@ -656,6 +656,11 @@
|
|
|
|
|
|
|
|
|
<select id="selectByMainId" resultMap="MainMap">
|
|
|
+ <include refid="mainAllSql"/>
|
|
|
+ where a.id= #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <sql id="mainAllSql">
|
|
|
select b.id,b.check_no,b.total_amount,b.order_no,o.contract_no,b.aname,b.apply_dep,b.pay_dep,
|
|
|
dep.name applyDepName,dep2.name payDepName, b.remarks,b.eaaid ,eap.name ,eap.bank ,eap.accounts ,b.status,b.process_status,
|
|
|
c.id sonId,c.total_amount sonAmount,c.`type` ,c.type_other ,c.user_names ,c.release_start ,c.release_end ,
|
|
|
@@ -666,8 +671,7 @@
|
|
|
left join t_order_new o on b.order_no =o.order_no left join expense_account_private eap on b.eaaid =eap.id
|
|
|
left join expense_account c on a.ea_id =c.id
|
|
|
left join expense_account_details d on c.id =d.eaid
|
|
|
- where a.id= #{id}
|
|
|
- </select>
|
|
|
+ </sql>
|
|
|
|
|
|
<select id="selectListByMainId" resultMap="BaseResultMap">
|
|
|
select b.*
|
|
|
@@ -693,6 +697,7 @@
|
|
|
<result column="accounts" jdbcType="VARCHAR" property="accounts" />
|
|
|
<result column="status" jdbcType="INTEGER" property="status" />
|
|
|
<result column="process_status" jdbcType="INTEGER" property="processStatus" />
|
|
|
+ <result column="createTimeStr" jdbcType="VARCHAR" property="createTimeStr" />
|
|
|
<association property="sonList" resultMap="SonExpenseAccountMap"></association>
|
|
|
</resultMap>
|
|
|
|
|
|
@@ -730,4 +735,70 @@
|
|
|
where a.id= #{id} and a.ea_id=b.id
|
|
|
</update>
|
|
|
|
|
|
+ <select id="ExpenseMainList" resultMap="MainMap">
|
|
|
+ select b.id,b.check_no,b.total_amount,b.order_no,o.contract_no,b.aname,b.apply_dep,b.pay_dep,
|
|
|
+ date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,b.status,b.process_status,
|
|
|
+ dep.name applyDepName,dep2.name payDepName, b.remarks,b.eaaid ,
|
|
|
+ c.id sonId,c.total_amount sonAmount,c.`type` ,c.type_other ,c.user_names ,c.release_start ,c.release_end
|
|
|
+ from expense_relationship a
|
|
|
+ left join expense_account b on a.id =b.id
|
|
|
+ left join department dep on b.apply_dep =dep.id left join department dep2 on b.pay_dep =dep2.id
|
|
|
+ left join t_order_new o on b.order_no =o.order_no
|
|
|
+ left join expense_account c on a.ea_id =c.id
|
|
|
+
|
|
|
+ left join admin ad on b.aid=ad.id
|
|
|
+ left join department adDep on ad .department_id=adDep.id
|
|
|
+ where 1=1 and b.expense_main =1
|
|
|
+ <if test=" status != null">
|
|
|
+ and b.status = #{status}
|
|
|
+ </if>
|
|
|
+ <if test=" roleType ==0">
|
|
|
+ and b.aid = #{aid}
|
|
|
+ </if>
|
|
|
+ <if test="roleType == 1">
|
|
|
+ and b.process_status > 0
|
|
|
+ and ad.superior_id= #{aid}
|
|
|
+ </if>
|
|
|
+ <if test="roleType == 2">
|
|
|
+ and b.process_status > 1
|
|
|
+ and adDep.finance_id = #{aid}
|
|
|
+ </if>
|
|
|
+ <if test="roleType == 3">
|
|
|
+ and b.process_status > 2
|
|
|
+ and ad.department_id in
|
|
|
+ <foreach collection="deps" item="dep" open="(" close=")" separator=",">
|
|
|
+ #{dep}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ ${page_sql}
|
|
|
+ </select>
|
|
|
+ <select id="ExpenseMainCount" resultType="java.lang.Integer">
|
|
|
+ select count(*)
|
|
|
+ from expense_account b
|
|
|
+ left join admin ad on b.aid=ad.id
|
|
|
+ left join department adDep on ad .department_id=adDep.id
|
|
|
+ where 1=1 and b.expense_main =1
|
|
|
+ <if test=" status != null">
|
|
|
+ and b.status = #{status}
|
|
|
+ </if>
|
|
|
+ <if test=" roleType ==0">
|
|
|
+ and b.aid = #{aid}
|
|
|
+ </if>
|
|
|
+ <if test="roleType == 1">
|
|
|
+ and b.process_status > 0
|
|
|
+ and ad.superior_id= #{aid}
|
|
|
+ </if>
|
|
|
+ <if test="roleType == 2">
|
|
|
+ and b.process_status > 1
|
|
|
+ and adDep.finance_id = #{aid}
|
|
|
+ </if>
|
|
|
+ <if test="roleType == 3">
|
|
|
+ and b.process_status > 2
|
|
|
+ and ad.department_id in
|
|
|
+ <foreach collection="deps" item="dep" open="(" close=")" separator=",">
|
|
|
+ #{dep}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|