提交 2143039d 编写于 作者: sq3536's avatar sq3536

modify

上级 dc46f188
package cn.ibizlab.core.extensions.mapper;
import cn.ibizlab.core.lite.extensions.domain.EntityObj;
import cn.ibizlab.core.rule.domain.ExecResult;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
......@@ -10,4 +11,8 @@ import java.util.List;
public interface DbEntityMapper extends BaseMapper<EntityObj>{
List<EntityObj> search(@Param("sql") String sql, @Param("ew") Wrapper<EntityObj> wrapper);
int replaceBatch(List<ExecResult> var1);
int clearBatch(List<ExecResult> var1);
}
\ No newline at end of file
......@@ -8,5 +8,44 @@
<where><if test="ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere">${ew.sqlSegment}</if></where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<insert id="replaceBatch" parameterType="java.util.List" databaseId="mysql">
<foreach collection="list" item="item" index="index" separator=";">
INSERT INTO RU_EXECRESULT
(ru_execresultid,ru_execresultname, createdate, updatedate, ruleid, rulename, retvalue, keyvaluefield,dimfield, metricfield,domainsfield,timefield,ext1field,ext2field, businesscat )
VALUES
(#{item.ruexecresultid}, #{item.ruexecresultname}, now(), now(), #{item.ruleid}, #{item.rulename}, #{item.retvalue}, #{item.keyvaluefield}, #{item.dimfield}, #{item.metricfield},
#{item.domainsfield},#{item.timefield}, #{item.ext1field}, #{item.ext2field},#{item.businesscat} )
ON DUPLICATE KEY UPDATE
ru_execresultid=#{item.ruexecresultid},ru_execresultname=#{item.ruexecresultname}, createdate=now(), updatedate=now(), ruleid=#{item.ruleid}, rulename=#{item.rulename},
retvalue=#{item.retvalue}, keyvaluefield=#{item.keyvaluefield}, dimfield=#{item.dimfield}, metricfield=#{item.metricfield},domainsfield=#{item.domainsfield},timefield=#{item.timefield},
ext1field=#{item.ext1field},ext2field=#{item.ext2field}, businesscat=#{item.businesscat}
</foreach>
</insert>
<!--t1.BUSINESSCAT, t1.CREATEDATE, t1.DIMFIELD, t1.DOMAINSFIELD, t1.EXT1FIELD, t1.EXT2FIELD, t1.KEYVALUEFIELD, t1.METRICFIELD,
t1.RETVALUE, t1.RULEID, t1.RULENAME, t1.RU_EXECRESULTID, t1.RU_EXECRESULTNAME, t1.SYSTEMID, t1.TIMEFIELD, t1.UPDATEDATE-->
<insert id="replaceBatch" parameterType="java.util.List" databaseId="oracle" >
MERGE INTO RU_EXECRkSULT A USING (
<foreach collection='list' item='item' index='index' separator='UNION ALL'>
select #{item.ruexecresultid} as ru_execresultid, #{item.ruexecresultname} as ru_execresultname, sysdate as createdate, sysdate as updatedate, #{item.ruleid} as ruleid, #{item.rulename} as rulename,#{item.retvalue} as retvalue, #{item.keyvaluefield} as keyvaluefield, #{item.dimfield} as dimfield,
#{item.metricfield} as metricfield,#{item.domainsfield} as domainsfield,#{item.timefield} as timefield, #{item.ext1field} as ext1field,#{item.ext2field} as ext2field,#{item.businesscat} as businesscat from dual
</foreach>
) B ON (A.ru_execresultid = B.ru_execresultid) WHEN MATCHED THEN
UPDATE SET A.ru_execresultname=B.ru_execresultname, A.updatedate=B.updatedate, A.ruleid=B.ruleid, A.rulename=B.rulename, A.retvalue=B.retvalue, A.keyvaluefield=B.keyvaluefield,
A.dimfield=B.dimfield, A.metricfield=B.metricfield,A.domainsfield=B.domainsfield,A.timefield=B.timefield,A.ext1field=B.ext1field,A.ext2field=B.ext2field, A.businesscat=B.businesscat
WHEN NOT MATCHED THEN
INSERT ( ru_execresultid,ru_execresultname, createdate, updatedate, ruleid, rulename, retvalue, keyvaluefield,dimfield, metricfield,domainsfield,timefield,ext1field,ext2field, businesscat )
VALUES (B.ru_execresultid,B.ru_execresultname, B.createdate, B.updatedate, B.ruleid, B.rulename, B.retvalue, B.keyvaluefield,B.dimfield, B.metricfield,B.domainsfield,B.timefield,B.ext1field,B.ext2field, B.businesscat)
</insert>
<delete id="clearBatch" parameterType="java.util.List" >
delete from RU_EXECRESULT where (ruleid,keyvaluefield) in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
(#{item.ruleid},#{item.keyvaluefield})
</foreach>
</delete>
</mapper>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册