|
|
@@ -2,35 +2,77 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.goafanti.common.dao.TTaskMidMapper">
|
|
|
<resultMap id="BaseResultMap" type="com.goafanti.common.model.TTaskMid">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbg.generated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Fri Dec 25 14:38:43 CST 2020.
|
|
|
+ -->
|
|
|
<id column="id" jdbcType="INTEGER" property="id" />
|
|
|
<result column="tid" jdbcType="INTEGER" property="tid" />
|
|
|
<result column="cost_amount" jdbcType="DECIMAL" property="costAmount" />
|
|
|
<result column="party_amount" jdbcType="DECIMAL" property="partyAmount" />
|
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
|
<result column="certificates_count" jdbcType="INTEGER" property="certificatesCount" />
|
|
|
+ <result column="urgent_day" jdbcType="INTEGER" property="urgentDay" />
|
|
|
+ <result column="if_material" jdbcType="INTEGER" property="ifMaterial" />
|
|
|
+ <result column="reject_count" jdbcType="INTEGER" property="rejectCount" />
|
|
|
+ <result column="accept_count" jdbcType="INTEGER" property="acceptCount" />
|
|
|
+ <result column="end_count" jdbcType="INTEGER" property="endCount" />
|
|
|
+ <result column="authorize_count" jdbcType="INTEGER" property="authorizeCount" />
|
|
|
+ <result column="apply_count" jdbcType="INTEGER" property="applyCount" />
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List">
|
|
|
- id, tid, cost_amount, party_amount, create_time, certificates_count
|
|
|
+ <!--
|
|
|
+ WARNING - @mbg.generated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Fri Dec 25 14:38:43 CST 2020.
|
|
|
+ -->
|
|
|
+ id, tid, cost_amount, party_amount, create_time, certificates_count, urgent_day,
|
|
|
+ if_material, reject_count, accept_count, end_count, authorize_count, apply_count
|
|
|
</sql>
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbg.generated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Fri Dec 25 14:38:43 CST 2020.
|
|
|
+ -->
|
|
|
select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from t_task_mid
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbg.generated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Fri Dec 25 14:38:43 CST 2020.
|
|
|
+ -->
|
|
|
delete from t_task_mid
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</delete>
|
|
|
<insert id="insert" parameterType="com.goafanti.common.model.TTaskMid">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbg.generated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Fri Dec 25 14:38:43 CST 2020.
|
|
|
+ -->
|
|
|
insert into t_task_mid (id, tid, cost_amount,
|
|
|
- party_amount, create_time, certificates_count
|
|
|
- )
|
|
|
+ party_amount, create_time, certificates_count,
|
|
|
+ urgent_day, if_material, reject_count,
|
|
|
+ accept_count, end_count, authorize_count,
|
|
|
+ apply_count)
|
|
|
values (#{id,jdbcType=INTEGER}, #{tid,jdbcType=INTEGER}, #{costAmount,jdbcType=DECIMAL},
|
|
|
- #{partyAmount,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{certificatesCount,jdbcType=INTEGER}
|
|
|
- )
|
|
|
+ #{partyAmount,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{certificatesCount,jdbcType=INTEGER},
|
|
|
+ #{urgentDay,jdbcType=INTEGER}, #{ifMaterial,jdbcType=INTEGER}, #{rejectCount,jdbcType=INTEGER},
|
|
|
+ #{acceptCount,jdbcType=INTEGER}, #{endCount,jdbcType=INTEGER}, #{authorizeCount,jdbcType=INTEGER},
|
|
|
+ #{applyCount,jdbcType=INTEGER})
|
|
|
</insert>
|
|
|
<insert id="insertSelective" parameterType="com.goafanti.common.model.TTaskMid">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbg.generated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Fri Dec 25 14:38:43 CST 2020.
|
|
|
+ -->
|
|
|
insert into t_task_mid
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
<if test="id != null">
|
|
|
@@ -51,6 +93,27 @@
|
|
|
<if test="certificatesCount != null">
|
|
|
certificates_count,
|
|
|
</if>
|
|
|
+ <if test="urgentDay != null">
|
|
|
+ urgent_day,
|
|
|
+ </if>
|
|
|
+ <if test="ifMaterial != null">
|
|
|
+ if_material,
|
|
|
+ </if>
|
|
|
+ <if test="rejectCount != null">
|
|
|
+ reject_count,
|
|
|
+ </if>
|
|
|
+ <if test="acceptCount != null">
|
|
|
+ accept_count,
|
|
|
+ </if>
|
|
|
+ <if test="endCount != null">
|
|
|
+ end_count,
|
|
|
+ </if>
|
|
|
+ <if test="authorizeCount != null">
|
|
|
+ authorize_count,
|
|
|
+ </if>
|
|
|
+ <if test="applyCount != null">
|
|
|
+ apply_count,
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="id != null">
|
|
|
@@ -71,9 +134,35 @@
|
|
|
<if test="certificatesCount != null">
|
|
|
#{certificatesCount,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
+ <if test="urgentDay != null">
|
|
|
+ #{urgentDay,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="ifMaterial != null">
|
|
|
+ #{ifMaterial,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="rejectCount != null">
|
|
|
+ #{rejectCount,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="acceptCount != null">
|
|
|
+ #{acceptCount,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="endCount != null">
|
|
|
+ #{endCount,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="authorizeCount != null">
|
|
|
+ #{authorizeCount,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="applyCount != null">
|
|
|
+ #{applyCount,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TTaskMid">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbg.generated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Fri Dec 25 14:38:43 CST 2020.
|
|
|
+ -->
|
|
|
update t_task_mid
|
|
|
<set>
|
|
|
<if test="tid != null">
|
|
|
@@ -91,19 +180,53 @@
|
|
|
<if test="certificatesCount != null">
|
|
|
certificates_count = #{certificatesCount,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
+ <if test="urgentDay != null">
|
|
|
+ urgent_day = #{urgentDay,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="ifMaterial != null">
|
|
|
+ if_material = #{ifMaterial,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="rejectCount != null">
|
|
|
+ reject_count = #{rejectCount,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="acceptCount != null">
|
|
|
+ accept_count = #{acceptCount,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="endCount != null">
|
|
|
+ end_count = #{endCount,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="authorizeCount != null">
|
|
|
+ authorize_count = #{authorizeCount,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="applyCount != null">
|
|
|
+ apply_count = #{applyCount,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
</set>
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
<update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TTaskMid">
|
|
|
+ <!--
|
|
|
+ WARNING - @mbg.generated
|
|
|
+ This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
+ This element was generated on Fri Dec 25 14:38:43 CST 2020.
|
|
|
+ -->
|
|
|
update t_task_mid
|
|
|
set tid = #{tid,jdbcType=INTEGER},
|
|
|
cost_amount = #{costAmount,jdbcType=DECIMAL},
|
|
|
party_amount = #{partyAmount,jdbcType=DECIMAL},
|
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
|
- certificates_count = #{certificatesCount,jdbcType=INTEGER}
|
|
|
+ certificates_count = #{certificatesCount,jdbcType=INTEGER},
|
|
|
+ urgent_day = #{urgentDay,jdbcType=INTEGER},
|
|
|
+ if_material = #{ifMaterial,jdbcType=INTEGER},
|
|
|
+ reject_count = #{rejectCount,jdbcType=INTEGER},
|
|
|
+ accept_count = #{acceptCount,jdbcType=INTEGER},
|
|
|
+ end_count = #{endCount,jdbcType=INTEGER},
|
|
|
+ authorize_count = #{authorizeCount,jdbcType=INTEGER},
|
|
|
+ apply_count = #{applyCount,jdbcType=INTEGER}
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
|
|
|
+
|
|
|
<update id="updatePaymentAmount">
|
|
|
update t_task_mid
|
|
|
<if test="type == 0">
|
|
|
@@ -147,11 +270,35 @@
|
|
|
</set>
|
|
|
where tid = #{tid,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
+ <select id="selectCountBytid" resultType="com.goafanti.common.model.TTaskMid">
|
|
|
+ select a.id,
|
|
|
+ <if test="type ==0">
|
|
|
+ ifnull(b.lic,0) certificatesCount
|
|
|
+ </if>
|
|
|
+ <if test="type ==1">
|
|
|
+ ifnull(b.acc ,0)acceptCount, ifnull(b.lic ,0)authorizeCount,ifnull(b.lic ,0)certificatesCount,
|
|
|
+ ifnull(b.tgc ,0)endCount,ifnull(b.bhc ,0)rejectCount
|
|
|
+ </if>
|
|
|
+ <if test="type ==2">
|
|
|
+ ifnull(b.acc ,0)acceptCount,ifnull(b.lic ,0)certificatesCount,ifnull(b.sqc,0) applyCount
|
|
|
+ </if>
|
|
|
+ from t_task_mid a left join (select task_id tid,
|
|
|
+ <if test="type ==0">
|
|
|
+ sum(if(licence_time is null,0,1))lic from task_progress where task_id= #{tid} GROUP by task_id)b
|
|
|
+ </if>
|
|
|
+ <if test="type ==1">
|
|
|
+ <!-- 下证数与授权数一样,下证统计大于则用下证,小于或者等于用授权统计 -->
|
|
|
+ sum(if(if(licence_time is null,0,1) > if(authorize_time is null,0,1),
|
|
|
+ if(licence_time is null,0,1),if(authorize_time is null,0,1)))lic ,ifnull(count(accept_time),0)acc,
|
|
|
+ sum(if(status=1,1,0))tgc,sum(if(status=2 ,1,0))bhc from task_progress where task_id= #{tid} GROUP by task_id )b
|
|
|
+ </if>
|
|
|
+ <if test="type ==2">
|
|
|
+ count(*)sqc, sum(if(licence_time is null,0,1))lic , sum(if(accept_time is null,0,1))acc,
|
|
|
+ sum(if(status=2 ,1,0))bhc from task_progress where task_id= #{tid} GROUP by task_id )b
|
|
|
+ </if>
|
|
|
+ on a.tid =b.tid
|
|
|
+ where a.tid= #{tid}
|
|
|
+ </select>
|
|
|
|
|
|
- <update id="updateCountBytid">
|
|
|
- update t_task_mid a,(select task_id tid,ifnull(count(licence_time),0)lic ,ifnull(count(accept_time),0)acc,ifnull(count(authorize_time),0)auc,
|
|
|
- count(if(status=1,1,0))tgc,count(if(status ,2,0))bhc from task_progress where task_id= #{tid} GROUP by task_id )b
|
|
|
- set a.accept_count =b.acc,a.authorize_count =b.auc,a.certificates_count =b.lic,a.end_count =b.tgc,a.reject_count =b.bhc
|
|
|
- where a.tid =b.tid
|
|
|
- </update>
|
|
|
+
|
|
|
</mapper>
|