@Override
public int updateGoodsIsStops(UpdateGoodsIsStopsReq request, Holder holder) {
NDC.push(request.session.sessionKey);
LOG.begin();
int errorCode = 0;
UpdateGoodsIsStopsResp response = new UpdateGoodsIsStopsResp();
try {
LOG.debug("request: {0}", request);
if (Objects.isNull(request.session) || Objects.isNull(request.session.sessionKey)
|| request.session.sessionKey.isEmpty()) {
throw new ErrorCodeException(ErrorCode.ERR_ARCHIVES_PARAM, "session is empty.");
}
response.errorCode = goodsService.updateGoodsIsStops(request.ids, request.isStop);
} catch (ErrorCodeException e) {
LOG.error(e);
errorCode = e.getErrorCode().value();
} catch (Exception e) {
LOG.error(e);
errorCode = ErrorCode.ERR_ARCHIVES_RUNTIME.value();
} finally {
// If you never call it, then your application is sure to run out of memory.
NDC.remove();
}
holder.setValue(response);
LOG.debug("ret: {0}, response: {1}", errorCode, response);
return errorCode;
}
这是相当于controller层的代码
<update id="updateGoodsIsStops" parameterType="java.util.List">
update dt_ec.goods set is_stop =#{isStop} where goods_id in
<foreach collection="ids" item="item" index="index"
open="(" separator="," close=")">
#{item}
</foreach>
</update>