|
|
@@ -31,12 +31,13 @@
|
|
|
<result column="senior_staff" jdbcType="INTEGER" property="seniorStaff" />
|
|
|
<result column="public_purview" jdbcType="INTEGER" property="publicPurview" />
|
|
|
<result column="expense_open_id" jdbcType="VARCHAR" property="expenseOpenId" />
|
|
|
+ <result column="expense_super_examine" jdbcType="INTEGER" property="expenseSuperExamine" />
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List">
|
|
|
id, mobile, `name`, `password`, email, create_time, `number`, province, `position`,
|
|
|
superior_id, city, department_id, `status`, user_no, duty, district, head_portrait_url,
|
|
|
contact_mobile, last_login_time, open_id, `type`, reviewer, amb_id, amb_role, amb_manage,
|
|
|
- manager_id, senior_staff, public_purview, expense_open_id
|
|
|
+ manager_id, senior_staff, public_purview, expense_open_id, expense_super_examine
|
|
|
</sql>
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
|
select
|
|
|
@@ -48,34 +49,31 @@
|
|
|
delete from admin
|
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
|
</delete>
|
|
|
- <insert id="insert" parameterType="com.goafanti.common.model.Admin">
|
|
|
- insert into admin (id, mobile, `name`,
|
|
|
- `password`, email, create_time,
|
|
|
- `number`, province, `position`,
|
|
|
- superior_id, city, department_id,
|
|
|
- `status`, user_no, duty,
|
|
|
- district, head_portrait_url, contact_mobile,
|
|
|
- last_login_time, open_id, `type`,
|
|
|
- reviewer, amb_id, amb_role,
|
|
|
- amb_manage, manager_id, senior_staff,
|
|
|
- public_purview, expense_open_id)
|
|
|
- values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
|
|
- #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
|
|
- #{number,jdbcType=INTEGER}, #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR},
|
|
|
- #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR},
|
|
|
- #{status,jdbcType=VARCHAR}, #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR},
|
|
|
- #{district,jdbcType=VARCHAR}, #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR},
|
|
|
- #{lastLoginTime,jdbcType=TIMESTAMP}, #{openId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
|
|
|
- #{reviewer,jdbcType=VARCHAR}, #{ambId,jdbcType=VARCHAR}, #{ambRole,jdbcType=VARCHAR},
|
|
|
- #{ambManage,jdbcType=INTEGER}, #{managerId,jdbcType=VARCHAR}, #{seniorStaff,jdbcType=INTEGER},
|
|
|
- #{publicPurview,jdbcType=INTEGER}, #{expenseOpenId,jdbcType=VARCHAR})
|
|
|
+ <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
|
|
|
+ insert into admin (mobile, `name`, `password`,
|
|
|
+ email, create_time, `number`,
|
|
|
+ province, `position`, superior_id,
|
|
|
+ city, department_id, `status`,
|
|
|
+ user_no, duty, district,
|
|
|
+ head_portrait_url, contact_mobile, last_login_time,
|
|
|
+ open_id, `type`, reviewer,
|
|
|
+ amb_id, amb_role, amb_manage,
|
|
|
+ manager_id, senior_staff, public_purview,
|
|
|
+ expense_open_id, expense_super_examine)
|
|
|
+ values (#{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
|
|
|
+ #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{number,jdbcType=INTEGER},
|
|
|
+ #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR}, #{superiorId,jdbcType=VARCHAR},
|
|
|
+ #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
|
|
+ #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR}, #{district,jdbcType=VARCHAR},
|
|
|
+ #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR}, #{lastLoginTime,jdbcType=TIMESTAMP},
|
|
|
+ #{openId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{reviewer,jdbcType=VARCHAR},
|
|
|
+ #{ambId,jdbcType=VARCHAR}, #{ambRole,jdbcType=VARCHAR}, #{ambManage,jdbcType=INTEGER},
|
|
|
+ #{managerId,jdbcType=VARCHAR}, #{seniorStaff,jdbcType=INTEGER}, #{publicPurview,jdbcType=INTEGER},
|
|
|
+ #{expenseOpenId,jdbcType=VARCHAR}, #{expenseSuperExamine,jdbcType=INTEGER})
|
|
|
</insert>
|
|
|
- <insert id="insertSelective" parameterType="com.goafanti.common.model.Admin">
|
|
|
+ <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
|
|
|
insert into admin
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="id != null">
|
|
|
- id,
|
|
|
- </if>
|
|
|
<if test="mobile != null">
|
|
|
mobile,
|
|
|
</if>
|
|
|
@@ -160,11 +158,11 @@
|
|
|
<if test="expenseOpenId != null">
|
|
|
expense_open_id,
|
|
|
</if>
|
|
|
+ <if test="expenseSuperExamine != null">
|
|
|
+ expense_super_examine,
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
- <if test="id != null">
|
|
|
- #{id,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
<if test="mobile != null">
|
|
|
#{mobile,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
@@ -249,6 +247,9 @@
|
|
|
<if test="expenseOpenId != null">
|
|
|
#{expenseOpenId,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
+ <if test="expenseSuperExamine != null">
|
|
|
+ #{expenseSuperExamine,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Admin">
|
|
|
@@ -338,6 +339,9 @@
|
|
|
<if test="expenseOpenId != null">
|
|
|
expense_open_id = #{expenseOpenId,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
+ <if test="expenseSuperExamine != null">
|
|
|
+ expense_super_examine = #{expenseSuperExamine,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
</set>
|
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
|
</update>
|
|
|
@@ -370,7 +374,8 @@
|
|
|
manager_id = #{managerId,jdbcType=VARCHAR},
|
|
|
senior_staff = #{seniorStaff,jdbcType=INTEGER},
|
|
|
public_purview = #{publicPurview,jdbcType=INTEGER},
|
|
|
- expense_open_id = #{expenseOpenId,jdbcType=VARCHAR}
|
|
|
+ expense_open_id = #{expenseOpenId,jdbcType=VARCHAR},
|
|
|
+ expense_super_examine = #{expenseSuperExamine,jdbcType=INTEGER}
|
|
|
where id = #{id,jdbcType=VARCHAR}
|
|
|
</update>
|
|
|
|
|
|
@@ -378,6 +383,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
<select id="selectAllAdmin" resultMap="BaseResultMap">
|
|
|
select
|
|
|
<include refid="Base_Column_List" />
|
|
|
@@ -755,7 +761,7 @@
|
|
|
<select id="selectAllByid" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
|
|
|
select a.id, a.mobile, a.name, a.`password`, a.email, a.create_time as createTime,
|
|
|
a.province, a.`position`,a.reviewer , a.superior_id as superiorId,a.public_purview publicPurview,
|
|
|
- a.department_id as departmentId, a.status,a.user_no as userNo,a.duty,a.district,
|
|
|
+ a.department_id as departmentId, a.status,a.user_no as userNo,a.duty,a.district,a.expense_super_examine expenseSuperExamine,
|
|
|
a.head_portrait_url as headPortraitUrl, a.contact_mobile as contactMobile,a.senior_staff seniorStaff,
|
|
|
b.name superior,c.name reviewerName,a.type,a.amb_id ambId,a.manager_id managerId ,d.name managerName
|
|
|
from admin a left join admin b on a.superior_id =b.id left join admin c on a.reviewer =c.id
|
|
|
@@ -912,14 +918,14 @@
|
|
|
|
|
|
<select id="getDeptNameByAid" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
|
|
|
select a.id,a.name, d.name as departmentName,a.department_id departmentId,a.email,a.superior_id superiorId,a.open_id openId,
|
|
|
- a.reviewer,d.manager_id depManager,d.finance_id depFinance,a.public_purview publicPurview
|
|
|
+ a.reviewer,d.manager_id depManager,d.finance_id depFinance,a.public_purview publicPurview,a.expense_super_examine expenseSuperExamine
|
|
|
from admin a left join department d on a.department_id = d.id
|
|
|
where a.id = #{_parameter,jdbcType=VARCHAR}
|
|
|
</select>
|
|
|
|
|
|
<insert id="addAdminContacts" parameterType="com.goafanti.admin.bo.AdminContacts">
|
|
|
insert into admin_contacts (id,aid,contacts_id)values
|
|
|
- (#{id,jdbcType=VARCHAR},#{aid,jdbcType=VARCHAR},#{contactsId,jdbcType=VARCHAR})
|
|
|
+ (#{id,jdbcType=VARCHAR},#{aid,jdbcType=VARCHAR},#{contactsId,jdbcType=VARCHAR})
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
@@ -1162,8 +1168,8 @@
|
|
|
|
|
|
<select id="selectMyAndSuperBySuperId" parameterType="java.lang.String" resultType="com.goafanti.common.bo.AdminNoticeBo">
|
|
|
select
|
|
|
- a.id,a.name,a.email,a.open_id openId,a.expense_open_id expenseOpenId,
|
|
|
- b.id superId,b.name superName,b.email superEmail,b.open_id superOpenId,b.expense_open_id superExpenseOpenId
|
|
|
+ a.id,a.name,a.email,a.open_id openId,a.expense_open_id expenseOpenId,
|
|
|
+ b.id superId,b.name superName,b.email superEmail,b.open_id superOpenId,b.expense_open_id superExpenseOpenId
|
|
|
from admin a left join admin b on a.superior_id=b.id
|
|
|
where a.id=#{id}
|
|
|
</select>
|
|
|
@@ -1246,7 +1252,7 @@
|
|
|
<select id="selectFinanceAdminByAid" resultType="com.goafanti.common.model.Admin">
|
|
|
select c.id,c.name,c.open_id openId,c.email
|
|
|
from admin a left join department b on a.department_id=b.id
|
|
|
- left join admin c on b.finance_id=c.id
|
|
|
+ left join admin c on b.finance_id=c.id
|
|
|
where a.id= #{aid}
|
|
|
</select>
|
|
|
<select id="adminStatisticsInfo" resultType="com.goafanti.admin.bo.AdminStatisticsBo">
|
|
|
@@ -1254,19 +1260,19 @@
|
|
|
from (select aid ,sum(private_count)privateSum ,sum(channel_count)channelSum ,sum(sign_count)signSum ,
|
|
|
sum(public_release_count)publicReleaseSum ,sum(follow_count) followSum,sum(order_count) orderSum
|
|
|
from admin_user_count a where aid=#{aid} group by aid)x
|
|
|
- left join(select a.salesman_id aid , sum(if( b.project_status =29,1,0))projectStopSum ,
|
|
|
- sum(if(b.check_status=1,1,0))projectCheckSum from t_order_new a left join t_order_task b
|
|
|
- on a.order_no =b.order_no where a.salesman_id = #{aid})y on x.aid=y.aid
|
|
|
- left join ( select salesman_id aid, sum(1)orderSum, sum(if(delete_sign=2,1,0))changeSum
|
|
|
- from t_order_new where delete_sign in (0,2,3) and process_status >0
|
|
|
- and salesman_id = #{aid})g on x.aid=g.aid
|
|
|
- left join ( select salesman_id aid, sum(if(order_status=3 or order_status=5,1,0))rejectSum
|
|
|
- from t_order_new where delete_sign in (0,2,3)
|
|
|
- and salesman_id = #{aid})z on x.aid=z.aid
|
|
|
- left join ( SELECT b.salesman_id aid ,sum(a.money) receivables
|
|
|
- from new_order_dun a left join t_order_new b on a.order_no =b.order_no
|
|
|
- where a.status =1 and b.delete_sign in (0,2,3)
|
|
|
- and b.salesman_id = #{aid})t on x.aid=t.aid
|
|
|
+ left join(select a.salesman_id aid , sum(if( b.project_status =29,1,0))projectStopSum ,
|
|
|
+ sum(if(b.check_status=1,1,0))projectCheckSum from t_order_new a left join t_order_task b
|
|
|
+ on a.order_no =b.order_no where a.salesman_id = #{aid})y on x.aid=y.aid
|
|
|
+ left join ( select salesman_id aid, sum(1)orderSum, sum(if(delete_sign=2,1,0))changeSum
|
|
|
+ from t_order_new where delete_sign in (0,2,3) and process_status >0
|
|
|
+ and salesman_id = #{aid})g on x.aid=g.aid
|
|
|
+ left join ( select salesman_id aid, sum(if(order_status=3 or order_status=5,1,0))rejectSum
|
|
|
+ from t_order_new where delete_sign in (0,2,3)
|
|
|
+ and salesman_id = #{aid})z on x.aid=z.aid
|
|
|
+ left join ( SELECT b.salesman_id aid ,sum(a.money) receivables
|
|
|
+ from new_order_dun a left join t_order_new b on a.order_no =b.order_no
|
|
|
+ where a.status =1 and b.delete_sign in (0,2,3)
|
|
|
+ and b.salesman_id = #{aid})t on x.aid=t.aid
|
|
|
</select>
|
|
|
|
|
|
<select id="adminStatisticsInfoByTime" resultType="com.goafanti.admin.bo.AdminStatisticsBo">
|
|
|
@@ -1308,11 +1314,11 @@
|
|
|
</select>
|
|
|
<select id="adminStatisticsPublicReleaseByAidAndTime" resultType="java.lang.Integer">
|
|
|
select sum(1) rangePublicReleaseSum
|
|
|
- from public_release a left join public_release_details b on a.id=b.prid
|
|
|
- where status =2 and a.aid = #{aid}
|
|
|
- and((a.release_start > #{startTime} and a.release_start < #{endTime})or
|
|
|
- (a.release_end > #{startTime} and a.release_end < #{endTime})or
|
|
|
- (a.release_start < #{startTime} and a.release_end > #{endTime}))
|
|
|
+ from public_release a left join public_release_details b on a.id=b.prid
|
|
|
+ where status =2 and a.aid = #{aid}
|
|
|
+ and((a.release_start > #{startTime} and a.release_start < #{endTime})or
|
|
|
+ (a.release_end > #{startTime} and a.release_end < #{endTime})or
|
|
|
+ (a.release_start < #{startTime} and a.release_end > #{endTime}))
|
|
|
</select>
|
|
|
<select id="addAdminContactsRangeReceivables" resultType="java.math.BigDecimal">
|
|
|
SELECT ifnull(sum(a.money),0) receivables
|
|
|
@@ -1324,14 +1330,14 @@
|
|
|
<select id="consultantStatisticsInfo" resultType="com.goafanti.admin.bo.ConsultantStatisticsBo">
|
|
|
SELECT x.aid,x.projectCount,x.inProgress,x.complete,x.notStarted,x.stop,y.countPublicRelease,y.countAssist,z.countChange,v.orderPayment
|
|
|
from (select a.task_receiver aid,sum(commodity_quantity) projectCount, sum(if(a.project_status=1,commodity_quantity,0)) inProgress,
|
|
|
- sum(if(a.project_status in (19,27) ,commodity_quantity,0)) complete, sum(if(a.project_status=0,commodity_quantity,0)) notStarted,
|
|
|
- sum(if(a.project_status in (2,3,29),commodity_quantity,0)) stop
|
|
|
+ sum(if(a.project_status in (19,27) ,commodity_quantity,0)) complete, sum(if(a.project_status=0,commodity_quantity,0)) notStarted,
|
|
|
+ sum(if(a.project_status in (2,3,29),commodity_quantity,0)) stop
|
|
|
from t_order_task a left join t_order_new b on a.order_no =b.order_no
|
|
|
where b.delete_sign in (0,2,3) and a.split_status in (0,2) and a.task_receiver = #{aid} group by a.task_receiver)x
|
|
|
left join (select aid,sum(if(a.`type` in (0,1,2),1,0)) countPublicRelease,sum(if(a.`type` in (3),1,0)) countAssist
|
|
|
- from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid})y on x.aid=y.aid
|
|
|
+ from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid})y on x.aid=y.aid
|
|
|
left join (SELECT b.aid,count(DISTINCT a.order_no) countChange from new_order_change a
|
|
|
- left join order_examine b on a.order_no =b.order_no where 1=1
|
|
|
+ left join order_examine b on a.order_no =b.order_no where 1=1
|
|
|
<if test="type==2">
|
|
|
and a.process_state in (3,4)
|
|
|
</if>
|
|
|
@@ -1343,53 +1349,53 @@
|
|
|
</if>
|
|
|
and b.aid=#{aid} and b.status =0 group by b.aid)z on x.aid=z.aid
|
|
|
LEFT join (select b.task_receiver aid, count(*) orderPayment from t_order_payment a
|
|
|
- left join t_order_task b on a.tid=b.id left join t_order_new c on b.order_no=c.order_no
|
|
|
- where b.task_receiver= #{aid} and a.status in(0,1,2) group by b.task_receiver )v on x.aid=v.aid
|
|
|
+ left join t_order_task b on a.tid=b.id left join t_order_new c on b.order_no=c.order_no
|
|
|
+ where b.task_receiver= #{aid} and a.status in(0,1,2) group by b.task_receiver )v on x.aid=v.aid
|
|
|
</select>
|
|
|
<select id="consultantStatisticsInfoByTime" resultType="com.goafanti.admin.bo.ConsultantStatisticsBo">
|
|
|
select a.id,x.projectCount,x.inProgress,x.notStarted,y.complete,y.stop,z.countPublicRelease,z.countAssist
|
|
|
from admin a left join (select a.task_receiver aid,sum(commodity_quantity) projectCount,
|
|
|
- sum(if(a.project_status=1,commodity_quantity,0)) inProgress,
|
|
|
- sum(if(a.project_status=0,commodity_quantity,0)) notStarted from t_order_task a where a.split_status in (0,2)
|
|
|
- and a.task_receiver = #{aid} and a.task_distribution_time BETWEEN #{startTime} and #{endTime} group by a.task_receiver )x on a.id=x.aid
|
|
|
- left join (SELECT a.task_receiver aid,sum(if(a.project_status in (19,27) ,commodity_quantity,0)) complete,
|
|
|
- sum(if(a.project_status in (2,3,29),commodity_quantity,0)) stop from t_order_task a left join task_time b on a.id=b.tid
|
|
|
- where a.split_status in (0,2) and b.project_status =a.project_status and a.task_receiver = #{aid}
|
|
|
- and b.date_time BETWEEN #{startTime} and #{endTime} group by a.task_receiver )y on a.id=y.aid
|
|
|
- left join (select aid,sum(if(a.`type` in (0,1,2),1,0)) countPublicRelease,sum(if(a.`type` in (3),1,0)) countAssist
|
|
|
- from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid} and a.status =2
|
|
|
- and a.release_start BETWEEN #{startTime} and #{endTime} group by a.aid)z on a.id=z.aid
|
|
|
+ sum(if(a.project_status=1,commodity_quantity,0)) inProgress,
|
|
|
+ sum(if(a.project_status=0,commodity_quantity,0)) notStarted from t_order_task a where a.split_status in (0,2)
|
|
|
+ and a.task_receiver = #{aid} and a.task_distribution_time BETWEEN #{startTime} and #{endTime} group by a.task_receiver )x on a.id=x.aid
|
|
|
+ left join (SELECT a.task_receiver aid,sum(if(a.project_status in (19,27) ,commodity_quantity,0)) complete,
|
|
|
+ sum(if(a.project_status in (2,3,29),commodity_quantity,0)) stop from t_order_task a left join task_time b on a.id=b.tid
|
|
|
+ where a.split_status in (0,2) and b.project_status =a.project_status and a.task_receiver = #{aid}
|
|
|
+ and b.date_time BETWEEN #{startTime} and #{endTime} group by a.task_receiver )y on a.id=y.aid
|
|
|
+ left join (select aid,sum(if(a.`type` in (0,1,2),1,0)) countPublicRelease,sum(if(a.`type` in (3),1,0)) countAssist
|
|
|
+ from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid} and a.status =2
|
|
|
+ and a.release_start BETWEEN #{startTime} and #{endTime} group by a.aid)z on a.id=z.aid
|
|
|
where a.id=#{aid}
|
|
|
</select>
|
|
|
<select id="consultantthisMonthUser" resultType="com.goafanti.admin.bo.ConsultantUserCount">
|
|
|
select x.dates,sum(projectCount)projectCount,sum(inProgress)inProgress,sum(notStarted)notStarted
|
|
|
,0 complete,0 stop,0 countPublicRelease,0 countAssist
|
|
|
from (select commodity_quantity projectCount, if(a.project_status=1,commodity_quantity,0)inProgress,
|
|
|
- if(a.project_status=0,commodity_quantity,0)notStarted,DATE_FORMAT(a.task_distribution_time,'%Y-%m-%d') dates
|
|
|
- from t_order_task a where a.split_status in (0,2) and a.task_receiver = #{aid}
|
|
|
- and a.task_distribution_time BETWEEN #{firstDay} and #{endDay})x
|
|
|
+ if(a.project_status=0,commodity_quantity,0)notStarted,DATE_FORMAT(a.task_distribution_time,'%Y-%m-%d') dates
|
|
|
+ from t_order_task a where a.split_status in (0,2) and a.task_receiver = #{aid}
|
|
|
+ and a.task_distribution_time BETWEEN #{firstDay} and #{endDay})x
|
|
|
group by x.dates
|
|
|
union
|
|
|
select x.dates,0 projectCount,0 inProgress,0 notStarted,sum(complete)complete,sum(stop)stop,0,0
|
|
|
from (SELECT if(a.project_status in (19,27) ,commodity_quantity,0) complete,
|
|
|
- if(a.project_status in (2,3,29),commodity_quantity,0) stop ,DATE_FORMAT(b.date_time ,'%Y-%m-%d') dates
|
|
|
- from t_order_task a left join task_time b on a.id=b.tid
|
|
|
- where a.split_status in (0,2) and b.project_status =a.project_status
|
|
|
- and a.task_receiver = #{aid} and b.date_time BETWEEN #{firstDay} and #{endDay})x
|
|
|
+ if(a.project_status in (2,3,29),commodity_quantity,0) stop ,DATE_FORMAT(b.date_time ,'%Y-%m-%d') dates
|
|
|
+ from t_order_task a left join task_time b on a.id=b.tid
|
|
|
+ where a.split_status in (0,2) and b.project_status =a.project_status
|
|
|
+ and a.task_receiver = #{aid} and b.date_time BETWEEN #{firstDay} and #{endDay})x
|
|
|
group by x.dates
|
|
|
union
|
|
|
select x.dates,0,0,0,0,0,sum(countPublicRelease)countPublicRelease,sum(countAssist)countAssist
|
|
|
from ( select if(a.`type` in (0,1,2),1,0) countPublicRelease,if(a.`type` in (3),1,0) countAssist,
|
|
|
- DATE_FORMAT(a.release_start ,'%Y-%m-%d') dates
|
|
|
- from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid}
|
|
|
- and a.status =2
|
|
|
- and a.release_start BETWEEN #{firstDay} and #{endDay})x
|
|
|
+ DATE_FORMAT(a.release_start ,'%Y-%m-%d') dates
|
|
|
+ from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid}
|
|
|
+ and a.status =2
|
|
|
+ and a.release_start BETWEEN #{firstDay} and #{endDay})x
|
|
|
group by x.dates
|
|
|
</select>
|
|
|
<select id="selectOrderByFinanace" resultType="com.goafanti.common.model.Admin">
|
|
|
select c.id,c.name
|
|
|
from t_order_new a left join department b on a.order_dep=b.id
|
|
|
- left join admin c on b.finance_id=c.id
|
|
|
+ left join admin c on b.finance_id=c.id
|
|
|
where a.order_no =#{orderNo};
|
|
|
</select>
|
|
|
<select id="selectAdminByRoleTypes" resultType="com.goafanti.common.model.Admin">
|
|
|
@@ -1402,24 +1408,24 @@
|
|
|
#{e}
|
|
|
</foreach>
|
|
|
</select>
|
|
|
- <select id="financeInfo" resultType="com.goafanti.admin.bo.OutFinanceCount">
|
|
|
- select x.aid,x.orderCount,x.expenseCount,x.invoiceCount,x.memberCount,x.paymentCount,b.counts publicCount,y.orderUnauditedCount,
|
|
|
- c.counts receivables,y.expenseUnauditedCount,y.invoiceUnauditedCount,y.memberUnauditedCount,y.paymentUnauditedCount
|
|
|
- from ( select a.aid,sum(a.order_count)orderCount ,sum(a.expense_count)expenseCount ,SUM(a.invoice_count) invoiceCount,
|
|
|
- sum(a.member_count) memberCount ,sum(a.payment_count)paymentCount from finance_count a where a.aid= #{aid} )x
|
|
|
- left join(select aid,sum(if(a.`type` in (0,1,2),1,0)) counts from public_release a left join public_release_details b on a.id=b.prid
|
|
|
- where a.status=2 and a.aid= #{aid} )b on x.aid=b.aid
|
|
|
- left join (SELECT c.finance_id aid,sum(a.money) counts from new_order_dun a left join t_order_new b on a.order_no =b.order_no
|
|
|
- left join department c on b.order_dep =c.id where a.status =1 and b.delete_sign in (0,2,3) and c.finance_id = #{aid} )c on x.aid=c.aid
|
|
|
- left join (select a.aid,sum(a.order_unaudited_count)orderUnauditedCount , sum(a.expense_unaudited_count)expenseUnauditedCount ,
|
|
|
- SUM(a.invoice_unaudited_count) invoiceUnauditedCount, sum(a.member_unaudited_count) memberUnauditedCount ,
|
|
|
- sum(a.payment_unaudited_count)paymentUnauditedCount from finance_count a where a.aid= #{aid}
|
|
|
- and a.date_time BETWEEN #{startTime} and #{endTime} group by a.aid)y on x.aid=y.aid
|
|
|
- </select>
|
|
|
+ <select id="financeInfo" resultType="com.goafanti.admin.bo.OutFinanceCount">
|
|
|
+ select x.aid,x.orderCount,x.expenseCount,x.invoiceCount,x.memberCount,x.paymentCount,b.counts publicCount,y.orderUnauditedCount,
|
|
|
+ c.counts receivables,y.expenseUnauditedCount,y.invoiceUnauditedCount,y.memberUnauditedCount,y.paymentUnauditedCount
|
|
|
+ from ( select a.aid,sum(a.order_count)orderCount ,sum(a.expense_count)expenseCount ,SUM(a.invoice_count) invoiceCount,
|
|
|
+ sum(a.member_count) memberCount ,sum(a.payment_count)paymentCount from finance_count a where a.aid= #{aid} )x
|
|
|
+ left join(select aid,sum(if(a.`type` in (0,1,2),1,0)) counts from public_release a left join public_release_details b on a.id=b.prid
|
|
|
+ where a.status=2 and a.aid= #{aid} )b on x.aid=b.aid
|
|
|
+ left join (SELECT c.finance_id aid,sum(a.money) counts from new_order_dun a left join t_order_new b on a.order_no =b.order_no
|
|
|
+ left join department c on b.order_dep =c.id where a.status =1 and b.delete_sign in (0,2,3) and c.finance_id = #{aid} )c on x.aid=c.aid
|
|
|
+ left join (select a.aid,sum(a.order_unaudited_count)orderUnauditedCount , sum(a.expense_unaudited_count)expenseUnauditedCount ,
|
|
|
+ SUM(a.invoice_unaudited_count) invoiceUnauditedCount, sum(a.member_unaudited_count) memberUnauditedCount ,
|
|
|
+ sum(a.payment_unaudited_count)paymentUnauditedCount from finance_count a where a.aid= #{aid}
|
|
|
+ and a.date_time BETWEEN #{startTime} and #{endTime} group by a.aid)y on x.aid=y.aid
|
|
|
+ </select>
|
|
|
<select id="financeCountRangeReceivables" resultType="java.math.BigDecimal">
|
|
|
SELECT ifnull(sum(a.money),0) receivables
|
|
|
from new_order_dun a left join t_order_new b on a.order_no =b.order_no
|
|
|
- left join department c on b.order_dep =c.id
|
|
|
+ left join department c on b.order_dep =c.id
|
|
|
where a.status =1 and b.delete_sign in (0,2,3)
|
|
|
and c.finance_id = #{aid}
|
|
|
and a.start_time between #{startTime} and #{endTime}
|
|
|
@@ -1430,7 +1436,7 @@
|
|
|
from new_order_change a left join t_order_new b on a.order_no =b.order_no
|
|
|
left join department c on b.order_dep =c.id
|
|
|
where a.process_state in (6,8,9) and a.status in(1,2) and b.delete_sign in (0,2,3)
|
|
|
- and c.finance_id = #{aid}
|
|
|
+ and c.finance_id = #{aid}
|
|
|
|
|
|
</select>
|
|
|
<select id="selectFinanceReceivablesCount" resultType="java.math.BigDecimal">
|