| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853 |
- <?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="com.goafanti.common.dao.PublicReleaseMapper">
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.PublicRelease">
- <id property="id" column="id" jdbcType="INTEGER"/>
- <result property="aid" column="aid" jdbcType="VARCHAR"/>
- <result property="releaseStart" column="release_start" jdbcType="TIMESTAMP"/>
- <result property="releaseEnd" column="release_end" jdbcType="TIMESTAMP"/>
- <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
- <result property="annexUrl" column="annex_url" jdbcType="VARCHAR"/>
- <result property="status" column="status" jdbcType="INTEGER"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="pid" column="pid" jdbcType="VARCHAR"/>
- <result property="pname" column="pname" jdbcType="VARCHAR"/>
- <result property="duration" column="duration" jdbcType="DOUBLE"/>
- <result property="validDate" column="valid_date" jdbcType="VARCHAR"/>
- <result property="supplement" column="supplement" jdbcType="VARCHAR"/>
- <result property="auditInfo" column="audit_info" jdbcType="VARCHAR"/>
- <result property="plan" column="plan" jdbcType="VARCHAR"/>
- <result property="expectedEffect" column="expected_effect" jdbcType="VARCHAR"/>
- <result property="nextPlan" column="next_plan" jdbcType="VARCHAR"/>
- <result property="type" column="type" jdbcType="INTEGER"/>
- <result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
- <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
- <result property="updateStatus" column="update_status" jdbcType="INTEGER"/>
- <result property="assist" column="assist" jdbcType="INTEGER"/>
- <result property="assistAid" column="assist_aid" jdbcType="VARCHAR"/>
- <result property="assistAidName" column="assist_aid_name" jdbcType="VARCHAR"/>
- <result property="mainId" column="main_id" jdbcType="INTEGER"/>
- <result property="mainName" column="main_name" jdbcType="VARCHAR"/>
- <result property="rejectName" column="reject_name" jdbcType="VARCHAR"/>
- <result property="assistantAid" column="assistant_aid" jdbcType="VARCHAR"/>
- <result property="assistantName" column="assistant_name" jdbcType="VARCHAR"/>
- <result property="publicAgain" column="public_again" jdbcType="INTEGER"/>
- <result property="auditTime" column="audit_time" jdbcType="TIMESTAMP"/>
- <result property="newUser" column="new_user" jdbcType="VARCHAR"/>
- <result property="signSum" column="sign_sum" jdbcType="VARCHAR"/>
- <result property="userNames" column="user_names" jdbcType="VARCHAR"/>
- <result property="objectType" column="object_type" jdbcType="INTEGER"/>
- <result property="publicType" column="public_type" jdbcType="INTEGER"/>
- <result property="districtName" column="district_name" jdbcType="VARCHAR"/>
- <result property="clockIn" column="clock_in" jdbcType="INTEGER"/>
- <result property="techStartProcess" column="tech_start_process" jdbcType="INTEGER"/>
- <result property="addressName" column="address_name" jdbcType="VARCHAR"/>
- </resultMap>
- <sql id="Base_Column_List">
- id,aid,release_start,
- release_end,remarks,annex_url,
- status,create_time,pid,
- pname,duration,valid_date,
- supplement,audit_info,plan,
- expected_effect,next_plan,type,
- order_no,update_time,update_status,
- assist,assist_aid,assist_aid_name,
- main_id,main_name,reject_name,
- assistant_aid,assistant_name,public_again,
- audit_time,new_user,sign_sum,
- user_names,object_type,public_type,
- district_name,clock_in,tech_start_process,
- address_name
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from public_release
- where id = #{id,jdbcType=INTEGER}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
- delete from public_release
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicRelease" useGeneratedKeys="true">
- insert into public_release
- ( id,aid,release_start
- ,release_end,remarks,annex_url
- ,status,create_time,pid
- ,pname,duration,valid_date
- ,supplement,audit_info,plan
- ,expected_effect,next_plan,type
- ,order_no,update_time,update_status
- ,assist,assist_aid,assist_aid_name
- ,main_id,main_name,reject_name
- ,assistant_aid,assistant_name,public_again
- ,audit_time,new_user,sign_sum
- ,user_names,object_type,public_type
- ,district_name,clock_in,tech_start_process
- ,address_name)
- values (#{id,jdbcType=INTEGER},#{aid,jdbcType=VARCHAR},#{releaseStart,jdbcType=TIMESTAMP}
- ,#{releaseEnd,jdbcType=TIMESTAMP},#{remarks,jdbcType=VARCHAR},#{annexUrl,jdbcType=VARCHAR}
- ,#{status,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{pid,jdbcType=VARCHAR}
- ,#{pname,jdbcType=VARCHAR},#{duration,jdbcType=DOUBLE},#{validDate,jdbcType=VARCHAR}
- ,#{supplement,jdbcType=VARCHAR},#{auditInfo,jdbcType=VARCHAR},#{plan,jdbcType=VARCHAR}
- ,#{expectedEffect,jdbcType=VARCHAR},#{nextPlan,jdbcType=VARCHAR},#{type,jdbcType=INTEGER}
- ,#{orderNo,jdbcType=VARCHAR},#{updateTime,jdbcType=TIMESTAMP},#{updateStatus,jdbcType=INTEGER}
- ,#{assist,jdbcType=INTEGER},#{assistAid,jdbcType=VARCHAR},#{assistAidName,jdbcType=VARCHAR}
- ,#{mainId,jdbcType=INTEGER},#{mainName,jdbcType=VARCHAR},#{rejectName,jdbcType=VARCHAR}
- ,#{assistantAid,jdbcType=VARCHAR},#{assistantName,jdbcType=VARCHAR},#{publicAgain,jdbcType=INTEGER}
- ,#{auditTime,jdbcType=TIMESTAMP},#{newUser,jdbcType=VARCHAR},#{signSum,jdbcType=VARCHAR}
- ,#{userNames,jdbcType=VARCHAR},#{objectType,jdbcType=INTEGER},#{publicType,jdbcType=INTEGER}
- ,#{districtName,jdbcType=VARCHAR},#{clockIn,jdbcType=INTEGER},#{techStartProcess,jdbcType=INTEGER}
- ,#{addressName,jdbcType=VARCHAR})
- </insert>
- <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicRelease" useGeneratedKeys="true">
- insert into public_release
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="aid != null">aid,</if>
- <if test="releaseStart != null">release_start,</if>
- <if test="releaseEnd != null">release_end,</if>
- <if test="remarks != null">remarks,</if>
- <if test="annexUrl != null">annex_url,</if>
- <if test="status != null">status,</if>
- <if test="createTime != null">create_time,</if>
- <if test="pid != null">pid,</if>
- <if test="pname != null">pname,</if>
- <if test="duration != null">duration,</if>
- <if test="validDate != null">valid_date,</if>
- <if test="supplement != null">supplement,</if>
- <if test="auditInfo != null">audit_info,</if>
- <if test="plan != null">plan,</if>
- <if test="expectedEffect != null">expected_effect,</if>
- <if test="nextPlan != null">next_plan,</if>
- <if test="type != null">type,</if>
- <if test="orderNo != null">order_no,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="updateStatus != null">update_status,</if>
- <if test="assist != null">assist,</if>
- <if test="assistAid != null">assist_aid,</if>
- <if test="assistAidName != null">assist_aid_name,</if>
- <if test="mainId != null">main_id,</if>
- <if test="mainName != null">main_name,</if>
- <if test="rejectName != null">reject_name,</if>
- <if test="assistantAid != null">assistant_aid,</if>
- <if test="assistantName != null">assistant_name,</if>
- <if test="publicAgain != null">public_again,</if>
- <if test="auditTime != null">audit_time,</if>
- <if test="newUser != null">new_user,</if>
- <if test="signSum != null">sign_sum,</if>
- <if test="userNames != null">user_names,</if>
- <if test="objectType != null">object_type,</if>
- <if test="publicType != null">public_type,</if>
- <if test="districtName != null">district_name,</if>
- <if test="clockIn != null">clock_in,</if>
- <if test="techStartProcess != null">tech_start_process,</if>
- <if test="addressName != null">address_name,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id,jdbcType=INTEGER},</if>
- <if test="aid != null">#{aid,jdbcType=VARCHAR},</if>
- <if test="releaseStart != null">#{releaseStart,jdbcType=TIMESTAMP},</if>
- <if test="releaseEnd != null">#{releaseEnd,jdbcType=TIMESTAMP},</if>
- <if test="remarks != null">#{remarks,jdbcType=VARCHAR},</if>
- <if test="annexUrl != null">#{annexUrl,jdbcType=VARCHAR},</if>
- <if test="status != null">#{status,jdbcType=INTEGER},</if>
- <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
- <if test="pid != null">#{pid,jdbcType=VARCHAR},</if>
- <if test="pname != null">#{pname,jdbcType=VARCHAR},</if>
- <if test="duration != null">#{duration,jdbcType=DOUBLE},</if>
- <if test="validDate != null">#{validDate,jdbcType=VARCHAR},</if>
- <if test="supplement != null">#{supplement,jdbcType=VARCHAR},</if>
- <if test="auditInfo != null">#{auditInfo,jdbcType=VARCHAR},</if>
- <if test="plan != null">#{plan,jdbcType=VARCHAR},</if>
- <if test="expectedEffect != null">#{expectedEffect,jdbcType=VARCHAR},</if>
- <if test="nextPlan != null">#{nextPlan,jdbcType=VARCHAR},</if>
- <if test="type != null">#{type,jdbcType=INTEGER},</if>
- <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if>
- <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
- <if test="updateStatus != null">#{updateStatus,jdbcType=INTEGER},</if>
- <if test="assist != null">#{assist,jdbcType=INTEGER},</if>
- <if test="assistAid != null">#{assistAid,jdbcType=VARCHAR},</if>
- <if test="assistAidName != null">#{assistAidName,jdbcType=VARCHAR},</if>
- <if test="mainId != null">#{mainId,jdbcType=INTEGER},</if>
- <if test="mainName != null">#{mainName,jdbcType=VARCHAR},</if>
- <if test="rejectName != null">#{rejectName,jdbcType=VARCHAR},</if>
- <if test="assistantAid != null">#{assistantAid,jdbcType=VARCHAR},</if>
- <if test="assistantName != null">#{assistantName,jdbcType=VARCHAR},</if>
- <if test="publicAgain != null">#{publicAgain,jdbcType=INTEGER},</if>
- <if test="auditTime != null">#{auditTime,jdbcType=TIMESTAMP},</if>
- <if test="newUser != null">#{newUser,jdbcType=VARCHAR},</if>
- <if test="signSum != null">#{signSum,jdbcType=VARCHAR},</if>
- <if test="userNames != null">#{userNames,jdbcType=VARCHAR},</if>
- <if test="objectType != null">#{objectType,jdbcType=INTEGER},</if>
- <if test="publicType != null">#{publicType,jdbcType=INTEGER},</if>
- <if test="districtName != null">#{districtName,jdbcType=VARCHAR},</if>
- <if test="clockIn != null">#{clockIn,jdbcType=INTEGER},</if>
- <if test="techStartProcess != null">#{techStartProcess,jdbcType=INTEGER},</if>
- <if test="addressName != null">#{addressName,jdbcType=VARCHAR},</if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PublicRelease">
- update public_release
- <set>
- <if test="aid != null">
- aid = #{aid,jdbcType=VARCHAR},
- </if>
- <if test="releaseStart != null">
- release_start = #{releaseStart,jdbcType=TIMESTAMP},
- </if>
- <if test="releaseEnd != null">
- release_end = #{releaseEnd,jdbcType=TIMESTAMP},
- </if>
- <if test="remarks != null">
- remarks = #{remarks,jdbcType=VARCHAR},
- </if>
- <if test="annexUrl != null">
- annex_url = #{annexUrl,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- status = #{status,jdbcType=INTEGER},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="pid != null">
- pid = #{pid,jdbcType=VARCHAR},
- </if>
- <if test="pname != null">
- pname = #{pname,jdbcType=VARCHAR},
- </if>
- <if test="duration != null">
- duration = #{duration,jdbcType=DOUBLE},
- </if>
- <if test="validDate != null">
- valid_date = #{validDate,jdbcType=VARCHAR},
- </if>
- <if test="supplement != null">
- supplement = #{supplement,jdbcType=VARCHAR},
- </if>
- <if test="auditInfo != null">
- audit_info = #{auditInfo,jdbcType=VARCHAR},
- </if>
- <if test="plan != null">
- plan = #{plan,jdbcType=VARCHAR},
- </if>
- <if test="expectedEffect != null">
- expected_effect = #{expectedEffect,jdbcType=VARCHAR},
- </if>
- <if test="nextPlan != null">
- next_plan = #{nextPlan,jdbcType=VARCHAR},
- </if>
- <if test="type != null">
- type = #{type,jdbcType=INTEGER},
- </if>
- <if test="orderNo != null">
- order_no = #{orderNo,jdbcType=VARCHAR},
- </if>
- <if test="updateTime != null">
- update_time = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateStatus != null">
- update_status = #{updateStatus,jdbcType=INTEGER},
- </if>
- <if test="assist != null">
- assist = #{assist,jdbcType=INTEGER},
- </if>
- <if test="assistAid != null">
- assist_aid = #{assistAid,jdbcType=VARCHAR},
- </if>
- <if test="assistAidName != null">
- assist_aid_name = #{assistAidName,jdbcType=VARCHAR},
- </if>
- <if test="mainId != null">
- main_id = #{mainId,jdbcType=INTEGER},
- </if>
- <if test="mainName != null">
- main_name = #{mainName,jdbcType=VARCHAR},
- </if>
- <if test="rejectName != null">
- reject_name = #{rejectName,jdbcType=VARCHAR},
- </if>
- <if test="assistantAid != null">
- assistant_aid = #{assistantAid,jdbcType=VARCHAR},
- </if>
- <if test="assistantName != null">
- assistant_name = #{assistantName,jdbcType=VARCHAR},
- </if>
- <if test="publicAgain != null">
- public_again = #{publicAgain,jdbcType=INTEGER},
- </if>
- <if test="auditTime != null">
- audit_time = #{auditTime,jdbcType=TIMESTAMP},
- </if>
- <if test="newUser != null">
- new_user = #{newUser,jdbcType=VARCHAR},
- </if>
- <if test="signSum != null">
- sign_sum = #{signSum,jdbcType=VARCHAR},
- </if>
- <if test="userNames != null">
- user_names = #{userNames,jdbcType=VARCHAR},
- </if>
- <if test="objectType != null">
- object_type = #{objectType,jdbcType=INTEGER},
- </if>
- <if test="publicType != null">
- public_type = #{publicType,jdbcType=INTEGER},
- </if>
- <if test="districtName != null">
- district_name = #{districtName,jdbcType=VARCHAR},
- </if>
- <if test="clockIn != null">
- clock_in = #{clockIn,jdbcType=INTEGER},
- </if>
- <if test="techStartProcess != null">
- tech_start_process = #{techStartProcess,jdbcType=INTEGER},
- </if>
- <if test="addressName != null">
- address_name = #{addressName,jdbcType=VARCHAR},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.PublicRelease">
- update public_release
- set
- aid = #{aid,jdbcType=VARCHAR},
- release_start = #{releaseStart,jdbcType=TIMESTAMP},
- release_end = #{releaseEnd,jdbcType=TIMESTAMP},
- remarks = #{remarks,jdbcType=VARCHAR},
- annex_url = #{annexUrl,jdbcType=VARCHAR},
- status = #{status,jdbcType=INTEGER},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- pid = #{pid,jdbcType=VARCHAR},
- pname = #{pname,jdbcType=VARCHAR},
- duration = #{duration,jdbcType=DOUBLE},
- valid_date = #{validDate,jdbcType=VARCHAR},
- supplement = #{supplement,jdbcType=VARCHAR},
- audit_info = #{auditInfo,jdbcType=VARCHAR},
- plan = #{plan,jdbcType=VARCHAR},
- expected_effect = #{expectedEffect,jdbcType=VARCHAR},
- next_plan = #{nextPlan,jdbcType=VARCHAR},
- type = #{type,jdbcType=INTEGER},
- order_no = #{orderNo,jdbcType=VARCHAR},
- update_time = #{updateTime,jdbcType=TIMESTAMP},
- update_status = #{updateStatus,jdbcType=INTEGER},
- assist = #{assist,jdbcType=INTEGER},
- assist_aid = #{assistAid,jdbcType=VARCHAR},
- assist_aid_name = #{assistAidName,jdbcType=VARCHAR},
- main_id = #{mainId,jdbcType=INTEGER},
- main_name = #{mainName,jdbcType=VARCHAR},
- reject_name = #{rejectName,jdbcType=VARCHAR},
- assistant_aid = #{assistantAid,jdbcType=VARCHAR},
- assistant_name = #{assistantName,jdbcType=VARCHAR},
- public_again = #{publicAgain,jdbcType=INTEGER},
- audit_time = #{auditTime,jdbcType=TIMESTAMP},
- new_user = #{newUser,jdbcType=VARCHAR},
- sign_sum = #{signSum,jdbcType=VARCHAR},
- user_names = #{userNames,jdbcType=VARCHAR},
- object_type = #{objectType,jdbcType=INTEGER},
- public_type = #{publicType,jdbcType=INTEGER},
- district_name = #{districtName,jdbcType=VARCHAR},
- clock_in = #{clockIn,jdbcType=INTEGER},
- tech_start_process = #{techStartProcess,jdbcType=INTEGER},
- address_name = #{addressName,jdbcType=VARCHAR}
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateSignByAidAndUid">
- update public_release_details a left join public_release b on a.prid =b.id
- left join `user` c on a.uid=c.id
- set a.sign_sum =a.sign_sum +1
- where a.uid= #{uid} and a.main_status =1 and b.aid= #{aid}
- </update>
- <select id="listPublicRelease" resultType="com.goafanti.weChat.bo.OutPublicReleaseList">
- select a.id ,c.name aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.aid,a.public_type publicType,
- date_format(a.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,a.status,
- date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_status updateStatus,a.district_name districtName,
- a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,a.type,a.main_name mainName,a.reject_name rejectName,
- a.assistant_aid assistantAid ,a.assistant_name assistantName,a.public_again publicAgain,a.user_names userNames,
- ea.total_amount expenseAmount ,a.clock_in clockIn,c2.name reviewerName,
- <if test="type==4 or type==5">
- ad.name userAdminName,
- </if>
- a.tech_start_process techStartProcess
- from public_release a left join admin c on a.aid =c.id
- left join admin c2 on c.reviewer=c2.id
- left join expense_account ea ON a.id = ea.prid AND ea.status IN (0, 1, 2, 3)
- <if test="type==2">
- left join department d on c.department_id =d.id
- </if>
- <if test="type==4 or type==5 or userName !=null">
- left join public_release_details b on a.id=b.prid
- left join user e on b.uid=e.id left join admin ad on e.aid=ad.id
- </if>
- <if test="type==5">
- left join t_order_new ton on a.order_no =ton.order_no
- left join t_order_mid tom on a.order_no=tom.order_no
- </if>
- <if test="type==6">
- left join admin_public_reviewer apr on a.aid=apr.aid and apr.reviewer_id= #{aid}
- </if>
- where 1=1
- <include refid="listPublicReleaseSql"/>
- ORDER BY (case when a.status=1 then 1 when a.status=2 then 2 when a.status=3 then 5
- when a.status=0 then 3 when a.status=4 then 4 else 0 end),a.create_time desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <sql id="listPublicReleaseSql">
- <if test="type==0">
- and a.public_type in (0,1,2,3)
- <if test="assist ==0">
- and a.assist in(0,1)
- </if>
- <if test="assist == 2">
- and a.assist =2
- </if>
- <if test="assist == 3">
- and a.assist =3
- </if>
- <if test="assist ==4">
- and a.assist in (2,3)
- </if>
- <if test="assistType ==1">
- and a.assist in(0,1,2)
- </if>
- <if test="aid !=null">
- and a.aid= #{aid}
- </if>
- <if test="statusType ==1">
- and a.status in (0,1,2,4)
- </if>
- </if>
- <if test="type==1">
- and a.public_type in (0,2)
- and a.assist in(0,1)
- and a.tech_start_process in (0,2)
- and c.reviewer = #{aid}
- </if>
- <if test="type==2">
- and a.public_type in (0,2)
- and a.assist in(0,1)
- and d.manager_id = #{aid}
- </if>
- <if test="type==3">
- and a.public_type in (0,2)
- and a.assist=2
- <if test="aid !=null">
- and a.aid= #{aid}
- </if>
- and a.type = #{type}
- </if>
- <if test="type==4">
- and a.assist in(0,1)
- and e.aid = #{aid}
- and a.status=1
- <if test="status==null">and a.public_type in (1,2) </if>
- <if test="status==1">and a.public_type in (1) </if>
- <if test="status==2">and a.public_type in (2) </if>
- </if>
- <if test="type==5">
- and e.aid =#{aid}
- and a.status=1
- <if test="status==null">and a.tech_start_process in (1,2) </if>
- <if test="status==1">and a.tech_start_process in (1) </if>
- <if test="status==2">and a.tech_start_process in (2) </if>
- </if>
- <if test="type==6">
- and a.type=3 and a.assist=2
- </if>
- <if test="clockIn !=null">
- and a.clock_in =#{clockIn}
- </if>
- <if test="clockTime !=null">
- and a.release_start < #{clockTime} and a.release_end > #{clockTime}
- </if>
- <if test="releaseStarts != null and publicEnd != null">
- and a.release_start BETWEEN #{releaseStarts} and #{publicEnd}
- </if>
- <if test="userName !=null">
- and e.nickname like concat('%',#{userName},'%')
- </if>
- <if test="type!=4 and type !=5">
- <if test="status !=null ">
- and a.status = #{status}
- </if>
- </if>
- </sql>
- <select id="countPublicRelease" resultType="java.lang.Integer">
- select count(*)
- from public_release a left join admin c on a.aid =c.id
- <if test="type==2">
- left join department d on c.department_id =d.id
- </if>
- <if test="type==4 or type==5 or userName !=null">
- left join public_release_details b on a.id=b.prid
- left join user e on b.uid=e.id left join admin ad on e.aid=ad.id
- </if>
- where 1=1
- <include refid="listPublicReleaseSql"/>
- </select>
- <select id="selectDtails" resultType="com.goafanti.weChat.bo.OutPublicRelease">
- select a.id,c.name aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.update_time updateTime,a.user_names userNames,
- date_format(a.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,a.status,
- a.annex_url annexUrl ,a.remarks,a.duration ,a.valid_date validDate ,a.aid ,c.superior_id suprId,a.tech_start_process techStartProcess,
- a.plan ,a.expected_effect expectedEffect,a.next_plan nextPlan,c.reviewer,a.type,a.order_no orderNo,d.contract_no contractNo,a.address_name addressName,
- date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_Status updateStatus,a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,
- a.main_name mainName,a.assistant_aid assistantAid,a.assistant_name assistantName,a.public_again publicAhain,x.uids,a.public_type publicType,c2.name reviewerName
- from public_release a left join admin c on a.aid =c.id left join admin c2 on c.reviewer =c2.id
- left join (select prid ,GROUP_CONCAT(uid)uids from public_release_details where prid= #{id} group by prid)x on a.id=x.prid
- left join t_order_new d on a.order_no=d.order_no
- where 1=1
- <if test="id !=null">
- and a.id= #{id}
- </if>
- </select>
- <select id="selectDtailsByFid" resultType="com.goafanti.weChat.bo.OutPublicReleaseAndDetails">
- select a.id,c.name aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.update_time updateTime,a.user_names userNames,
- date_format(a.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,a.status,
- a.annex_url annexUrl ,a.remarks,a.duration ,a.valid_date validDate ,a.aid ,c.superior_id suprId,x.uid uids,x.district_name districtName ,u.nickname,
- a.plan ,a.expected_effect expectedEffect,a.next_plan nextPlan,c.reviewer,a.type,a.order_no orderNo,d.contract_no contractNo,
- date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_Status updateStatus,a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,
- a.main_name mainName,a.assistant_aid assistantAid,a.assistant_name assistantName,a.public_again publicAhain
- from public_release a left join admin c on a.aid =c.id
- left join public_release_details x on a.id=x.prid
- left join user u on x.uid=u.id
- left join t_order_new d on a.order_no=d.order_no
- where 1=1
- <if test="ufid !=null">
- and x.ufid= #{ufid}
- </if>
- </select>
- <select id="listPublicStatistics" resultType="com.goafanti.weChat.bo.OutPublicStatistics">
- select y.aid,y.bh,y.dk,y.wsh,y.tg,y.duration,c.name from(select x.aid ,sum(x.bh)bh,sum(x.wsh)wsh,sum(x.tg)tg,sum(x.dk)dk,sum(x.duration)duration
- from (select a.aid, if(a.status=0,1,0)bh ,if(a.status=1,1,0)wsh,if(a.status=2,1,0)tg,b.dk ,if(a.status=2,a.duration,0)duration
- from public_release a inner join (select prid ,sum(if(clock_in=1,1,0))dk from public_release_details where 1=1
- <if test="clockStart != null and clockEnd != null">
- and clock_in_time between #{clockStart} and #{clockEnd}
- </if>
- group by prid ) b on a.id =b.prid
- left join admin c on a.aid=c.id where 1=1
- <if test="aid != null">
- and a.aid= #{aid}
- </if>
- <if test="createStart != null and createEnd !=null">
- and a.create_time between #{createStart} and #{createEnd}
- </if>
- <if test="depId != null">
- and c.department_id = #{depId}
- </if>
- )x group by x.aid)y left join admin c on c.id=y.aid
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="countPublicStatistics" resultType="java.lang.Integer">
- select count(*) from (select aid from public_release a
- inner join (select prid ,sum(if(clock_in=1,1,0))dk from public_release_details where 1=1
- <if test="clockStart != null and clockEnd != null">
- and clock_in_time between #{clockStart} and #{clockEnd}
- </if>
- group by prid ) b on a.id =b.prid
- left join admin c on a.aid=c.id
- where 1=1
- <if test="aid != null">
- and a.aid= #{aid}
- </if>
- <if test="createStart != null and createEnd !=null">
- and a.create_time between #{createStart} and #{createEnd}
- </if>
- <if test="depId != null">
- and c.department_id = #{depId}
- </if>
- group by aid)x
- </select>
- <select id="listPublicDtails" resultType="com.goafanti.weChat.bo.OutPublicDtails">
- select a.id prdId,b.id,a.district_name districtName ,c.name aname,a.duration ,b.status ,b.annex_url annexUrl,a.photo_url photoUrl,d.nickname userName,
- date_format(a.clock_in_time ,'%Y-%m-%d %H:%i:%S') clockInTimes,a.clock_in clockIn ,b.remarks ,b.supplement ,b.`type` ,b.object_type objectType ,
- date_format(b.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,b.audit_info auditInfo,date_format(b.audit_time ,'%Y-%m-%d %H:%i:%S') auditTimes,
- date_format(b.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,date_format(b.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,a.address_name addressName,
- b.plan ,b.next_plan nextPlan ,b.expected_effect expectedEffect,b.update_status updateStatus,b.assist_aid_name assistAidName,
- b.main_name mainName,b.assist,b.assistant_aid assistantAid, b.assistant_name assistantName,f.contract_no contractNo,
- e.name sname,f.total_amount totalAmout,d.sign_bills signBills,date_format(d.sign_time,'%Y-%m-%d')signTime
- from public_release_details a left join public_release b on a.prid =b.id
- left join admin c on b.aid =c.id left join t_order_new f on b.order_no =f.order_no
- left join `user` d on a.uid =d.id left join admin e on d.aid=e.id
- where 1=1
- <if test="publicType != null">
- and b.type= #{publicType}
- </if>
- <if test="aid != null">
- and b.aid= #{aid}
- </if>
- <if test="sid != null">
- and d.aid= #{sid}
- </if>
- <if test="deps !=null">
- and c.department_id in
- <foreach close=")" collection="deps" item="dep" open="(" separator=",">
- #{dep}
- </foreach>
- </if>
- <if test="uid != null">
- and a.uid = #{uid}
- </if>
- <if test="releaseStart != null and releaseEnd != null">
- and (b.release_start between #{releaseStart} and #{releaseEnd} or b.release_end between #{releaseStart} and #{releaseEnd})
- </if>
- <if test="createStart != null and createEnd != null">
- and b.create_time between #{createStart} and #{createEnd}
- </if>
- <if test="status != null">
- and b.status = #{status}
- </if>
- <if test="statusType == 1">
- and b.status in (1,2)
- </if>
- <if test="clockIn !=null">
- and a.clock_in= #{clockIn}
- </if>
- <if test="contractNo !=null">
- and f.contract_no like CONCAT('%',#{contractNo},'%')
- </if>
- order by b.status,b.create_time desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="countPublicDtails" resultType="java.lang.Integer">
- select count(*)
- from public_release_details a left join public_release b on a.prid =b.id
- left join admin c on b.aid =c.id left join `user` d on a.uid =d.id
- <if test="contractNo !=null">
- left join t_order_new f on b.order_no =f.order_no
- </if>
- where 1=1
- <if test="publicType != null">
- and b.type= #{publicType}
- </if>
- <if test="aid != null">
- and b.aid= #{aid}
- </if>
- <if test="sid != null">
- and d.aid= #{sid}
- </if>
- <if test="deps !=null">
- and c.department_id in
- <foreach close=")" collection="deps" item="dep" open="(" separator=",">
- #{dep}
- </foreach>
- </if>
- <if test="uid != null">
- and a.uid = #{uid}
- </if>
- <if test="releaseStart != null and releaseEnd != null">
- and (b.release_start between #{releaseStart} and #{releaseEnd} or b.release_end between #{releaseStart} and #{releaseEnd})
- </if>
- <if test="createStart != null and createEnd != null">
- and b.create_time between #{createStart} and #{createEnd}
- </if>
- <if test="status != null">
- and b.status = #{status}
- </if>
- <if test="statusType == 1">
- and b.status in (1,2)
- </if>
- <if test="clockIn !=null">
- and a.clock_in= #{clockIn}
- </if>
- <if test="contractNo !=null">
- and f.contract_no like CONCAT('%',#{contractNo},'%')
- </if>
- </select>
- <select id="checkTime" resultType="java.lang.Integer">
- select id from public_release where aid=#{aid} and status in (0,1,2)
- and ( (release_start >= #{start} and release_start < #{end})
- or (release_start < #{start} and release_end > #{start})
- or (release_start < #{end} and release_end > #{end}))
- </select>
- <select id="getTimeUserFollow" resultType="com.goafanti.common.model.OutPublicReleaseCount">
- select e.id province,d.id depId,a.aid,a.uid,a.new_user newUser ,1 quantity from (select a.aid,b.uid,b.new_user from public_release a
- left join public_release_details b on a.id=b.prid
- where b.main_status =1 and a.create_time between #{date} and #{now}
- group by a.aid,b.uid,b.new_user)a left join admin c on a.aid=c.id
- left join department d on c.department_id =d.id left join district_glossory e on d.province =e.id
- </select>
- <select id="publicByOrder" resultType="com.goafanti.weChat.bo.OutPublicRelease">
- select a.id,a.uid,b.aid,b.nickname ,c.name aname,a.duration ,a.district_name districtName,
- date_format(pr.release_start,'%Y-%m-%d %H:%i:%S')releaseStarts,
- date_format(pr.release_end ,'%Y-%m-%d %H:%i:%S')releaseEnds,
- date_format(a.clock_in_time ,'%Y-%m-%d %H:%i:%S')clockInTimes,
- pr.remarks
- from public_release_details a left join public_release pr on a.prid=pr.id
- left join user b on a.uid=b.id left join admin c on pr.aid =c.id
- where pr.order_no = #{orderNo}
- </select>
- <select id="selectByMainId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from public_release
- where main_id = #{mainId}
- <if test="type !=null">
- and type= #{type}
- </if>
- <if test="aid !=null">
- and aid= #{aid}
- </if>
- </select>
- <update id="updateStatusByMainId">
- update public_release set status= #{status}
- where main_id= #{mainId}
- <if test="type !=null">
- and type= #{type}
- </if>
- <if test="aid !=null">
- and aid= #{aid}
- </if>
- </update>
- <select id="selectCountByaidAndDate" resultType="java.lang.Integer">
- select ifnull(count(*),0)publicReleaseCount
- from (select aid
- from public_release a left join public_release_details b on a.id=b.prid
- where status =2 and aid= #{aid}
- and a.release_start BETWEEN #{startTime} and #{endTime} )x
- group by aid
- </select>
- <select id="selectByaidAndDate" resultType="com.goafanti.admin.bo.OutFinanceCount">
- select aid,dates,sum(publicCount)publicCount
- from (select aid,if(a.`type` in (0,1,2),1,0) publicCount,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 a.status=2 and a.aid= #{aid}
- and a.release_start between #{startTime} and #{endTime})x
- group by x.aid,x.dates
- </select>
- <select id="selectByOrderNo" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from public_release
- where status in (1,2)
- and order_no= #{orderNo}
- </select>
- <select id="selectMyNewPublic" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from public_release
- where status in(1,2) and aid = #{aid}
- order by release_start desc limit 10
- </select>
- <select id="selectOutListBoById" resultType="com.goafanti.weChat.bo.OutPublicReleaseList">
- select a.id ,c.name aname,date_format(a.release_start,'%Y-%m-%d %H:%i:%S') releaseStarts,a.aid,a.public_type publicType,
- date_format(a.release_end ,'%Y-%m-%d %H:%i:%S') releaseEnds,date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes,a.status,
- date_format(a.update_time ,'%Y-%m-%d %H:%i:%S') updateTimes,a.update_status updateStatus,a.district_name districtName,
- a.assist,a.assist_aid assistAid,a.assist_aid_name assistAidName,a.type,a.main_name mainName,a.reject_name rejectName,
- a.assistant_aid assistantAid ,a.assistant_name assistantName,a.public_again publicAgain,a.user_names userNames,
- ea.total_amount expenseAmount ,a.clock_in clockIn,c2.name reviewerName,a.tech_start_process techStartProcess
- from public_release a left join admin c on a.aid =c.id
- left join admin c2 on c.reviewer=c2.id
- left join (select * from expense_account where status in (0,1,2,3)) ea on a.id =ea.prid
- where a.id= #{id}
- </select>
- <select id="selectAll" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from public_release
- where status in (1,2)
- </select>
- <select id="releaseAndExpenseCount" resultType="com.goafanti.weChat.bo.releaseAndExpenseCountOut">
- select
- a.order_no orderNo,a.contract_no contractNo,b.buyer_name buyerName,b.salesman_name salesmanName,b.dep_name depName,
- toc.actual_duration actualDuration ,
- a.total_amount totalAmount,a.settlement_amount settlementAmount,b.bid_type bidType,
- c.expenseCount,c.peopleCount,c.notExamine,c.rejectCount,d.paymentAmount,c.days,c.amount expenseAmount
- from t_order_new a left join t_order_mid b on a.order_no =b.order_no
- left join t_order_public_release_count toc on a.order_no =toc.order_no
- inner join (select a.order_no,a.expenseCount,b.peopleCount,c.notExamine, c.rejectCount,a.days,a.amount
- from (select a.order_no,count(a.id)expenseCount,sum(a.amount) amount,sum(ROUND(a.duration/7.5) )days
- from expense_account a where a.target_type = 1 and a.status=2
- <if test="startTime !=null and endTime !=null">
- and a.create_time BETWEEN #{startTime} and #{endTime}
- </if>
- group by order_no )a
- left join (select order_no,count(aid)peopleCount from (select a.order_no,aid from expense_account a
- where a.target_type = 1 and a.status=2 group by order_no,aid )a group by order_no)b on a.order_no=b.order_no
- left join (select a.order_no,sum(notExamine)notExamine,sum(rejectCount)rejectCount
- from (select a.order_no,status ,IF(status=1,1,0)notExamine,IF(status=3,1,0)rejectCount
- from expense_account a where a.target_type=1
- )a group by order_no)c on a.order_no=c.order_no )c on a.order_no =c.order_no
- left join ( select a.order_no ,sum(c.payment_amount) paymentAmount
- from t_order_new a left join t_order_task b on a.order_no =b.order_no left join t_order_payment c on b.id =c.tid
- where c.status =3 group by order_no )d on a.order_no=d.order_no
- where a.delete_sign in (0,2) and a.process_status >0
- <if test="contractNo != null">
- and a.contract_no = #{contractNo}
- </if>
- <if test="buyerName != null">
- and b.buyer_name like concat('%',#{buyerName},'%')
- </if>
- <if test="depId != null">
- and a.order_dep = #{depId}
- </if>
- <if test="aid != null">
- and a.salesman_id = #{aid}
- </if>
- <if test="allStatus == 1">
- and toc.exceed_duration =0
- </if>
- <if test="allStatus == 2">
- and toc.exceed_duration >0
- </if>
- order by contract_no desc
- </select>
- <select id="selectSonIdByMain" parameterType="java.lang.Integer" resultMap="BaseResultMap">
- select
- b.id, b.aid, b.release_start, b.release_end, b.remarks, b.annex_url, b.status, b.create_time, b.pid, b.pname, b.duration, b.valid_date, b.supplement, b.audit_info, b.plan, b.expected_effect, b.next_plan, b.type, b.order_no, b.update_time, b.update_status, b.assist, b.assist_aid, b.assist_aid_name, b.main_id, b.main_name, b.reject_name, b.assistant_aid, b.assistant_name, b.public_again, b.audit_time, b.new_user, b.sign_sum, b.user_names, b.object_type, b.public_type, b.district_name, b.clock_in, b.tech_start_process, b.address_name
- from public_release a left join public_release b on a.main_id=b.id
- where a.id = #{id,jdbcType=INTEGER}
- </select>
- <select id="selectCountByAssistUnaudited" resultType="java.lang.Integer">
- SELECT count(*)
- from public_release a left join admin_public_reviewer b on a.aid =b.aid
- where a.`type`=3 and a.assist =2 and a.status =1 and b.type =1
- and b.reviewer_id = #{aid}
- </select>
- <select id="selectCountByUnaudited" resultType="java.lang.Integer">
- select COUNT(*)
- from public_release a left join admin c on a.aid =c.id
- where a.public_type in (0,2)
- and a.assist in(0,1)
- and a.tech_start_process in (0,2)
- and a.status =1
- and c.reviewer = #{aid}
- </select>
- <select id="selectCountByOtherUnaudited" resultType="java.lang.Integer">
- select count(*)
- from public_release a
- left join public_release_details b on a.id=b.prid
- left join `user` e on b.uid=e.id
- where a.assist in(0,1)
- and(a.public_type =1 or a.tech_start_process=1)
- and a.status =1
- and e.aid = #{aid}
- </select>
- </mapper>
|