javaweb的时间生成规则 (用于定时任务)

1 篇文章 0 订阅
1.实现生成周次的时间变化规则
<insert id="insertEQC02" parameterType="cn.midas.erp.eqqc.contract.data.entity.EQQC08">
        insert into teqqc02(id,INTERNAL_CODE,plan_id,PLAN_TYPE,duty_dept_id,duty_dept_name,CHECK_STANDARD_ID,PLAN_SOURCE,
        plan_date_start,plan_date_end,DEVICE_TYPE,CLASS_FIRST,DEVICE_UNIT,DEVICE_AREA
        )

select (t1.PLAN_ID||t1.PLAN_TYPE||t1.DUTY_DEPT_ID||t2.CHECK_STANDARD_ID||to_char(sysdate,'yyyyMMdd')) as ID,
(select dbms_random.string('A',20) from dual)||t1.PLAN_ID as INTERNAL_CODE,
t1.plan_id,t1.PLAN_TYPE ,t1.duty_dept_id,t1.duty_dept_name,t2.CHECK_STANDARD_ID,'10' as PLAN_SOURCE ,
(SELECT TRUNC(TO_DATE(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd'),'IW')+7 FROM DUAL) as plan_date_start,
(SELECT TRUNC(TO_DATE(to_char(sysdate,'yyyy-MM-dd'),'YYYY-MM-DD'),'IW') + 11 FROM DUAL) as plan_date_end,
t2.DEVICE_TYPE,
        t2.CLASS_FIRST,
        subStr(t2.DEVICE_ID,0,2),
        subStr(t2.DEVICE_ID,0,4)
 from teqqc08 t1,teqqc10 t2 where t1.plan_id=t2.plan_id
and t1.PLAN_TYPE='ZJ' and t1.AUDIT_STATUS='10'
        <if test="planId neq null and planId neq ''">
            and t1.plan_id = #{planId}
        </if>
    </insert>
2.实现月次的时间变化鬼贼
insert into teqqc02(id,INTERNAL_CODE,plan_id,PLAN_TYPE,duty_dept_id,duty_dept_name,CHECK_STANDARD_ID,PLAN_SOURCE,
        plan_date_start,plan_date_end,DEVICE_TYPE,CLASS_FIRST,DEVICE_UNIT,DEVICE_AREA
        )
        select (t1.PLAN_ID||t1.PLAN_TYPE||t1.DUTY_DEPT_ID||t2.CHECK_STANDARD_ID||to_char(sysdate,'yyyyMMdd')) as ID,
        (select dbms_random.string('A',20) from dual)||t1.PLAN_ID as INTERNAL_CODE,
        t1.plan_id,t1.PLAN_TYPE ,t1.duty_dept_id,t1.duty_dept_name,t2.CHECK_STANDARD_ID,'10' as PLAN_SOURCE ,
        (SELECT  trunc(sysdate,'MM') FROM DUAL)  as plan_date_start,
        (SELECT TO_DATE(to_char(last_day(sysdate),'yyyy-MM-dd'),'YYYY-MM-DD') FROM DUAL) as plan_date_end,
        t2.DEVICE_TYPE,
        t2.CLASS_FIRST,
        subStr(t2.DEVICE_ID,0,2),
        subStr(t2.DEVICE_ID,0,4)
        from teqqc08 t1,teqqc10 t2 where t1.plan_id=t2.plan_id
        and t1.PLAN_TYPE='YJ' and t1.AUDIT_STATUS='10'
        <if test="planId neq null and planId neq ''">
            and t1.plan_id = #{planId}
        </if>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

学跑的猿

制作不易

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值