Flask接口签名sign原理与实例代码浅析
327
2023-02-08
mybatis动态插入list传入List参数的实例代码
mybatis动态插入list的实例代码如下所述:
insert into prpcitemkind
(RISKCODE, ITEMKINDNO, FAMILYNO, FAMILYNAME, PROJECTCODE, CLAUSECODE,
CLAUSENAME,
KINDCODE, KINDNAME, ITEMNO, ITEMCODE, ITEMDETAILNAME, GROUPNO, MODECODE,
MODENAME, STARTDATE,
STARTHOUR, ENDDATE, ENDHOUR, MODEL, BUYDATE, ADDRESSNO, CALCULATEFLAG, CURRENCY,
UNITAMOUNT,
QUANTITY, UNIT, VALUE, AMOUNT, RATEPERIOD, RATE, SHORTRATEFLAG, SHORTRATE,
PREPREMIUM, CALPREMIUM,
BASEPREMIUM, BENCHMARKPREMIUM, DISCOUNT, ADJUSTRATE, UNITPREMIUM, PREMIUM,
DEDUCTIBLERATE, DEDUCTIBLE,
FLAG, INSERTTIMEFORHIS, OPERATETIMEFORHIS, TAXRATE, TAXFLAG, TAXFEE,
NETPREMIUM, TAXFEE_GB, TAXFEE_LB, ALLTAXFEE, ALLNETPREMIUM,PROPOSALNO)
#{item.proposalno}
Mybatis 传入List参数的实例代码如下所述:
Java代码
//dao 代码 如果传入的参数是数组,也一样
void insertDefaultMsg(@Param("idsList") ArrayList
//xml文件
UPDATE
plf_pur_delivery_plan p
SET
p.promise_delivery_amount = p.quantity_req,
p.promise_delivery_time = p.quantity_time
WHERE p.id IN
#{item, jdbcType=VARCHAR}
//如果传入字符串
//service 代码
Map
String ids = map.get("ids");
String[] idsArr = ids.split(",");
String inId = "";
for (int i = 0; i < idsArr.length; i++) {
if (i != idsArr.length - 1) {
inId += "'" + idsArr[i] + "',";
} else {
inId += "'" + idsArr[i] + "'";
}
}
List
.getPlanListManual(inId);
//dao层代码
List
//xml 文件
SELECT
p.supplier_code,
p.pur_order_no,
IF(
p.update_times > 0,
'修改订单',
'新订单'
) AS order_type
FROM
plf_pur_delivery_plan p
WHERE p.is_notice = '0'
AND p.is_delete = '1'
AND p.id in(<![CDATA[${inId}]]>)
GROUP BY p.supplier_code,
p.pur_order_no
ORDER BY p.supplier_code
总结
以上所述是给大家介绍的mybatis动态插入list传入List参数的实例代码,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,会及时回复大家的!
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~