241 lines
9.4 KiB
XML
241 lines
9.4 KiB
XML
<?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="io.renren.modules.business.dao.BusinessOutlayIncomeDao">
|
|
|
|
<!-- 可根据自己的需求,是否要使用 -->
|
|
<resultMap type="io.renren.modules.business.entity.BusinessOutlayIncomeEntity" id="businessOutlayIncomeMap">
|
|
<result property="id" column="id"/>
|
|
<result property="outinDate" column="outin_date"/>
|
|
<result property="outinYdayBalance" column="outin_yday_balance"/>
|
|
<result property="outinTdayIncome" column="outin_tday_income"/>
|
|
<result property="outinTdayOut" column="outin_tday_out"/>
|
|
<result property="outinTdayBalance" column="outin_tday_balance"/>
|
|
<result property="outinCreditingWay" column="outin_crediting_way"/>
|
|
<result property="outinRemark" column="outin_remark"/>
|
|
<result property="status" column="status"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="writeUserId" column="write_user_id"/>
|
|
<result property="approval" column="approval"/>
|
|
<result property="outType" column="out_type"/>
|
|
</resultMap>
|
|
|
|
<select id="listNoPage" parameterType="io.renren.modules.business.entity.BusinessOutlayIncomeEntity" resultType="io.renren.modules.business.entity.BusinessOutlayIncomeEntity">
|
|
select
|
|
id,
|
|
outin_date,
|
|
round(outin_yday_balance,2) outin_yday_balance,
|
|
round(outin_tday_income,2) outin_tday_income,
|
|
round(outin_tday_out,2) outin_tday_out,
|
|
round(outin_tday_balance,2) outin_tday_balance,
|
|
outin_crediting_way,
|
|
outin_remark,
|
|
status,
|
|
create_time,
|
|
update_time,
|
|
write_user_id,
|
|
approval
|
|
from business_outlay_income where status = 0
|
|
<if test="outinDate != '' and outinDate != null and outinDate != 'undefined'">
|
|
and outin_date like CONCAT('%',#{outinDate},'%')
|
|
</if>
|
|
<if test="start != '' and start != null and start != 'undefined'">
|
|
and outin_date >= #{start}
|
|
</if>
|
|
<if test="end != '' and end != null and end != 'undefined'">
|
|
and outin_date <= #{end}
|
|
</if>
|
|
<if test="writeUserId != null">
|
|
and write_user_id = #{writeUserId}
|
|
</if>
|
|
order by outin_date desc
|
|
</select>
|
|
|
|
<select id="listNowTime" resultType="io.renren.modules.business.entity.BusinessOutlayIncomeEntity">
|
|
select
|
|
id,
|
|
outin_date,
|
|
round(outin_yday_balance,2) outin_yday_balance,
|
|
round(outin_tday_income,2) outin_tday_income,
|
|
round(outin_tday_out,2) outin_tday_out,
|
|
round(outin_tday_balance,2) outin_tday_balance,
|
|
outin_crediting_way,
|
|
outin_remark,
|
|
o.status,
|
|
o.create_time,
|
|
o.update_time,
|
|
write_user_id,
|
|
approval,
|
|
out_type as outType,
|
|
d.`name` as outTypeStr
|
|
from business_outlay_income o LEFT JOIN business_dict d on o.out_type = d.dict_id
|
|
where o.status = 0
|
|
<if test="writeUserId != null">
|
|
and write_user_id = #{writeUserId}
|
|
</if>
|
|
order by outin_date desc
|
|
</select>
|
|
|
|
<select id="zclbList" parameterType="io.renren.modules.business.entity.BusinessOutlayIncomeEntity" resultType="java.util.Map">
|
|
select a.*,b.authentic_name name
|
|
from
|
|
(
|
|
SELECT write_user_id id,
|
|
round(sum(outin_tday_income),2) totalNum,
|
|
(case out_type when 146 then 1 else 0 end) as out_type
|
|
FROM business_outlay_income
|
|
WHERE STATUS = 0
|
|
<if test="year != '' and year != null and year != 'undefined'">
|
|
and outin_date like CONCAT('%',#{year},'%')
|
|
</if>
|
|
<if test="startTime != '' and startTime != null and startTime != 'undefined'">
|
|
and outin_date >= #{startTime}
|
|
</if>
|
|
<if test="endTime != '' and endTime != null and endTime != 'undefined'">
|
|
and outin_date <= #{endTime}
|
|
</if>
|
|
GROUP BY write_user_id,(case out_type when 146 then 1 else 0 end)
|
|
) a left join sys_user b on a.id = b.user_id
|
|
</select>
|
|
|
|
<select id="getZrye" parameterType="io.renren.modules.business.entity.BusinessOutlayIncomeEntity" resultType="decimal">
|
|
select round(ifnull(outin_tday_balance, 0),2) val from business_outlay_income
|
|
where outin_date = (
|
|
select max(outin_date) from business_outlay_income
|
|
where 1 = 1
|
|
<choose>
|
|
<when test="startTime != '' and startTime != null">
|
|
and outin_date <![CDATA[<]]> #{startTime}
|
|
</when>
|
|
<otherwise>
|
|
and outin_date <![CDATA[<]]> DATE_FORMAT(now(),'%Y-%m-%d')
|
|
</otherwise>
|
|
</choose>
|
|
|
|
and write_user_id = #{writeUserId}
|
|
and STATUS = 0
|
|
)
|
|
and write_user_id = #{writeUserId}
|
|
and STATUS = 0
|
|
limit 1
|
|
</select>
|
|
<update id="updateNoPassByIds" parameterType="String">
|
|
update business_outlay_income set approval = 0 where
|
|
<foreach collection="approvalId.split(',')" index="index" item="item" open="(" separator="," close=")">
|
|
id = #{item}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!--更新对应年度信息-->
|
|
<update id="updateND" parameterType="String">
|
|
update business_outlay_income set status = 1 where write_user_id=#{annualHsId} and
|
|
DATE_FORMAT(outin_date,'%Y-%m-%d') between #{startTime} and #{endTime}
|
|
</update>
|
|
|
|
<update id="updateLocked" parameterType="String">
|
|
update business_outlay_income set approval = 2
|
|
where write_user_id = #{val}
|
|
and status = 0
|
|
and approval != 2
|
|
</update>
|
|
|
|
<select id="getLockedCnt" parameterType="map" resultType="int">
|
|
select count(1) cnt from business_outlay_income
|
|
where status = 0
|
|
and outin_date = #{start}
|
|
and write_user_id = #{writeUserId}
|
|
and approval = 2
|
|
</select>
|
|
|
|
|
|
<select id="pcListNoPage" parameterType="io.renren.modules.business.entity.BusinessOutlayIncomeEntity" resultType="io.renren.modules.business.entity.BusinessOutlayIncomeEntity">
|
|
select
|
|
a.id,
|
|
a.outin_date,
|
|
date_format(a.outin_date,'%Y-%m-%d') outinDateStr,
|
|
round(a.outin_yday_balance,2) outin_yday_balance,
|
|
round(a.outin_tday_income,2) outin_tday_income,
|
|
round(a.outin_tday_out,2) outin_tday_out,
|
|
round(a.outin_tday_balance,2) outin_tday_balance,
|
|
a.outin_crediting_way,
|
|
c.name as outinCreditingWayStr,
|
|
a.out_type as outType,
|
|
a.outin_remark,
|
|
a.status,
|
|
a.create_time,
|
|
a.update_time,
|
|
a.write_user_id,
|
|
a.approval,
|
|
(select authentic_name from sys_user where user_id = a.write_user_id) writeUserStr
|
|
from business_outlay_income a
|
|
left join business_dict c on a.outin_crediting_way = c.dict_id
|
|
where a.status = 0
|
|
<if test="outinDate != '' and outinDate != null and outinDate != 'undefined'">
|
|
and a.outin_date like CONCAT('%',#{outinDate},'%')
|
|
</if>
|
|
<if test="start != '' and start != null and start != 'undefined'">
|
|
and a.outin_date >= #{start}
|
|
</if>
|
|
<if test="end != '' and end != null and end != 'undefined'">
|
|
and a.outin_date <= #{end}
|
|
</if>
|
|
<if test="writeUserId != 0 and writeUserId != null and writeUserId != 1 ">
|
|
and a.write_user_id = #{writeUserId}
|
|
</if>
|
|
order by a.outin_date desc
|
|
</select>
|
|
|
|
<select id="getOutInByDate" parameterType="io.renren.modules.business.entity.BusinessOutlayIncomeEntity" resultType="io.renren.modules.business.entity.BusinessOutlayIncomeEntity">
|
|
select
|
|
id,
|
|
outin_date,
|
|
outin_yday_balance,
|
|
outin_tday_income,
|
|
outin_tday_out,
|
|
outin_tday_balance,
|
|
outin_crediting_way,
|
|
outin_remark,
|
|
status,
|
|
create_time,
|
|
update_time,
|
|
write_user_id,
|
|
approval,
|
|
out_type
|
|
from business_outlay_income
|
|
where outin_date = #{outinDate}
|
|
and write_user_id = #{writeUserId}
|
|
and STATUS = 0
|
|
limit 1
|
|
</select>
|
|
|
|
<select id="getNextOutInByDate" parameterType="io.renren.modules.business.entity.BusinessOutlayIncomeEntity" resultType="io.renren.modules.business.entity.BusinessOutlayIncomeEntity">
|
|
select
|
|
id,
|
|
outin_date,
|
|
outin_yday_balance,
|
|
outin_tday_income,
|
|
outin_tday_out,
|
|
outin_tday_balance,
|
|
outin_crediting_way,
|
|
outin_remark,
|
|
status,
|
|
create_time,
|
|
update_time,
|
|
write_user_id,
|
|
approval,
|
|
out_type
|
|
from business_outlay_income
|
|
where outin_date = (
|
|
select min(outin_date)
|
|
from business_outlay_income
|
|
where STATUS = 0
|
|
and outin_date > #{outinDate}
|
|
and write_user_id = #{writeUserId}
|
|
)
|
|
and write_user_id = #{writeUserId}
|
|
and STATUS = 0
|
|
limit 1
|
|
</select>
|
|
|
|
</mapper> |